[vlc-devel] [PATCHv2 07/10] input: fix es_out_id_t/vlc_es_id_t mismatch

Thomas Guillem thomas at gllm.fr
Thu Feb 27 16:19:14 CET 2020


Harmless for now since they both point on the same struct.

es_out_id_t will be used from public controls, and vlc_es_id_t from private
ones. Indeed, vlc_es_id_t need to be hold/release from the timeshift (and only
this API allow it). es_out_id_t don't have to be hold/release from demux
modules since they controls their lifespan.
---
 src/input/es_out.c | 6 ++++--
 src/input/es_out.h | 6 +++---
 src/input/input.c  | 3 +--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 8565aacf303..342b665c63e 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3390,7 +3390,8 @@ static int EsOutVaPrivControlLocked( es_out_t *out, int query, va_list args )
     }
     case ES_OUT_PRIV_SET_ES_DELAY:
     {
-        es_out_id_t *es = va_arg(args, es_out_id_t *);
+        vlc_es_id_t *es_id = va_arg( args, vlc_es_id_t * );
+        es_out_id_t *es = vlc_es_id_get_out( es_id );
         const vlc_tick_t delay = va_arg(args, vlc_tick_t);
         EsOutSetEsDelay(out, es, delay);
         return VLC_SUCCESS;
@@ -3521,7 +3522,8 @@ static int EsOutVaPrivControlLocked( es_out_t *out, int query, va_list args )
     case ES_OUT_PRIV_SET_VBI_PAGE:
     case ES_OUT_PRIV_SET_VBI_TRANSPARENCY:
     {
-        es_out_id_t *es = va_arg( args, es_out_id_t * );
+        vlc_es_id_t *es_id = va_arg( args, vlc_es_id_t * );
+        es_out_id_t *es = vlc_es_id_get_out( es_id );
         assert(es);
         if( !es->p_dec || es->fmt.i_cat != SPU_ES
           || es->fmt.i_codec != VLC_CODEC_TELETEXT )
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 7fab0fb8d43..92f646602ef 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -44,7 +44,7 @@ enum es_out_query_private_e
     ES_OUT_PRIV_GET_WAKE_UP,                        /* arg1=vlc_tick_t*            res=cannot fail */
 
     /* Select a list of ES */
-    ES_OUT_PRIV_SET_ES_LIST, /* arg1= es_out_id_t *const* (null terminated array) */
+    ES_OUT_PRIV_SET_ES_LIST, /* arg1= vlc_es_id_t *const* (null terminated array) */
 
     /* Disable autoselection of tracks from a given category */
     ES_OUT_PRIV_SET_AUTOSELECT,  /* arg1= int (es category),
@@ -65,7 +65,7 @@ enum es_out_query_private_e
     ES_OUT_PRIV_GET_BUFFERING,                      /* arg1=bool*               res=cannot fail */
 
     /* Set delay for an ES identifier */
-    ES_OUT_PRIV_SET_ES_DELAY,                       /* arg1=es_out_id_t *, res=cannot fail */
+    ES_OUT_PRIV_SET_ES_DELAY,                       /* arg1=vlc_es_id_t *, res=cannot fail */
 
     /* Set delay for a ES category */
     ES_OUT_PRIV_SET_DELAY,                          /* arg1=es_category_e,      res=cannot fail */
@@ -176,7 +176,7 @@ static inline bool es_out_GetEmpty( es_out_t *p_out )
     assert( !i_ret );
     return b;
 }
-static inline void es_out_SetEsDelay( es_out_t *p_out, es_out_id_t *es, vlc_tick_t i_delay )
+static inline void es_out_SetEsDelay( es_out_t *p_out, vlc_es_id_t *es, vlc_tick_t i_delay )
 {
     int i_ret = es_out_PrivControl( p_out, ES_OUT_PRIV_SET_ES_DELAY, es, i_delay );
     assert( !i_ret );
diff --git a/src/input/input.c b/src/input/input.c
index 26b93ad8eb5..94458a68cef 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2086,8 +2086,7 @@ static bool Control( input_thread_t *p_input,
             break;
         case INPUT_CONTROL_SET_ES_DELAY:
             assert(param.es_delay.id);
-            es_out_SetEsDelay(priv->p_es_out_display,
-                              vlc_es_id_get_out(param.es_delay.id),
+            es_out_SetEsDelay(priv->p_es_out_display, param.es_delay.id,
                               param.es_delay.delay);
             break;
 
-- 
2.20.1



More information about the vlc-devel mailing list