[vlc-devel] [PATCH v4 5/5] display: set the capability at the same time as the (de)activate callbacks

Steve Lhomme robux4 at ycbcr.xyz
Wed Jul 10 10:39:08 CEST 2019


---
 include/vlc_vout_display.h              | 6 ++++--
 modules/hw/mmal/vout.c                  | 3 +--
 modules/hw/vdpau/display.c              | 3 +--
 modules/video_output/android/display.c  | 6 ++----
 modules/video_output/caca.c             | 3 +--
 modules/video_output/caopengllayer.m    | 3 +--
 modules/video_output/decklink.cpp       | 3 +--
 modules/video_output/fb.c               | 3 +--
 modules/video_output/flaschen.c         | 3 +--
 modules/video_output/ios.m              | 3 +--
 modules/video_output/kms.c              | 3 +--
 modules/video_output/kva.c              | 3 +--
 modules/video_output/macosx.m           | 3 +--
 modules/video_output/opengl/display.c   | 6 ++----
 modules/video_output/splitter.c         | 3 +--
 modules/video_output/vdummy.c           | 6 ++----
 modules/video_output/vmem.c             | 3 +--
 modules/video_output/vulkan/display.c   | 3 +--
 modules/video_output/wayland/shm.c      | 3 +--
 modules/video_output/win32/direct3d11.c | 3 +--
 modules/video_output/win32/direct3d9.c  | 3 +--
 modules/video_output/win32/glwin32.c    | 3 +--
 modules/video_output/win32/wingdi.c     | 3 +--
 modules/video_output/xcb/render.c       | 3 +--
 modules/video_output/xcb/x11.c          | 3 +--
 modules/video_output/yuv.c              | 3 +--
 26 files changed, 32 insertions(+), 58 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 1cbd6b1891..46ad3476de 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -216,19 +216,21 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
 typedef void (*vout_display_close_cb)(vout_display_t *vd);
 
 #ifndef __cplusplus
-#define set_callbacks_display(Activate, Deactivate) \
+#define set_callbacks_display(Activate, Deactivate, priority) \
     static_assert( _Generic( Activate, vout_display_open_cb: 1, default: 0 ) == 1, \
                   "Not a display activate callback"); \
     static_assert( _Generic( Deactivate, vout_display_close_cb: 1, void*: 1, default: 0 ) == 1, \
                   "Not a display deactivate callback"); \
+    set_capability("vout display", priority) \
     set_callbacks( Activate, Deactivate )
 #else /* __cplusplus */
-#define set_callbacks_display(Activate, Deactivate) \
+#define set_callbacks_display(Activate, Deactivate, priority) \
     static_assert( std::is_same<std::add_pointer<decltype(Activate)>::type, vout_display_open_cb>::value, \
                   "Not a display activate callback"); \
     static_assert( std::is_same<std::add_pointer<decltype(Deactivate)>::type, vout_display_close_cb>::value || \
                    std::is_same<decltype(Deactivate),std::nullptr_t>::value, \
                   "Not a display deactivate callback"); \
+    set_capability("vout display", priority) \
     set_callbacks( Activate, Deactivate )
 #endif /* __cplusplus */
 
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 3c5ceeb681..03aa6719cf 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -74,7 +74,6 @@ static void Close(vout_display_t *vd);
 vlc_module_begin()
     set_shortname(N_("MMAL vout"))
     set_description(N_("MMAL-based vout plugin for Raspberry Pi"))
