[vlc-commits] vout/wrapper: pass display explicitly

Rémi Denis-Courmont git at videolan.org
Fri Jun 14 05:31:30 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jun 13 13:04:51 2019 +0300| [4459b8a6b600e2da75f4f60f66b89fb2bd66a819] | committer: Rémi Denis-Courmont

vout/wrapper: pass display explicitly

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

 src/video_output/video_output.c  |  6 +++---
 src/video_output/vout_internal.h |  4 ++--
 src/video_output/vout_wrapper.c  | 20 +++++++++-----------
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index dea2d82f98..14333044dc 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1505,8 +1505,8 @@ static int vout_Start(vout_thread_t *vout, const vout_configuration_t *cfg)
     vlc_mutex_lock(&sys->display_lock);
     vlc_mutex_unlock(&sys->window_lock);
 
-    if (vout_OpenWrapper(vout, sys->splitter_name, &dcfg)) {
-        assert(sys->display == NULL);
+    sys->display = vout_OpenWrapper(vout, sys->splitter_name, &dcfg);
+    if (sys->display == NULL) {
         vlc_mutex_unlock(&sys->display_lock);
         goto error;
     }
@@ -1648,7 +1648,7 @@ void vout_StopDisplay(vout_thread_t *vout)
             vout_FlushUnlocked(vout, true, INT64_MAX);
 
         vlc_mutex_lock(&sys->display_lock);
-        vout_CloseWrapper(vout);
+        vout_CloseWrapper(vout, sys->display);
         sys->display = NULL;
         vlc_mutex_unlock(&sys->display_lock);
     }
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 021716ac0c..5490b2b12c 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -256,9 +256,9 @@ void vout_IntfReinit( vout_thread_t * );
 void vout_IntfDeinit(vlc_object_t *);
 
 /* */
-int vout_OpenWrapper(vout_thread_t *, const char *,
+vout_display_t *vout_OpenWrapper(vout_thread_t *, const char *,
                      const vout_display_cfg_t *);
-void vout_CloseWrapper(vout_thread_t *);
+void vout_CloseWrapper(vout_thread_t *, vout_display_t *vd);
 
 /* */
 ssize_t vout_RegisterSubpictureChannelInternal( vout_thread_t *, vlc_clock_t *clock );
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 494da61dc5..61046f2be0 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -64,7 +64,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
 /*****************************************************************************
  *
  *****************************************************************************/
-int vout_OpenWrapper(vout_thread_t *vout,
+vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
                      const char *splitter_name, const vout_display_cfg_t *cfg)
 {
     vout_thread_sys_t *sys = vout->p;
@@ -87,7 +87,7 @@ int vout_OpenWrapper(vout_thread_t *vout,
     free(modlistbuf);
 
     if (vd == NULL)
-        return VLC_EGENERIC;
+        return NULL;
 
     sys->decoder_pool = NULL;
     sys->display_pool = NULL;
@@ -142,25 +142,23 @@ int vout_OpenWrapper(vout_thread_t *vout,
         goto error;
     }
 
-    sys->display = vd;
-
 #ifdef _WIN32
     var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
     var_AddCallback(vout, "video-wallpaper", Forward, vd);
 #endif
     var_SetBool(VLC_OBJECT(vout), "viewpoint-changeable",
-        sys->display->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR);
-    return VLC_SUCCESS;
+                vd->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR);
+    return vd;
 
 error:
     vout_display_Delete(vd);
-    return VLC_EGENERIC;
+    return NULL;
 }
 
 /*****************************************************************************
  *
  *****************************************************************************/
-void vout_CloseWrapper(vout_thread_t *vout)
+void vout_CloseWrapper(vout_thread_t *vout, vout_display_t *vd)
 {
     vout_thread_sys_t *sys = vout->p;
 
@@ -168,15 +166,15 @@ void vout_CloseWrapper(vout_thread_t *vout)
 
     picture_pool_Release(sys->private_pool);
 
-    if (sys->display_pool != NULL || vout_IsDisplayFiltered(sys->display))
+    if (sys->display_pool != NULL || vout_IsDisplayFiltered(vd))
         picture_pool_Release(sys->decoder_pool);
 
 #ifdef _WIN32
-    var_DelCallback(vout, "video-wallpaper", Forward, sys->display);
+    var_DelCallback(vout, "video-wallpaper", Forward, vd);
 #endif
     sys->decoder_pool = NULL; /* FIXME remove */
 
-    vout_display_Delete(sys->display);
+    vout_display_Delete(vd);
 }
 
 #ifdef _WIN32



More information about the vlc-commits mailing list