[vlc-commits] input: add controls to cycle through programs

Thomas Guillem git at videolan.org
Thu Nov 15 16:23:26 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Nov 14 17:48:57 2018 +0100| [aef860c1844a5357f630680685a3d161b3a24881] | committer: Thomas Guillem

input: add controls to cycle through programs

cf. previous commit. This will be used by vlc_player_t.

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

 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 5c5830e9ab..292d811412 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,



More information about the vlc-commits mailing list