-    set_capability("vout display", 90)
     add_shortcut("mmal_vout")
     add_integer(MMAL_LAYER_NAME, 1, MMAL_LAYER_TEXT, MMAL_LAYER_LONGTEXT, false)
     add_bool(MMAL_BLANK_BACKGROUND_NAME, true, MMAL_BLANK_BACKGROUND_TEXT,
@@ -83,7 +82,7 @@ vlc_module_begin()
                     MMAL_ADJUST_REFRESHRATE_LONGTEXT, false)
     add_bool(MMAL_NATIVE_INTERLACED, false, MMAL_NATIVE_INTERLACE_TEXT,
                     MMAL_NATIVE_INTERLACE_LONGTEXT, false)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 90)
 vlc_module_end()
 
 struct dmx_region_t {
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index c1891ae713..acd7a856c1 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -46,8 +46,7 @@ vlc_module_begin()
     set_description(N_("VDPAU output"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 0)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 0)
 
     add_shortcut("vdpau")
 vlc_module_end()
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 63cbfc2849..1b28bea50d 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -62,15 +62,13 @@ vlc_module_begin()
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
     set_description("Android video output")
-    set_capability("vout display", 260)
     add_shortcut("android-display")
     add_string(CFG_PREFIX "chroma", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 260)
     add_submodule ()
         set_description("Android opaque video output")
-        set_capability("vout display", 280)
         add_shortcut("android-opaque")
-        set_callbacks_display(OpenOpaque, Close)
+        set_callbacks_display(OpenOpaque, Close, 280)
 vlc_module_end()
 
 /*****************************************************************************
diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
index 6d79c65814..98e5e61b7a 100644
--- a/modules/video_output/caca.c
+++ b/modules/video_output/caca.c
@@ -530,6 +530,5 @@ vlc_module_begin()
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
     set_description(N_("Color ASCII art video output"))
-    set_capability("vout display", 15)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 15)
 vlc_module_end()
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 8aac36ada9..00d2477f84 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -53,10 +53,9 @@ static void Close(vout_display_t *vd);
 
 vlc_module_begin()
     set_description(N_("Core Animation OpenGL Layer (Mac OS X)"))
-    set_capability("vout display", 0)
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 0)
 vlc_module_end()
 
 static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count);
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index f28e3c772f..177720cccc 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -254,8 +254,7 @@ vlc_module_begin()
     set_description (N_("DeckLink Video Output module"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 0)
-    set_callbacks_display (OpenVideo, CloseVideo)
+    set_callbacks_display (OpenVideo, CloseVideo, 0)
     set_section(N_("DeckLink Video Options"), NULL)
     add_string(VIDEO_CFG_PREFIX "video-connection", "sdi",
                 VIDEO_CONNECTION_TEXT, VIDEO_CONNECTION_LONGTEXT, true)
diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index 41cdcc9821..d585945192 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -87,8 +87,7 @@ vlc_module_begin ()
                  true)
     add_obsolete_bool("fb-hw-accel") /* since 4.0.0 */
     set_description(N_("GNU/Linux framebuffer video output"))
-    set_capability("vout display", 30)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 30)
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/video_output/flaschen.c b/modules/video_output/flaschen.c
index 20941e745b..b316b5b065 100644
--- a/modules/video_output/flaschen.c
+++ b/modules/video_output/flaschen.c
@@ -61,8 +61,7 @@ static void Close(vout_display_t *vd);
 vlc_module_begin ()
     set_shortname( N_("Flaschen") )
     set_description( N_("Flaschen-Taschen video output") )
-    set_capability( "vout display", 0 )
-    set_callbacks_display( Open, Close )
+    set_callbacks_display( Open, Close, 0 )
     add_shortcut( "flaschen" )
 
     set_category( CAT_VIDEO )
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index ce0b46681c..cd7a49cebf 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -73,8 +73,7 @@ vlc_module_begin ()
     set_description("iOS OpenGL video output")
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 300)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 300)
 
     add_shortcut("vout_ios2", "vout_ios")
     add_glopts()
diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
index 0d27d0d574..4304235c92 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -788,6 +788,5 @@ vlc_module_begin ()
     add_string( "kms-drm-chroma", NULL, DRM_CHROMA_TEXT, DRM_CHROMA_LONGTEXT,
                 true)
     set_description("Linux kernel mode setting video output")
-    set_capability("vout display", 30)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 30)
 vlc_module_end ()
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index b59b8e2efc..13161cc5e9 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -70,9 +70,8 @@ vlc_module_begin ()
         change_string_list( ppsz_kva_video_mode, ppsz_kva_video_mode_text )
     add_bool( "kva-fixt23", false, KVA_FIXT23_TEXT, KVA_FIXT23_LONGTEXT, true )
     set_description( N_("K Video Acceleration video output") )
