[vlc-devel] [PATCH v2 1/3] display: add a macro to set the callbacks and check type of the Open callback
Steve Lhomme
robux4 at ycbcr.xyz
Tue Jul 9 14:58:12 CEST 2019
---
include/vlc_vout_display.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index aa00003c8e0..0afe8e27dd4 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -208,6 +208,15 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
video_format_t *fmtp,
vlc_video_context *context);
+#define func_is_display_open(f) _Generic( f, vout_display_open_cb: 1, default: 0 )
+
+#define set_callbacks_display(Activate, Deactivate) \
+ static_assert(func_is_display_open(Activate) == 1, "Not a display activate callback"); \
+ { \
+ vout_display_open_cb open__ = Activate; \
+ set_callbacks( open__, Deactivate ) \
+ }
+
/**
* "vout display" close callback
*
--
2.17.1
More information about the vlc-devel
mailing list