[vlc-commits] vout: disable window on stop, re-enable it on restart

Rémi Denis-Courmont git at videolan.org
Sun Feb 24 12:51:45 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 24 13:31:00 2019 +0200| [5adfafb44aa8cf01a77a8fcaf5027ee067e7d09d] | committer: Rémi Denis-Courmont

vout: disable window on stop, re-enable it on restart

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

 src/video_output/video_output.c | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 1859b4d35f..f1cf88830f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1577,7 +1577,7 @@ out:
     return NULL;
 }
 
-void vout_Stop(vout_thread_t *vout)
+static void vout_StopDisplay(vout_thread_t *vout)
 {
     vout_thread_sys_t *sys = vout->p;
 
@@ -1591,6 +1591,17 @@ void vout_Stop(vout_thread_t *vout)
     sys->original.i_chroma = 0;
 }
 
+void vout_Stop(vout_thread_t *vout)
+{
+    vout_thread_sys_t *sys = vout->p;
+
+    vout_StopDisplay(vout);
+
+    vlc_mutex_lock(&sys->window_lock);
+    vout_window_Disable(sys->display_cfg.window);
+    vlc_mutex_unlock(&sys->window_lock);
+}
+
 void vout_Close(vout_thread_t *vout)
 {
     assert(vout);
@@ -1754,7 +1765,7 @@ vout_thread_t *vout_Request(vlc_object_t *object,
         }
 
         if (vout->p->original.i_chroma != 0)
-            vout_Stop(vout);
+            vout_StopDisplay(vout);
 
         vout_ReinitInterlacingSupport(vout);
     } else {
@@ -1764,13 +1775,12 @@ vout_thread_t *vout_Request(vlc_object_t *object,
     }
 
     vout_thread_sys_t *sys = vout->p;
+    bool enable = sys->original.i_chroma == 0;
+
     sys->original = original;
 
-    if (cfg->vout != NULL) {
-        vlc_mutex_lock(&vout->p->window_lock);
-        vout_UpdateWindowSize(vout);
-        vlc_mutex_unlock(&vout->p->window_lock);
-    } else {
+    vlc_mutex_lock(&sys->window_lock);
+    if (enable) {
         vout_window_cfg_t wcfg = {
             .is_fullscreen = var_GetBool(vout, "fullscreen"),
             .is_decorated = var_InheritBool(vout, "video-deco"),
@@ -1785,19 +1795,21 @@ vout_thread_t *vout_Request(vlc_object_t *object,
         vout_SizeWindow(vout, &wcfg.width, &wcfg.height);
 
         if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
-            vout_display_window_Delete(sys->display_cfg.window);
-            sys->display_cfg.window = NULL;
-            spu_Destroy(sys->spu);
-            vlc_object_release(vout);
-            return NULL;
+            vlc_mutex_unlock(&sys->window_lock);
+            goto error;
         }
+    } else
+        vout_UpdateWindowSize(vout);
+    vlc_mutex_unlock(&vout->p->window_lock);
 
+    if (cfg->vout == NULL) {
         if (input != NULL)
             vout->p->input = vlc_object_hold((vlc_object_t *)input);
     }
 
     if (vout_Start(vout, cfg)
      || vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
+error:
         msg_Err(vout, "video output creation failed");
         vout_display_window_Delete(sys->display_cfg.window);
         spu_Destroy(sys->spu);



More information about the vlc-commits mailing list