[vlc-commits] input: always use helpers for es_out privcontrols

Thomas Guillem git at videolan.org
Fri Feb 28 20:45:56 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 27 14:05:19 2020 +0100| [eaa86db5ec8001003df2d46687ba4dd5a17b5188] | committer: Thomas Guillem

input: always use helpers for es_out privcontrols

Mainly to avoid confusion between private and public controls.

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

 src/input/es_out.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 src/input/input.c  | 31 +++++++++++++------------------
 2 files changed, 55 insertions(+), 18 deletions(-)

diff --git a/src/input/es_out.h b/src/input/es_out.h
index 69c9130092..faa3ddfa2f 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -129,6 +129,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;
@@ -198,6 +229,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 36b243aa75..26b93ad8eb 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2014,9 +2014,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,
@@ -2238,8 +2237,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 )
@@ -2261,23 +2259,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:
@@ -3306,10 +3303,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;
 }



More information about the vlc-commits mailing list