[vlc-commits] display: make close callback type-specific

Rémi Denis-Courmont git at videolan.org
Thu Jul 25 18:52:50 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 24 21:53:57 2019 +0300| [08b3f1673892cf7e09ca09eed972fedf81383f42] | committer: Rémi Denis-Courmont

display: make close callback type-specific

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=08b3f1673892cf7e09ca09eed972fedf81383f42
---

 include/vlc_vout_display.h              | 21 +++++----------------
 modules/hw/mmal/vout.c                  |  3 ++-
 modules/hw/vdpau/display.c              |  3 ++-
 modules/video_output/android/display.c  |  5 +++--
 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   |  5 +++--
 modules/video_output/splitter.c         |  3 ++-
 modules/video_output/vmem.c             |  3 ++-
 modules/video_output/vulkan/display.c   |  4 +++-
 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 ++-
 src/video_output/display.c              | 14 +++++---------
 26 files changed, 61 insertions(+), 51 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index a8cd4352bd..42484514b6 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -208,22 +208,6 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
                                     video_format_t *fmtp,
                                     vlc_video_context *context);
 
-/**
- * "vout display" close callback
- *
- * @param vd vout display context
- */
-typedef void (*vout_display_close_cb)(vout_display_t *vd);
-
-#define set_callbacks_display(activate, deactivate, priority) \
-    { \
-        vout_display_open_cb open__ = activate; \
-        vout_display_close_cb close__ = deactivate; \
-        (void) open__; (void) close__; \
-        set_callbacks(activate, deactivate) \
-    } \
-    set_capability( "vout display", priority )
-
 #define set_callback_display(activate, priority) \
     { \
         vout_display_open_cb open__ = activate; \
@@ -305,6 +289,11 @@ struct vout_display_t {
     /* Control on the module (mandatory) */
     int        (*control)(vout_display_t *, int, va_list);
 
+    /**
+     * Destroys the display.
+     */
+    void (*close)(vout_display_t *);
+
     /* Private place holder for the vout_display_t module (optional)
      *
      * A module is free to use it as it wishes.
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 03aa6719cf..bfed91588e 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -82,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, 90)
+    set_callback_display(Open, 90)
 vlc_module_end()
 
 struct dmx_region_t {
@@ -301,6 +301,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = vd_prepare;
     vd->display = vd_display;
     vd->control = vd_control;
+    vd->close = Close;
 
     vc_tv_register_callback(tvservice_cb, vd);
 
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index acd7a856c1..33d16d5298 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -46,7 +46,7 @@ vlc_module_begin()
     set_description(N_("VDPAU output"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(Open, Close, 0)
+    set_callback_display(Open, 0)
 
     add_shortcut("vdpau")
 vlc_module_end()
@@ -503,6 +503,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Queue;
     vd->display = Wait;
     vd->control = Control;
+    vd->close = Close;
 
     (void) context;
     return VLC_SUCCESS;
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 1b28bea50d..6d60b10fa8 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -64,11 +64,11 @@ vlc_module_begin()
     set_description("Android video output")
     add_shortcut("android-display")
     add_string(CFG_PREFIX "chroma", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true)
-    set_callbacks_display(Open, Close, 260)
+    set_callback_display(Open, 260)
     add_submodule ()
         set_description("Android opaque video output")
         add_shortcut("android-opaque")
-        set_callbacks_display(OpenOpaque, Close, 280)
+        set_callback_display(OpenOpaque, 280)
 vlc_module_end()
 
 /*****************************************************************************
@@ -610,6 +610,7 @@ static int OpenCommon(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
     vd->info.is_slow = !sys->p_window->b_opaque;
 
     return VLC_SUCCESS;
diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
index c88d255482..f95d985034 100644
--- a/modules/video_output/caca.c
+++ b/modules/video_output/caca.c
@@ -499,6 +499,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = PictureDisplay;
     vd->control = Control;
+    vd->close = Close;
 
     /* Fix initial state */
     caca_refresh_display(sys->dp);
@@ -532,5 +533,5 @@ vlc_module_begin()
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
     set_description(N_("Color ASCII art video output"))
-    set_callbacks_display(Open, Close, 15)
+    set_callback_display(Open, 15)
 vlc_module_end()
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 7c6cfac290..3b542d1e63 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -55,7 +55,7 @@ vlc_module_begin()
     set_description(N_("Core Animation OpenGL Layer (Mac OS X)"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(Open, Close, 0)
+    set_callback_display(Open, 0)
 vlc_module_end()
 
 static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count);
@@ -200,6 +200,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
         vd->prepare = PictureRender;
         vd->display = PictureDisplay;
         vd->control = Control;
+        vd->close   = Close;
 
         if (OSX_SIERRA_AND_HIGHER) {
             /* request our screen's HDR mode (introduced in OS X 10.11, but correctly supported in 10.12 only) */
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index 1516f2182d..f4d01fb81d 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -254,7 +254,7 @@ vlc_module_begin()
     set_description (N_("DeckLink Video Output module"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display (OpenVideo, CloseVideo, 0)
+    set_callback_display(OpenVideo, 0)
     set_section(N_("DeckLink Video Options"), NULL)
     add_string(VIDEO_CFG_PREFIX "video-connection", "sdi",
                 VIDEO_CONNECTION_TEXT, VIDEO_CONNECTION_LONGTEXT, true)
@@ -808,6 +808,7 @@ static int OpenVideo(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = PrepareVideo;
     vd->display = NULL;
     vd->control = ControlVideo;
+    vd->close = CloseVideo;
 
     vd->sys = (vout_display_sys_t*) sys;
 
diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index d585945192..1538af3465 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -87,7 +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_callbacks_display(Open, Close, 30)
+    set_callback_display(Open, 30)
 vlc_module_end ()
 
 /*****************************************************************************
@@ -295,6 +295,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = NULL;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     (void) context;
     return VLC_SUCCESS;
diff --git a/modules/video_output/flaschen.c b/modules/video_output/flaschen.c
index b316b5b065..00e1e66a34 100644
--- a/modules/video_output/flaschen.c
+++ b/modules/video_output/flaschen.c
@@ -61,7 +61,7 @@ static void Close(vout_display_t *vd);
 vlc_module_begin ()
     set_shortname( N_("Flaschen") )
     set_description( N_("Flaschen-Taschen video output") )
-    set_callbacks_display( Open, Close, 0 )
+    set_callback_display( Open, 0 )
     add_shortcut( "flaschen" )
 
     set_category( CAT_VIDEO )
@@ -141,6 +141,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = NULL;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     (void) cfg; (void) context;
     return VLC_SUCCESS;
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index e77cc93ea5..b5456cb3e8 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -73,7 +73,7 @@ vlc_module_begin ()
     set_description("iOS OpenGL video output")
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(Open, Close, 300)
+    set_callback_display(Open, 300)
 
     add_shortcut("vout_ios2", "vout_ios")
     add_glopts()
@@ -211,6 +211,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         vd->prepare = PictureRender;
         vd->display = PictureDisplay;
         vd->control = Control;
+        vd->close   = Close;
 
         return VLC_SUCCESS;
 
diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
index 4304235c92..025a4a2f79 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -768,6 +768,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = NULL;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     (void) context;
     return VLC_SUCCESS;
@@ -788,5 +789,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_callbacks_display(Open, Close, 30)
+    set_callback_display(Open, 30)
 vlc_module_end ()
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index 13161cc5e9..185e826960 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -71,7 +71,7 @@ vlc_module_begin ()
     add_bool( "kva-fixt23", false, KVA_FIXT23_TEXT, KVA_FIXT23_LONGTEXT, true )
     set_description( N_("K Video Acceleration video output") )
     add_shortcut( "kva" )
-    set_callbacks_display( Open, Close, 100 )
+    set_callback_display( Open, 100 )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -274,6 +274,7 @@ static void PMThread( void *arg )
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     /* Prevent SIG_FPE */
     _control87(MCW_EM, MCW_EM);
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 49596aa0d2..6290bbf763 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -76,7 +76,7 @@ vlc_module_begin ()
     set_description (N_("Mac OS X OpenGL video output"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
-    set_callbacks_display (Open, Close, 300)
+    set_callback_display(Open, 300)
     add_shortcut ("macosx", "vout_macosx")
     add_glopts ()
 vlc_module_end ()
@@ -243,6 +243,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
         vd->prepare = PictureRender;
         vd->display = PictureDisplay;
         vd->control = Control;
+        vd->close   = Close;
 
         /* */
         // FIXME: this call leads to a fatal mutex locking error in vout_ChangeDisplaySize()
diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index afec7b5c42..456304ebdf 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -49,7 +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_callbacks_display (Open, Close, 265)
+    set_callback_display(Open, 265)
     add_shortcut ("opengles2", "gles2")
     add_module("gles2", "opengl es2", NULL, GLES2_TEXT, PROVIDER_LONGTEXT)
 
@@ -61,7 +61,7 @@ vlc_module_begin ()
     set_description (N_("OpenGL video output"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
-    set_callbacks_display (Open, Close, 270)
+    set_callback_display(Open, 270)
     add_shortcut ("opengl", "gl")
     add_module("gl", "opengl", NULL, GL_TEXT, PROVIDER_LONGTEXT)
 #endif
@@ -147,6 +147,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = PictureRender;
     vd->display = PictureDisplay;
     vd->control = Control;
+    vd->close = Close;
     return VLC_SUCCESS;
 
 error:
diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
index 04cf26b7a6..401de4853d 100644
--- a/modules/video_output/splitter.c
+++ b/modules/video_output/splitter.c
@@ -318,6 +318,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
     vd->prepare = vlc_vidsplit_Prepare;
     vd->display = vlc_vidsplit_Display;
     vd->control = vlc_vidsplit_Control;
+    vd->close = vlc_vidsplit_Close;
     (void) cfg; (void) fmtp; (void) ctx;
     return VLC_SUCCESS;
 }
@@ -327,7 +328,7 @@ vlc_module_begin()
     set_description(N_("Video splitter display plugin"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(vlc_vidsplit_Open, vlc_vidsplit_Close, 0)
+    set_callback_display(vlc_vidsplit_Open, 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/vmem.c b/modules/video_output/vmem.c
index f8e0fbee1a..2bdcd63d9e 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -74,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, 0)
+    set_callback_display(Open, 0)
 vlc_module_end()
 
 /*****************************************************************************
@@ -219,6 +219,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close   = Close;
 
     (void) cfg; (void) context;
     return VLC_SUCCESS;
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index 79f6f93964..174627d67d 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -74,6 +74,7 @@ struct vout_display_sys_t
 static void PictureRender(vout_display_t *, picture_t *, subpicture_t *, mtime_t);
 static void PictureDisplay(vout_display_t *, picture_t *);
 static int Control(vout_display_t *, int, va_list);
+static void Close(vout_display_t *);
 static void UpdateParams(vout_display_t *);
 
 // Allocates a Vulkan surface and instance for video output.
@@ -141,6 +142,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = PictureRender;
     vd->display = PictureDisplay;
     vd->control = Control;
+    vd->close = Close;
 
     UpdateParams(vd);
     (void) cfg; (void) context;
@@ -373,7 +375,7 @@ vlc_module_begin ()
     set_description (N_("Vulkan video output"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
-    set_callbacks_display (Open, Close, 0)
+    set_callback_display(Open, 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 43e45f2dd8..cf75931aa5 100644
--- a/modules/video_output/wayland/shm.c
+++ b/modules/video_output/wayland/shm.c
@@ -377,6 +377,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     (void) context;
     return VLC_SUCCESS;
@@ -399,6 +400,6 @@ vlc_module_begin()
     set_description(N_("Wayland shared memory video output"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(Open, Close, 170)
+    set_callback_display(Open, 170)
     add_shortcut("wl")
 vlc_module_end()
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 7b5f19d2de..3ef9dd24a0 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -85,7 +85,7 @@ vlc_module_begin ()
 #endif
 
     add_shortcut("direct3d11")
-    set_callbacks_display(Open, Close,300)
+    set_callback_display(Open, 300)
 vlc_module_end ()
 
 struct vout_display_sys_t
@@ -384,6 +384,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     msg_Dbg(vd, "Direct3D11 Open Succeeded");
 
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 215b727846..9c1cf01064 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -111,7 +111,7 @@ vlc_module_begin ()
                  PIXEL_SHADER_FILE_TEXT, PIXEL_SHADER_FILE_LONGTEXT)
 
     add_shortcut("direct3d9", "direct3d")
-    set_callbacks_display(Open, Close, 280)
+    set_callback_display(Open, 280)
 
 #ifdef HAVE_GL
     add_submodule()
@@ -1758,6 +1758,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     return VLC_SUCCESS;
 error:
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 4b03e0ea25..2cc9cadba3 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -50,7 +50,7 @@ vlc_module_begin()
     set_shortname("OpenGL")
     set_description(N_("OpenGL video output for Windows"))
     add_shortcut("glwin32", "opengl")
-    set_callbacks_display(Open, Close, 275)
+    set_callback_display(Open, 275)
     add_glopts()
 vlc_module_end()
 
@@ -166,6 +166,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     return VLC_SUCCESS;
 
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index be0556b245..6653401b78 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -51,7 +51,7 @@ vlc_module_begin ()
     set_subcategory(SUBCAT_VIDEO_VOUT)
     set_shortname("GDI")
     set_description(N_("Windows GDI video output"))
-    set_callbacks_display(Open, Close, 110)
+    set_callback_display(Open, 110)
 vlc_module_end ()
 
 
@@ -128,6 +128,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
     return VLC_SUCCESS;
 
 error:
diff --git a/modules/video_output/xcb/render.c b/modules/video_output/xcb/render.c
index 524eb1d4a1..a88cdfcbbc 100644
--- a/modules/video_output/xcb/render.c
+++ b/modules/video_output/xcb/render.c
@@ -690,6 +690,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     (void) ctx;
     return VLC_SUCCESS;
@@ -713,7 +714,7 @@ vlc_module_begin()
     set_description(N_("X11 RENDER video output (XCB)"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(Open, Close, 200)
+    set_callback_display(Open, 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 dd1e9f7a66..0f7cf49eb1 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -337,6 +337,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = Prepare;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     (void) context;
     return VLC_SUCCESS;
@@ -354,7 +355,7 @@ vlc_module_begin()
     set_description(N_("X11 video output (XCB)"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_callbacks_display(Open, Close, 100)
+    set_callback_display(Open, 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 7f4c4333a3..c20b93d133 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -66,7 +66,7 @@ vlc_module_begin()
     add_bool  (CFG_PREFIX "yuv4mpeg2", false,
                 YUV4MPEG2_TEXT, YUV4MPEG2_LONGTEXT, true)
 
-    set_callbacks_display(Open, Close, 0)
+    set_callback_display(Open, 0)
 vlc_module_end()
 
 /*****************************************************************************
@@ -152,6 +152,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     vd->prepare = NULL;
     vd->display = Display;
     vd->control = Control;
+    vd->close = Close;
 
     (void) cfg; (void) context;
     return VLC_SUCCESS;
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 2438e4bb87..1a1677e332 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -87,13 +87,6 @@ static int vout_display_start(void *func, bool forced, va_list ap)
     return ret;
 }
 
-static void vout_display_stop(void *func, va_list ap)
-{
-    vout_display_close_cb deactivate = func;
-
-    deactivate(va_arg(ap, vout_display_t *));
-}
-
 /* */
 void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
                                         const video_format_t *source,
@@ -774,6 +767,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
     vd->prepare = NULL;
     vd->display = NULL;
     vd->control = NULL;
+    vd->close = NULL;
     vd->sys = NULL;
     if (owner)
         vd->owner = *owner;
@@ -803,7 +797,8 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
 
     if (VoutDisplayCreateRender(vd)) {
         if (vd->module != NULL) {
-            vlc_module_unload(vd->module, vout_display_stop, vd);
+            if (vd->close != NULL)
+                vd->close(vd);
             vlc_objres_clear(VLC_OBJECT(vd));
         }
         video_format_Clean(&vd->fmt);
@@ -829,7 +824,8 @@ void vout_display_Delete(vout_display_t *vd)
         picture_pool_Release(osys->pool);
 
     if (vd->module != NULL) {
-        vlc_module_unload(vd->module, vout_display_stop, vd);
+        if (vd->close != NULL)
+            vd->close(vd);
         vlc_objres_clear(VLC_OBJECT(vd));
     }
 



More information about the vlc-commits mailing list