[vlc-devel] [PATCH 2/5] input: add DEMUX_VOUT_CHANGED

Thomas Guillem thomas at gllm.fr
Fri Jul 13 11:34:38 CEST 2018


This control allow to propagate vout events from the decoder to the demux.
---
 include/vlc_demux.h |  4 ++++
 src/input/input.c   | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 26328c7268..0444e648c5 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -263,6 +263,10 @@ enum demux_query_e
     DEMUX_NAV_POPUP,
     /** Activate disc Root Menu. Can fail */
     DEMUX_NAV_MENU,            /* res=can fail */
+
+    /** A new vout was added or removed */
+    DEMUX_VOUT_CHANGED, /* arg1= vout_thread_t **, arg2= size_t, res=ignored */
+
     /** Enable/Disable a demux filter
      * \warning This has limited support, and is likely to break if more than
      * a single demux_filter is present in the chain. This is not guaranteed to
diff --git a/src/input/input.c b/src/input/input.c
index c07689bcf9..9265b7b1f8 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2299,8 +2299,20 @@ static bool Control( input_thread_t *p_input,
             break;
 
         case INPUT_CONTROL_VOUT_CHANGED:
+        {
+            input_thread_private_t *p_priv = input_priv( p_input );
+            demux_t *p_demux = input_priv(p_input)->master->p_demux;
+            vout_thread_t **pp_vout;
+            size_t i_vout;
+
             input_SendEventVout( p_input );
+
+            input_resource_HoldVouts( p_priv->p_resource, &pp_vout, &i_vout );
+            demux_Control( p_demux, DEMUX_VOUT_CHANGED, pp_vout, i_vout );
+            for( size_t i = 0; i < i_vout; ++i )
+                vlc_object_release( pp_vout[i] );
             break;
+        }
         case INPUT_CONTROL_AOUT_CHANGED:
             input_SendEventAout( p_input );
             break;
-- 
2.18.0



More information about the vlc-devel mailing list