[vlc-commits] input: resource: return the order of the vout

Thomas Guillem git at videolan.org
Tue Jun 25 20:55:25 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun 21 13:57:32 2019 +0200| [d41f7f26a28715586f1ac362665c8dd8fdaf2327] | committer: Thomas Guillem

input: resource: return the order of the vout

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

 src/input/decoder.c  |  3 ++-
 src/input/resource.c | 17 ++++++++++++++++-
 src/input/resource.h |  3 ++-
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9877703122..d3ecfb6e5c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -540,12 +540,13 @@ static int vout_update_format( decoder_t *p_dec )
             dpb_size = 2;
             break;
         }
+        enum vlc_vout_order order;
         p_vout = input_resource_GetVout( p_owner->p_resource,
             &(vout_configuration_t) {
                 .vout = p_vout, .clock = p_owner->p_clock, .fmt = &fmt,
                 .dpb_size = dpb_size + p_dec->i_extra_picture_buffers + 1,
                 .mouse_event = MouseEvent, .mouse_opaque = p_dec
-            } );
+            }, &order );
         if (p_vout)
             decoder_Notify(p_owner, on_vout_added, p_vout);
 
diff --git a/src/input/resource.c b/src/input/resource.c
index bc9f4603f1..85fdee813f 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -385,7 +385,8 @@ void input_resource_PutVout(input_resource_t *p_resource,
 }
 
 vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
-                                      const vout_configuration_t *cfg)
+                                      const vout_configuration_t *cfg,
+                                      enum vlc_vout_order *order)
 {
     vout_configuration_t cfg_buf;
     vout_thread_t *vout;
@@ -411,10 +412,24 @@ vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
                 goto out;
 
             vlc_mutex_lock(&p_resource->lock_hold);
+            *order = p_resource->i_vout == 0 ? VLC_VOUT_ORDER_PRIMARY
+                                             : VLC_VOUT_ORDER_SECONDARY;
             TAB_APPEND(p_resource->i_vout, p_resource->pp_vout, vout);
             vlc_mutex_unlock(&p_resource->lock_hold);
         } else
+        {
+            /* The free vout is always the first one */
+            *order = VLC_VOUT_ORDER_PRIMARY;
             msg_Dbg(p_resource->p_parent, "trying to reuse free vout");
+        }
+    }
+    else
+    {
+        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
+                                                     : VLC_VOUT_ORDER_SECONDARY;
+        vlc_mutex_unlock(&p_resource->lock_hold);
     }
 
 #ifndef NDEBUG
diff --git a/src/input/resource.h b/src/input/resource.h
index 9aaa7d6464..1d81a8c97e 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -38,7 +38,8 @@ 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_GetVout(input_resource_t *,
-                                      const vout_configuration_t *);
+                                      const vout_configuration_t *,
+                                      enum vlc_vout_order *order);
 void input_resource_PutVout(input_resource_t *, vout_thread_t *);
 
 /**



More information about the vlc-commits mailing list