-    set_capability( "vout display", 100 )
     add_shortcut( "kva" )
-    set_callbacks_display( Open, Close )
+    set_callbacks_display( Open, Close, 100 )
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index d69efbf1d0..49596aa0d2 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -76,8 +76,7 @@ vlc_module_begin ()
     set_description (N_("Mac OS X OpenGL video output"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
-    set_capability ("vout display", 300)
-    set_callbacks_display (Open, Close)
+    set_callbacks_display (Open, Close, 300)
     add_shortcut ("macosx", "vout_macosx")
     add_glopts ()
 vlc_module_end ()
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index d99a1b6e6d..afec7b5c42 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -49,8 +49,7 @@ vlc_module_begin ()
 # define MODULE_VARNAME "gles2"
     set_shortname (N_("OpenGL ES2"))
     set_description (N_("OpenGL for Embedded Systems 2 video output"))
-    set_capability ("vout display", 265)
-    set_callbacks_display (Open, Close)
+    set_callbacks_display (Open, Close, 265)
     add_shortcut ("opengles2", "gles2")
     add_module("gles2", "opengl es2", NULL, GLES2_TEXT, PROVIDER_LONGTEXT)
 
@@ -62,8 +61,7 @@ vlc_module_begin ()
     set_description (N_("OpenGL video output"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
-    set_capability ("vout display", 270)
-    set_callbacks_display (Open, Close)
+    set_callbacks_display (Open, Close, 270)
     add_shortcut ("opengl", "gl")
     add_module("gl", "opengl", NULL, GL_TEXT, PROVIDER_LONGTEXT)
 #endif
diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
index 89c5450820..677ce4d259 100644
--- a/modules/video_output/splitter.c
+++ b/modules/video_output/splitter.c
@@ -335,8 +335,7 @@ vlc_module_begin()
     set_description(N_("Video splitter display plugin"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 0)
-    set_callbacks_display(vlc_vidsplit_Open, vlc_vidsplit_Close)
+    set_callbacks_display(vlc_vidsplit_Open, vlc_vidsplit_Close, 0)
     add_module("video-splitter", "video splitter", NULL,
                N_("Video splitter module"), N_("Video splitter module"))
 vlc_module_end()
diff --git a/modules/video_output/vdummy.c b/modules/video_output/vdummy.c
index 1d6c1cfe39..7fb35c2573 100644
--- a/modules/video_output/vdummy.c
+++ b/modules/video_output/vdummy.c
@@ -46,8 +46,7 @@ static int OpenStats(vout_display_t *vd, const vout_display_cfg_t *cfg,
 vlc_module_begin ()
     set_shortname( N_("Dummy") )
     set_description( N_("Dummy video output") )
-    set_capability( "vout display", 0 )
-    set_callbacks_display( OpenDummy, NULL )
+    set_callbacks_display( OpenDummy, NULL, 0 )
     add_shortcut( "dummy" )
 
     set_category( CAT_VIDEO )
@@ -56,9 +55,8 @@ vlc_module_begin ()
 
     add_submodule ()
     set_description( N_("Statistics video output") )
-    set_capability( "vout display", 0 )
     add_shortcut( "stats" )
-    set_callbacks_display( OpenStats, NULL )
+    set_callbacks_display( OpenStats, NULL, 0 )
 vlc_module_end ()
 
 
diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 4506703ecf..f8e0fbee1a 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -61,7 +61,6 @@ vlc_module_begin()
 
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 0)
 
     add_integer("vmem-width", 320, T_WIDTH, LT_WIDTH, false)
         change_private()
@@ -75,7 +74,7 @@ vlc_module_begin()
     add_obsolete_string("vmem-unlock") /* obsoleted since 1.1.1 */
     add_obsolete_string("vmem-data") /* obsoleted since 1.1.1 */
 
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 0)
 vlc_module_end()
 
 /*****************************************************************************
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index 1af573b1f1..c085e07f5d 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -391,8 +391,7 @@ vlc_module_begin ()
     set_description (N_("Vulkan video output"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
-    set_capability ("vout display", 0)
-    set_callbacks_display (Open, Close)
+    set_callbacks_display (Open, Close, 0)
     add_shortcut ("vulkan", "vk")
     add_module ("vk", "vulkan", NULL, VK_TEXT, PROVIDER_LONGTEXT)
 
diff --git a/modules/video_output/wayland/shm.c b/modules/video_output/wayland/shm.c
index 5ced9b206d..6cea58d300 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -399,7 +399,6 @@ vlc_module_begin()
     set_description(N_("Wayland shared memory video output"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 170)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 170)
     add_shortcut("wl")
 vlc_module_end()
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 1675216104..7b5f19d2de 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -84,9 +84,8 @@ vlc_module_begin ()
     add_integer("winrt-swapchain",     0x0, NULL, NULL, true) /* IDXGISwapChain1*     */
 #endif
 
-    set_capability("vout display", 300)
     add_shortcut("direct3d11")
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close,300)
 vlc_module_end ()
 
 struct vout_display_sys_t
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index b30a22dee2..0b5599ee56 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -113,9 +113,8 @@ vlc_module_begin ()
     add_loadfile("direct3d9-shader-file", NULL,
                  PIXEL_SHADER_FILE_TEXT, PIXEL_SHADER_FILE_LONGTEXT)
 
-    set_capability("vout display", 280)
     add_shortcut("direct3d9", "direct3d")
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 280)
 
 #ifdef HAVE_GL
     add_submodule()
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index fce46d879c..4b03e0ea25 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -49,9 +49,8 @@ vlc_module_begin()
     set_subcategory(SUBCAT_VIDEO_VOUT)
     set_shortname("OpenGL")
     set_description(N_("OpenGL video output for Windows"))
-    set_capability("vout display", 275)
     add_shortcut("glwin32", "opengl")
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 275)
     add_glopts()
 vlc_module_end()
 
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index d5fbb565ef..be0556b245 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -51,8 +51,7 @@ vlc_module_begin ()
     set_subcategory(SUBCAT_VIDEO_VOUT)
     set_shortname("GDI")
     set_description(N_("Windows GDI video output"))
-    set_capability("vout display", 110)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 110)
 vlc_module_end ()
 
 
