[vlc-devel] [PATCH 2/4] input: add controls to cycle through ES tracks

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


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

diff --git a/src/input/input.c b/src/input/input.c
index ab184b7593..355ac9144b 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2102,6 +2102,18 @@ static bool Control( input_thread_t *p_input,
                 demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,
                                vlc_es_id_GetInputId( param.id ) );
             break;
+        case INPUT_CONTROL_SET_ES_NEXT:
+        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;
+            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,
+                               vlc_es_id_GetInputId( id ) );
+            break;
+        }
         case INPUT_CONTROL_UNSET_ES:
             es_out_Control( input_priv(p_input)->p_es_out_display,
                             ES_OUT_UNSET_ES, param.id );
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 82eb5f64bd..311300faa1 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -85,6 +85,7 @@ typedef union
     vlc_value_t val;
     vlc_viewpoint_t viewpoint;
     vlc_es_id_t *id;
+    enum es_format_category_e cat;
     struct {
         bool b_fast_seek;
         vlc_tick_t i_val;
@@ -247,6 +248,8 @@ enum input_control_e
     INPUT_CONTROL_RESTART_ES_BY_ID,
 
     INPUT_CONTROL_SET_ES,
+    INPUT_CONTROL_SET_ES_NEXT,
+    INPUT_CONTROL_SET_ES_PREV,
     INPUT_CONTROL_UNSET_ES,
     INPUT_CONTROL_RESTART_ES,
 
-- 
2.19.1



More information about the vlc-devel mailing list