[vlc-commits] input: add controls to select track via vlc_es_id_t

Thomas Guillem git at videolan.org
Thu Oct 18 13:12:42 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Aug 29 12:01:57 2018 +0200| [b06dcd639bfc0e5aafa130fd07d4fcfcdac2150d] | committer: Thomas Guillem

input: add controls to select track via vlc_es_id_t

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.

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

 src/input/input.c          | 20 ++++++++++++++++++++
 src/input/input_internal.h | 15 +++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index ef2e8c1475..eca27ad78d 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1655,6 +1655,11 @@ static void ControlRelease( int i_type, const 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_id_Release( p_param->id );
+        break;
 
     default:
         break;
@@ -2064,6 +2069,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.id ) == VLC_SUCCESS )
+                demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,
+                               vlc_es_id_GetInputId( param.id ) );
+            break;
+        case INPUT_CONTROL_UNSET_ES:
+            es_out_Control( input_priv(p_input)->p_es_out_display,
+                            ES_OUT_UNSET_ES, param.id );
+            break;
+        case INPUT_CONTROL_RESTART_ES:
+            es_out_Control( input_priv(p_input)->p_es_out_display,
+                            ES_OUT_RESTART_ES, param.id );
+            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 dbc79fb109..421b89e37c 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_id_t *id;
     struct {
         bool b_fast_seek;
         vlc_tick_t i_val;
@@ -233,6 +234,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
@@ -269,6 +274,16 @@ 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_id_t *id )
+{
+    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, &(input_control_param_t) {
+        .id = vlc_es_id_Hold( id ),
+    } );
+}
+
 bool input_Stopped( input_thread_t * );
 
 int input_GetAttachments(input_thread_t *input, input_attachment_t ***attachments);



More information about the vlc-commits mailing list