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

Steve Lhomme robux4 at ycbcr.xyz
Wed Oct 2 16:23:25 CEST 2019


Use the one from the vout thread if it exists. We create one unconditionally
for now not to break the current VAAPI implementation.

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

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 80f813ba873..1a6afe0da21 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -309,7 +309,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_owner_t *);
+    vlc_decoder_device *, const vout_display_owner_t *);
 
 /**
  * Destroys a video output display.
diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
index be4d7916e81..cf05cd8b8f1 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);
+                                                   modname, ctx->device, 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/input/resource.c b/src/input/resource.c
index 46f2f339ab8..0c9693fb9e8 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -425,7 +425,9 @@ vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
     }
 #endif
 
-    if (vout_Request(cfg, NULL, p_resource->p_input)) {
+    vlc_decoder_device *dec_dev = vout_GetDevice(cfg);
+
+    if (vout_Request(cfg, dec_dev, p_resource->p_input)) {
         input_resource_PutVoutLocked(p_resource, cfg->vout, false);
         vlc_mutex_unlock(&p_resource->lock);
         return NULL;
diff --git a/src/video_output/display.c b/src/video_output/display.c
index e95e9539f17..9051eb52480 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 = {
@@ -734,6 +731,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
                                  const video_format_t *source,
                                  const vout_display_cfg_t *cfg,
                                  const char *module,
+                                 vlc_decoder_device *dec_device,
                                  const vout_display_owner_t *owner)
 {
     vout_display_priv_t *osys = vlc_custom_create(parent, sizeof (*osys),
@@ -772,13 +770,11 @@ 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_vtcx = { .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_vtcx) == NULL)
         goto error;
 
 #if defined(__OS2__)
@@ -803,8 +799,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 +817,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 deead4b3811..db2d36e67c0 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -73,8 +73,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,
+                          modlist, sys->dec_device, &owner);
     free(modlistbuf);
 
     if (vd == NULL)
-- 
2.17.1



More information about the vlc-devel mailing list