[vlc-commits] window: split creation and enabling in vout

Rémi Denis-Courmont git at videolan.org
Sat Jan 26 19:50:54 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 26 19:05:46 2019 +0200| [8fc53aae779453fb83a20f784b5087b9dae91390] | committer: Rémi Denis-Courmont

window: split creation and enabling in vout

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

 src/video_output/video_output.c | 25 +++++++++++++++----------
 src/video_output/window.c       | 11 +----------
 src/video_output/window.h       |  3 +--
 3 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 2792c0d815..877e000c8e 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -266,6 +266,17 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
     vlc_mutex_init(&sys->filter.lock);
 
     /* Window */
+    sys->window = vout_display_window_New(vout);
+    if (sys->splitter_name != NULL)
+        var_Destroy(vout, "window");
+    vlc_mutex_init(&sys->window_lock);
+
+    /* Arbitrary initial time */
+    vout_chrono_Init(&sys->render, 5, VLC_TICK_FROM_MS(10));
+
+    /* */
+    vlc_object_set_destructor(vout, VoutDestructor);
+
     vout_window_cfg_t wcfg = {
         .is_fullscreen = var_GetBool(vout, "fullscreen"),
         .is_decorated = var_InheritBool(vout, "video-deco"),
@@ -278,16 +289,10 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
         .height = cfg->fmt->i_visible_height,
     };
 
-    sys->window = vout_display_window_New(vout, &wcfg);
-    if (sys->splitter_name != NULL)
-        var_Destroy(vout, "window");
-    vlc_mutex_init(&sys->window_lock);
-
-    /* Arbitrary initial time */
-    vout_chrono_Init(&sys->render, 5, VLC_TICK_FROM_MS(10));
-
-    /* */
-    vlc_object_set_destructor(vout, VoutDestructor);
+    if (sys->window != NULL && vout_window_Enable(sys->window, &wcfg)) {
+        vout_display_window_Delete(sys->window);
+        sys->window = NULL;
+    }
 
     if (sys->window == NULL) {
         spu_Destroy(sys->spu);
diff --git a/src/video_output/window.c b/src/video_output/window.c
index fe992590d1..b14405631f 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -273,8 +273,7 @@ static const struct vout_window_callbacks vout_display_window_cbs = {
 /**
  * Creates a video window, initially without any attached display.
  */
-vout_window_t *vout_display_window_New(vout_thread_t *vout,
-                                       const vout_window_cfg_t *cfg)
+vout_window_t *vout_display_window_New(vout_thread_t *vout)
 {
     vout_display_window_t *state = malloc(sizeof (*state));
     if (state == NULL)
@@ -296,14 +295,6 @@ vout_window_t *vout_display_window_New(vout_thread_t *vout,
 
     window = vout_window_New((vlc_object_t *)vout, modlist, &owner);
     free(modlist);
-
-    if (window != NULL) {
-        if (vout_window_Enable(window, cfg)) {
-            vout_window_Delete(window);
-            window = NULL;
-        }
-    }
-
     if (window == NULL)
         free(state);
     return window;
diff --git a/src/video_output/window.h b/src/video_output/window.h
index a3272caef8..0149ac1ccb 100644
--- a/src/video_output/window.h
+++ b/src/video_output/window.h
@@ -18,6 +18,5 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-vout_window_t *vout_display_window_New(vout_thread_t *,
-                                       const vout_window_cfg_t *);
+vout_window_t *vout_display_window_New(vout_thread_t *);
 void vout_display_window_Delete(vout_window_t *);



More information about the vlc-commits mailing list