[vlc-devel] [PATCH 04/31] display: don't store the dummy context in the display anymore

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 23 17:01:09 CEST 2019


Use the one from the vout thread if it exists.

Later the video context will come from the decoder (if any).
---
 include/vlc_vout_display.h      |  2 +-
 modules/video_output/splitter.c |  4 ++--
 src/video_output/display.c      | 17 +++++------------
 src/video_output/vout_wrapper.c |  4 ++--
 4 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 80f813ba873..c7834b463b7 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -308,7 +308,7 @@ struct vout_display_t {
  */
 VLC_API
 vout_display_t *vout_display_New(vlc_object_t *, const video_format_t *,
-    const vout_display_cfg_t *, const char *module,
+    const vout_display_cfg_t *, vlc_decoder_device *, const char *module,
     const vout_display_owner_t *);
 
 /**
diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
index be4d7916e81..4cebe79ebbb 100644
--- a/modules/video_output/splitter.c
+++ b/modules/video_output/splitter.c
@@ -290,7 +290,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
 
         vdcfg.window = part->window;
         vout_display_t *display = vout_display_New(obj, &output->fmt, &vdcfg,
-                                                   modname, NULL);
+                                                   ctx->device, modname, NULL);
         if (display == NULL) {
             vout_window_Disable(part->window);
             vout_window_Delete(part->window);
@@ -310,7 +310,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
     vd->display = vlc_vidsplit_Display;
     vd->control = vlc_vidsplit_Control;
     vd->close = vlc_vidsplit_Close;
-    (void) fmtp; (void) ctx;
+    (void) fmtp;
     return VLC_SUCCESS;
 }
 
diff --git a/src/video_output/display.c b/src/video_output/display.c
index e95e9539f17..97603317d17 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -286,9 +286,6 @@ typedef struct {
     atomic_bool reset_pictures;
 #endif
     picture_pool_t *pool;
-
-    /* temporary: must come from decoder module */
-    vlc_video_context video_context;
 } vout_display_priv_t;
 
 static const struct filter_video_callbacks vout_display_filter_cbs = {
@@ -733,6 +730,7 @@ void vout_SetDisplayViewpoint(vout_display_t *vd,
 vout_display_t *vout_display_New(vlc_object_t *parent,
                                  const video_format_t *source,
                                  const vout_display_cfg_t *cfg,
+                                 vlc_decoder_device *dec_device,
                                  const char *module,
                                  const vout_display_owner_t *owner)
 {
@@ -772,13 +770,13 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
     if (owner)
         vd->owner = *owner;
 
-    osys->video_context.device = vlc_decoder_device_Create(osys->cfg.window);
-    vlc_video_context *video_context = osys->video_context.device ?
-        &osys->video_context : NULL;
+    vlc_video_context fake_vctx = {
+        .device = dec_device,
+    };
 
     if (vlc_module_load(vd, "vout display", module, module && *module != '\0',
                         vout_display_start, vd, &osys->cfg, &vd->fmt,
-                        video_context) == NULL)
+                        &fake_vctx) == NULL)
         goto error;
 
 #if defined(__OS2__)
@@ -803,8 +801,6 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
     return vd;
 error:
     video_format_Clean(&vd->source);
-    if (osys->video_context.device)
-        vlc_decoder_device_Release(osys->video_context.device);
     vlc_object_delete(vd);
     return NULL;
 }
@@ -823,9 +819,6 @@ void vout_display_Delete(vout_display_t *vd)
         vd->close(vd);
     vlc_objres_clear(VLC_OBJECT(vd));
 
-    if (osys->video_context.device)
-        vlc_decoder_device_Release(osys->video_context.device);
-
     video_format_Clean(&vd->source);
     video_format_Clean(&vd->fmt);
     vlc_object_delete(vd);
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 9ac6e2eab08..80907bcac7d 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -72,8 +72,8 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
     else
         modlist = "splitter,none";
 
-    vd = vout_display_New(VLC_OBJECT(vout), &sys->original, cfg, modlist,
-                          &owner);
+    vd = vout_display_New(VLC_OBJECT(vout), &sys->original, cfg,
+                          sys->dec_device, modlist, &owner);
     free(modlistbuf);
 
     if (vd == NULL)
-- 
2.17.1



More information about the vlc-devel mailing list