[vlc-commits] video_output: pass the vout directly to input_resource_GetVoutDecoderDevice()

Steve Lhomme git at videolan.org
Fri Jan 24 08:00:14 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jan 22 11:20:20 2020 +0100| [345587820665e5f668f203408e9b386646bbbe32] | committer: Steve Lhomme

video_output: pass the vout directly to input_resource_GetVoutDecoderDevice()

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

 src/input/decoder.c              |  4 ++--
 src/input/resource.c             | 28 +++++++++++-----------------
 src/input/resource.h             |  2 +-
 src/video_output/video_output.c  |  6 +++---
 src/video_output/vout_internal.h |  4 ++--
 5 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 840cda64bd..283592d875 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -543,7 +543,7 @@ static int CreateVoutIfNeeded(struct decoder_owner *p_owner,
                 .vout = p_owner->p_vout, .fmt = &p_dec->fmt_out.video,
             };
             input_resource_GetVoutDecoderDevice( p_owner->p_resource,
-                                                &cfg, order, pp_dec_dev );
+                                                 p_owner->p_vout, order, pp_dec_dev );
             *order = p_owner->vout_order;
             vlc_mutex_unlock( &p_owner->lock );
         }
@@ -561,7 +561,7 @@ static int CreateVoutIfNeeded(struct decoder_owner *p_owner,
         .vout = p_vout, .fmt = &p_dec->fmt_out.video,
     };
     p_vout = input_resource_GetVoutDecoderDevice( p_owner->p_resource,
-                                    &cfg, order, pp_dec_dev );
+                                                  p_vout, order, pp_dec_dev );
 
     if (pp_vout)
         *pp_vout = p_vout;
diff --git a/src/input/resource.c b/src/input/resource.c
index 4ff6edd79c..0d192f2beb 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -365,30 +365,24 @@ void input_resource_PutVout(input_resource_t *p_resource,
 }
 
 vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *p_resource,
-                                      const vout_device_configuration_t *cfg,
+                                      vout_thread_t *cfg_vout,
                                       enum vlc_vout_order *order,
                                       vlc_decoder_device **pp_dec_dev)
 {
-    vout_device_configuration_t cfg_buf;
     vout_thread_t *vout;
-
-    assert(cfg != NULL);
-    assert(cfg->fmt != NULL);
     vlc_mutex_lock( &p_resource->lock );
 
-    if (cfg->vout == NULL) {
-        cfg_buf = *cfg;
-        cfg_buf.vout = p_resource->p_vout_free;
+    if (cfg_vout == NULL) {
+        cfg_vout = p_resource->p_vout_free;
         p_resource->p_vout_free = NULL;
-        cfg = &cfg_buf;
 
-        if (cfg_buf.vout == NULL) {
+        if (cfg_vout == NULL) {
             /* Use the dummy vout as the parent of the future main vout. This
              * will allow the future vout to inherit all parameters
              * pre-configured on this dummy vout. */
             vlc_object_t *parent = p_resource->i_vout == 0 ?
                 VLC_OBJECT(p_resource->p_vout_dummy) : p_resource->p_parent;
-            cfg_buf.vout = vout = vout_Create(parent);
+            cfg_vout = vout = vout_Create(parent);
             if (vout == NULL)
                 goto out;
 
@@ -408,10 +402,10 @@ vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *p_resource,
     {
         vlc_mutex_lock(&p_resource->lock_hold);
         assert(p_resource->i_vout > 0);
-        *order = p_resource->pp_vout[0] == cfg->vout ? VLC_VOUT_ORDER_PRIMARY
+        *order = p_resource->pp_vout[0] == cfg_vout ? VLC_VOUT_ORDER_PRIMARY
                                                      : VLC_VOUT_ORDER_SECONDARY;
         /* the caller is going to reuse the free vout, it's not free anymore */
-        if (p_resource->p_vout_free == cfg->vout)
+        if (p_resource->p_vout_free == cfg_vout)
             p_resource->p_vout_free = NULL;
         vlc_mutex_unlock(&p_resource->lock_hold);
     }
@@ -419,18 +413,18 @@ vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *p_resource,
 #ifndef NDEBUG
     {
         int index;
-        TAB_FIND(p_resource->i_vout, p_resource->pp_vout, cfg->vout, index );
+        TAB_FIND(p_resource->i_vout, p_resource->pp_vout, cfg_vout, index );
         assert(index >= 0);
-        assert(p_resource->p_vout_free == NULL || p_resource->p_vout_free == cfg->vout);
+        assert(p_resource->p_vout_free == NULL || p_resource->p_vout_free == cfg_vout);
     }
 #endif
 
     if (pp_dec_dev)
     {
-        *pp_dec_dev = vout_GetDevice(cfg);
+        *pp_dec_dev = vout_GetDevice(cfg_vout);
     }
 
-    vout = cfg->vout;
+    vout = cfg_vout;
 
 out:
     vlc_mutex_unlock( &p_resource->lock );
diff --git a/src/input/resource.h b/src/input/resource.h
index 6e85b3661d..b46ef6a33d 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -38,7 +38,7 @@ void input_resource_SetInput( input_resource_t *, input_thread_t * );
 sout_instance_t *input_resource_RequestSout( input_resource_t *, sout_instance_t *, const char *psz_sout );
 
 vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *,
-                                      const vout_device_configuration_t *,
+                                      vout_thread_t *cfg_vout,
                                       enum vlc_vout_order *order,
                                       vlc_decoder_device **);
 int input_resource_StartVout(input_resource_t *, vlc_video_context *, const vout_configuration_t *);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 83a773e916..edda78d731 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -2093,15 +2093,15 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
     return 0;
 }
 
-vlc_decoder_device *vout_GetDevice(const vout_device_configuration_t *cfg)
+vlc_decoder_device *vout_GetDevice(vout_thread_t *vout)
 {
     vlc_decoder_device *dec_device = NULL;
 
-    vout_thread_sys_t *sys = cfg->vout->p;
+    vout_thread_sys_t *sys = vout->p;
 
     vlc_mutex_lock(&sys->window_lock);
     if (sys->dec_device == NULL)
-        sys->dec_device = vlc_decoder_device_Create(&cfg->vout->obj, sys->display_cfg.window);
+        sys->dec_device = vlc_decoder_device_Create(&vout->obj, sys->display_cfg.window);
     dec_device = sys->dec_device ? vlc_decoder_device_Hold( sys->dec_device ) : NULL;
     vlc_mutex_unlock(&sys->window_lock);
     return dec_device;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 0ca81871fe..b0a5e805fd 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -202,10 +202,10 @@ vout_thread_t *vout_CreateDummy(vlc_object_t *obj) VLC_USED;
 /**
  * Setup the vout for the given configuration and get an associated decoder device.
  *
- * \param cfg the video configuration requested.
+ * \param vout the video configuration requested.
  * \return pointer to a decoder device reference to use with the vout or NULL
  */
-vlc_decoder_device *vout_GetDevice(const vout_device_configuration_t *cfg);
+vlc_decoder_device *vout_GetDevice(vout_thread_t *vout);
 
 /**
  * Returns a suitable vout or release the given one.



More information about the vlc-commits mailing list