[vlc-commits] video_output: group the code to release/unload the display module in a function

Steve Lhomme git at videolan.org
Tue Jan 19 12:29:58 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov 20 09:52:32 2020 +0100| [736ad81c9ee407727fa512bf51519f52fec72ac9] | committer: Steve Lhomme

video_output: group the code to release/unload the display module in a function

The rest of vout_ReleaseDisplayAndFilters (formerly vout_ReleaseDisplayAndFilters)
also deals with filters, mouse handling, decoder FIFO, etc.

The display module is flushed unconditionally (effectively the converters
filter chain).

The sys->original video format is also released so we detect new inputs as a
format change.

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

 src/video_output/video_output.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 758caf01c6..b64286e4ce 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1934,6 +1934,19 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
 
     assert(sys->display != NULL);
 
+    vout_FilterFlush(sys->display);
+
+    vout_CloseWrapper(&vout->obj, &sys->private, sys->display);
+    sys->display = NULL;
+    assert(sys->private.display_pool == NULL);
+
+    video_format_Clean(&sys->original);
+}
+
+static void vout_ReleaseDisplayAndFilters(vout_thread_sys_t *vout)
+{
+    vout_thread_sys_t *sys = vout;
+
     if (sys->spu_blend != NULL)
         filter_DeleteBlend(sys->spu_blend);
 
@@ -1942,8 +1955,7 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
         vout_FlushUnlocked(vout, true, INT64_MAX);
 
     vlc_mutex_lock(&sys->display_lock);
-    vout_CloseWrapper(&vout->obj, &sys->private, sys->display);
-    sys->display = NULL;
+    vout_ReleaseDisplay(vout);
     vlc_mutex_unlock(&sys->display_lock);
 
     /* Destroy the video filters */
@@ -1963,7 +1975,6 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
         picture_fifo_Delete(sys->decoder_fifo);
         sys->decoder_fifo = NULL;
     }
-    assert(sys->private.display_pool == NULL);
 
     if (sys->mouse_event)
     {
@@ -1974,7 +1985,6 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
     if (sys->spu)
         spu_Detach(sys->spu);
     sys->clock = NULL;
-    video_format_Clean(&sys->original);
 }
 
 void vout_StopDisplay(vout_thread_t *vout)
@@ -1986,7 +1996,7 @@ void vout_StopDisplay(vout_thread_t *vout)
     vout_control_Wake(&sys->control);
     vlc_join(sys->thread, NULL);
 
-    vout_ReleaseDisplay(sys);
+    vout_ReleaseDisplayAndFilters(sys);
 }
 
 static void vout_DisableWindow(vout_thread_sys_t *sys)
@@ -2319,7 +2329,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
     }
     atomic_store(&sys->control_is_terminated, false);
     if (vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
-        vout_ReleaseDisplay(vout);
+        vout_ReleaseDisplayAndFilters(vout);
         vout_DisableWindow(vout);
         return -1;
     }



More information about the vlc-commits mailing list