[vlc-commits] demux: merge single program into list

Rémi Denis-Courmont git at videolan.org
Sun Jun 10 12:10:45 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  9 12:04:12 2018 +0300| [90b1145a727ae284fc36e32416f3afcd4516320f] | committer: Rémi Denis-Courmont

demux: merge single program into list

So far, DEMUX_SET_GROUP accepts four different prototypes of sorts:
*  0, dummy: select the default program
* -1, NULL:  select all progams
* -1, &list: select programs in list
*  i, dummy: select program i

This patch folds the last case into the third one: a single program is
a list one of program.

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

 src/input/input.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 7d9314ce8b..4d49ba21ec 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1269,8 +1269,18 @@ static void InitPrograms( input_thread_t * p_input )
     }
     else
     {
-        demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_GROUP,
-                       es_out_GetGroupForced( input_priv(p_input)->p_es_out ), NULL );
+        int program = es_out_GetGroupForced( input_priv(p_input)->p_es_out );
+        if( program == 0 )
+            demux_Control( input_priv(p_input)->master->p_demux,
+                           DEMUX_SET_GROUP, 0, NULL );
+        else
+        {
+            vlc_value_t val = { .i_int = program };
+            list.i_count = 1, list.p_values = &val;
+
+            demux_Control( input_priv(p_input)->master->p_demux,
+                           DEMUX_SET_GROUP, -1, &list );
+        }
     }
 }
 
@@ -2015,8 +2025,16 @@ static bool Control( input_thread_t *p_input,
             es_out_Control( input_priv(p_input)->p_es_out,
                             ES_OUT_SET_GROUP, val.i_int );
 
-            demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_GROUP, val.i_int,
-                            NULL );
+            if( val.i_int == 0 )
+                demux_Control( input_priv(p_input)->master->p_demux,
+                               DEMUX_SET_GROUP, 0, NULL );
+            else
+            {
+                vlc_list_t list = { .i_count = 1, list.p_values = &val };
+
+                demux_Control( input_priv(p_input)->master->p_demux,
+                               DEMUX_SET_GROUP, -1, &list );
+            }
             break;
 
         case INPUT_CONTROL_SET_ES:



More information about the vlc-commits mailing list