[vlc-devel] [PATCH 6/6] RFC: input: add controls to select track via vlc_es_t

Thomas Guillem thomas at gllm.fr
Wed Aug 29 14:24:31 CEST 2018


Internal for now, will be used by the future vlc_player_t.

Won't be pushed now since this patch can't be tested. It will be tested via the
future vlc_player_t testsuite.
---
 src/input/input.c          | 20 ++++++++++++++++++++
 src/input/input_internal.h | 13 +++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index 62c07e38a5..0d886feadc 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1640,6 +1640,11 @@ static void ControlRelease( int i_type, input_control_param_t *p_param )
         if( p_param->val.p_address )
             vlc_renderer_item_release( p_param->val.p_address );
         break;
+    case INPUT_CONTROL_SET_ES:
+    case INPUT_CONTROL_UNSET_ES:
+    case INPUT_CONTROL_RESTART_ES:
+        vlc_es_Release( p_param->es );
+        break;
 
     default:
         break;
@@ -2053,6 +2058,21 @@ static bool Control( input_thread_t *p_input,
                             ES_OUT_RESTART_ES_BY_ID, (int)param.val.i_int );
             break;
 
+        case INPUT_CONTROL_SET_ES:
+            if( es_out_Control( input_priv(p_input)->p_es_out_display,
+                                ES_OUT_SET_ES, param.es ) == VLC_SUCCESS )
+                demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,
+                               vlc_es_GetId( param.es ) );
+            break;
+        case INPUT_CONTROL_UNSET_ES:
+            es_out_Control( input_priv(p_input)->p_es_out_display,
+                            ES_OUT_UNSET_ES, param.es );
+            break;
+        case INPUT_CONTROL_RESTART_ES:
+            es_out_Control( input_priv(p_input)->p_es_out_display,
+                            ES_OUT_RESTART_ES, param.es );
+            break;
+
         case INPUT_CONTROL_SET_VIEWPOINT:
         case INPUT_CONTROL_SET_INITIAL_VIEWPOINT:
         case INPUT_CONTROL_UPDATE_VIEWPOINT:
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 08a3a1d5f1..e3857bbedc 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -82,6 +82,7 @@ typedef union
 {
     vlc_value_t val;
     vlc_viewpoint_t viewpoint;
+    vlc_es_t *es;
     struct {
         bool b_fast_seek;
         vlc_tick_t i_val;
@@ -223,6 +224,10 @@ enum input_control_e
     INPUT_CONTROL_SET_ES_BY_ID,
     INPUT_CONTROL_RESTART_ES_BY_ID,
 
+    INPUT_CONTROL_SET_ES,
+    INPUT_CONTROL_UNSET_ES,
+    INPUT_CONTROL_RESTART_ES,
+
     INPUT_CONTROL_SET_VIEWPOINT,    // new absolute viewpoint
     INPUT_CONTROL_SET_INITIAL_VIEWPOINT, // set initial viewpoint (generally from video)
     INPUT_CONTROL_UPDATE_VIEWPOINT, // update viewpoint relative to current
@@ -259,6 +264,14 @@ static inline void input_ControlPushHelper( input_thread_t *p_input, int i_type,
     }
 }
 
+static inline void input_ControlPushEsHelper( input_thread_t *p_input, int i_type,
+                                              vlc_es_t *es )
+{
+    assert( i_type == INPUT_CONTROL_SET_ES || i_type == INPUT_CONTROL_UNSET_ES ||
+            i_type == INPUT_CONTROL_RESTART_ES );
+    input_ControlPush( p_input, i_type, vlc_es_Hold( es ) );
+}
+
 bool input_Stopped( input_thread_t * );
 
 /* Bound pts_delay */
-- 
2.18.0



More information about the vlc-devel mailing list