[vlc-devel] [PATCH 4/4] input: add controls to cycle through programs

Thomas Guillem thomas at gllm.fr
Wed Nov 14 17:50:18 CET 2018


cf. previous commit. This will be used by vlc_player_t.
---
 src/input/input.c          | 18 ++++++++++++++++--
 src/input/input_internal.h |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 355ac9144b..a7ae72bed6 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2081,6 +2081,20 @@ static bool Control( input_thread_t *p_input,
                                DEMUX_SET_GROUP_LIST,
                                (size_t)1, &(const int){ param.val.i_int });
             break;
+        case INPUT_CONTROL_SET_PROGRAM_NEXT:
+        case INPUT_CONTROL_SET_PROGRAM_PREV:
+        {
+            int query = i_type == INPUT_CONTROL_SET_PROGRAM_NEXT ?
+                        ES_OUT_SET_GROUP_NEXT : ES_OUT_SET_GROUP_PREV;
+            int new_group = 0;
+            es_out_Control(priv->p_es_out_display, query, &new_group);
+            if (new_group == 0)
+                demux_Control(priv->master->p_demux, DEMUX_SET_GROUP_DEFAULT);
+            else
+                demux_Control(priv->master->p_demux, DEMUX_SET_GROUP_LIST,
+                              (size_t)1, &(const int){ new_group });
+            break;
+        }
 
         case INPUT_CONTROL_SET_ES_BY_ID:
             /* No need to force update, es_out does it if needed */
@@ -2106,8 +2120,8 @@ static bool Control( input_thread_t *p_input,
         case INPUT_CONTROL_SET_ES_PREV:
         {
             vlc_es_id_t *id;
-            int query = i_type == INPUT_CONTROL_SET_ES_NEXT ? ES_OUT_SET_ES_NEXT
-                                                            : ES_OUT_SET_ES_PREV;
+            int query = i_type == INPUT_CONTROL_SET_ES_NEXT ?
+                        ES_OUT_SET_ES_NEXT : ES_OUT_SET_ES_PREV;
             if( es_out_Control( input_priv(p_input)->p_es_out_display, query,
                                 param.cat, &id ) == VLC_SUCCESS && id != NULL )
                 demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 311300faa1..6a9cc17d22 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -225,6 +225,8 @@ enum input_control_e
     INPUT_CONTROL_JUMP_TIME,
 
     INPUT_CONTROL_SET_PROGRAM,
+    INPUT_CONTROL_SET_PROGRAM_NEXT,
+    INPUT_CONTROL_SET_PROGRAM_PREV,
 
     INPUT_CONTROL_SET_TITLE,
     INPUT_CONTROL_SET_TITLE_NEXT,
-- 
2.19.1



More information about the vlc-devel mailing list