[vlc-devel] [PATCH 5/8] input: always use helpers for es_out privcontrols

Thomas Guillem thomas at gllm.fr
Thu Feb 27 14:55:44 CET 2020


Mainly to avoid confusion between private and public controls.
---
 src/input/es_out.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 src/input/input.c  | 40 ++++++++++++++++------------------------
 2 files changed, 58 insertions(+), 24 deletions(-)

diff --git a/src/input/es_out.h b/src/input/es_out.h
index e8daa31cc70..0839219718c 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -128,6 +128,37 @@ static inline vlc_tick_t es_out_GetWakeup( es_out_t *p_out )
     assert( !i_ret );
     return i_wu;
 }
+static inline int es_out_SetEsList( es_out_t *p_out,
+                                    enum es_format_category_e cat,
+                                    vlc_es_id_t **ids )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_SET_ES_LIST, cat, ids );
+}
+static inline int es_out_SetAutoSelect( es_out_t *p_out,
+                                        enum es_format_category_e cat, bool enabled )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_SET_AUTOSELECT, cat, enabled );
+}
+static inline int es_out_SetEsById( es_out_t *p_out, int id, bool forced )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_SET_ES_BY_ID, id, forced );
+}
+static inline int es_out_RestartEsById( es_out_t *p_out, int id )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_RESTART_ES_BY_ID, id  );
+}
+static inline int es_out_SetEsDefaultById( es_out_t *p_out, int id )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_SET_ES_DEFAULT_BY_ID, id );
+}
+static inline int es_out_StopAllEs( es_out_t *p_out, void **context )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_STOP_ALL_ES, context );
+}
+static inline int es_out_StartAllEs( es_out_t *p_out, void *context )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_START_ALL_ES, context );
+}
 static inline bool es_out_GetBuffering( es_out_t *p_out )
 {
     bool b;
@@ -197,6 +228,17 @@ static inline void es_out_Eos( es_out_t *p_out )
     int i_ret = es_out_PrivControl( p_out, ES_OUT_PRIV_SET_EOS );
     assert( !i_ret );
 }
+static inline int es_out_SetVbiPage( es_out_t *p_out, vlc_es_id_t *id,
+                                     unsigned page )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_SET_VBI_PAGE, id, page );
+}
+static inline int es_out_SetVbiTransparency( es_out_t *p_out, vlc_es_id_t *id,
+                                             bool enabled )
+{
+    return es_out_PrivControl( p_out, ES_OUT_PRIV_SET_VBI_TRANSPARENCY, id,
+                               enabled );
+}
 
 es_out_t  *input_EsOutNew( input_thread_t *, float rate );
 es_out_t  *input_EsOutTimeshiftNew( input_thread_t *, es_out_t *, float i_rate );
diff --git a/src/input/input.c b/src/input/input.c
index 613cc6f5252..420f9d71ac5 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2015,17 +2015,14 @@ static bool Control( input_thread_t *p_input,
 
         case INPUT_CONTROL_SET_ES_BY_ID:
             /* No need to force update, es_out does it if needed */
-            es_out_PrivControl( priv->p_es_out_display,
-                                ES_OUT_PRIV_SET_ES_BY_ID, (int)param.val.i_int,
-                                true );
+            es_out_SetEsById( priv->p_es_out_display, param.val.i_int, true );
 
             demux_Control( priv->master->p_demux, DEMUX_SET_ES,
-                    (int)param.val.i_int );
+                           (int)param.val.i_int );
             break;
 
         case INPUT_CONTROL_RESTART_ES_BY_ID:
-            es_out_PrivControl( priv->p_es_out_display,
-                                ES_OUT_PRIV_RESTART_ES_BY_ID, (int)param.val.i_int );
+            es_out_RestartEsById( priv->p_es_out_display, param.val.i_int );
             break;
 
         case INPUT_CONTROL_SET_ES:
@@ -2037,9 +2034,8 @@ static bool Control( input_thread_t *p_input,
             break;
         case INPUT_CONTROL_SET_ES_LIST:
         {
-            if( es_out_PrivControl( input_priv(p_input)->p_es_out_display,
-                                    ES_OUT_PRIV_SET_ES_LIST, param.list.cat,
-                                    param.list.ids ) == VLC_SUCCESS )
+            if( es_out_SetEsList( input_priv(p_input)->p_es_out_display,
+                                  param.list.cat, param.list.ids ) == VLC_SUCCESS )
             {
                 if( param.list.ids[0] != NULL && param.list.ids[1] == NULL )
                     demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_ES,
@@ -2261,8 +2257,7 @@ static bool Control( input_thread_t *p_input,
                 break;
 
             void *context;
-            if( es_out_PrivControl( priv->p_es_out_display,
-                                    ES_OUT_PRIV_STOP_ALL_ES, &context ) != VLC_SUCCESS )
+            if( es_out_StopAllEs( priv->p_es_out_display, &context ) != VLC_SUCCESS )
                 break;
 
             if ( p_priv->p_renderer )
@@ -2284,23 +2279,22 @@ static bool Control( input_thread_t *p_input,
                                         vlc_renderer_item_demux_filter( p_item ) );
                 }
             }
-            es_out_PrivControl( priv->p_es_out_display, ES_OUT_PRIV_START_ALL_ES,
-                                context );
+            es_out_StartAllEs( priv->p_es_out_display, context );
 #endif
             break;
         }
         case INPUT_CONTROL_SET_VBI_PAGE:
-            es_out_PrivControl( priv->p_es_out_display, ES_OUT_PRIV_SET_VBI_PAGE,
-                                param.vbi_page.id, param.vbi_page.page );
+            es_out_SetVbiPage( priv->p_es_out_display, param.vbi_page.id,
+                               param.vbi_page.page );
             break;
         case INPUT_CONTROL_SET_VBI_TRANSPARENCY:
-            es_out_PrivControl( priv->p_es_out_display, ES_OUT_PRIV_SET_VBI_TRANSPARENCY,
-                                param.vbi_transparency.id,
-                                param.vbi_transparency.enabled );
+            es_out_SetVbiTransparency( priv->p_es_out_display,
+                                       param.vbi_transparency.id,
+                                       param.vbi_transparency.enabled );
             break;
         case INPUT_CONTROL_SET_ES_AUTOSELECT:
-            es_out_PrivControl( priv->p_es_out_display, ES_OUT_PRIV_SET_AUTOSELECT,
-                                param.es_autoselect.cat, param.es_autoselect.enabled );
+            es_out_SetAutoSelect( priv->p_es_out_display, param.es_autoselect.cat,
+                                  param.es_autoselect.enabled );
             break;
 
         case INPUT_CONTROL_NAV_ACTIVATE:
@@ -3329,10 +3323,8 @@ static int input_SlaveSourceAdd( input_thread_t *p_input,
 
     assert( priv->i_last_es_id != -1 );
 
-    es_out_PrivControl( priv->p_es_out_display, ES_OUT_PRIV_SET_ES_DEFAULT_BY_ID,
-                        priv->i_last_es_id );
-    es_out_PrivControl( priv->p_es_out_display, ES_OUT_PRIV_SET_ES_BY_ID,
-                        priv->i_last_es_id, false );
+    es_out_SetEsDefaultById( priv->p_es_out_display, priv->i_last_es_id );
+    es_out_SetEsById( priv->p_es_out_display, priv->i_last_es_id, false );
 
     return VLC_SUCCESS;
 }
-- 
2.20.1



More information about the vlc-devel mailing list