diff --git a/modules/video_output/xcb/render.c b/modules/video_output/xcb/render.c
index 5a79bc3781..524eb1d4a1 100644
--- a/modules/video_output/xcb/render.c
+++ b/modules/video_output/xcb/render.c
@@ -713,8 +713,7 @@ vlc_module_begin()
     set_description(N_("X11 RENDER video output (XCB)"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 200)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 200)
     add_shortcut("x11-render", "xcb-render", "render")
     add_string("x11-render-filter", "good", N_("Scaling mode"),
                N_("Scaling mode"), true)
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 4d4109bbd5..dd1e9f7a66 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -354,8 +354,7 @@ vlc_module_begin()
     set_description(N_("X11 video output (XCB)"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 100)
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 100)
     add_shortcut("xcb-x11", "x11")
 
     add_obsolete_bool("x11-shm") /* obsoleted since 2.0.0 */
diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
index ba59022740..7f4c4333a3 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -58,7 +58,6 @@ vlc_module_begin()
     set_description(N_("YUV video output"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout display", 0)
 
     add_string(CFG_PREFIX "file", "stream.yuv",
                 YUV_FILE_TEXT, YUV_FILE_LONGTEXT, false)
@@ -67,7 +66,7 @@ vlc_module_begin()
     add_bool  (CFG_PREFIX "yuv4mpeg2", false,
                 YUV4MPEG2_TEXT, YUV4MPEG2_LONGTEXT, true)
 
-    set_callbacks_display(Open, Close)
+    set_callbacks_display(Open, Close, 0)
 vlc_module_end()
 
 /*****************************************************************************
-- 
2.17.1



More information about the vlc-devel mailing list