vlc | branch: master | Thomas Guillem <[email protected]> | Fri Feb 28 15:15:38 2020 +0100| [a88c34e608bd204375fac02ec515e8f39867666e] | committer: Thomas Guillem
es_out: use vlc_es_id_t to save start/stop all context And finally, the last control using the legacy int id. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a88c34e608bd204375fac02ec515e8f39867666e --- src/input/es_out.c | 25 ++++++++++--------------- src/input/es_out.h | 12 ++++++------ src/input/input.c | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/input/es_out.c b/src/input/es_out.c index e19cc57a2c..5dbf554682 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -3566,37 +3566,32 @@ static int EsOutVaPrivControlLocked( es_out_t *out, int query, va_list args ) foreach_es_then_es_slaves(es) count++; - int *selected_es = vlc_alloc(count + 1, sizeof(int)); + vlc_es_id_t **selected_es = vlc_alloc(count + 1, sizeof(vlc_es_id_t *)); if (!selected_es) return VLC_ENOMEM; - *va_arg(args, void **) = selected_es; - *selected_es = count; + *va_arg(args, vlc_es_id_t ***) = selected_es; foreach_es_then_es_slaves(es) { if (EsIsSelected(es)) { EsOutDestroyDecoder(out, es); - *++selected_es = es->fmt.i_id; + *selected_es++ = vlc_es_id_Hold(&es->id); } - else - *++selected_es = -1; + *selected_es = NULL; } return VLC_SUCCESS; } case ES_OUT_PRIV_START_ALL_ES: { - int *selected_es = va_arg( args, void * ); - int count = selected_es[0]; - for( int i = 0; i < count; ++i ) + vlc_es_id_t **selected_es = va_arg( args, vlc_es_id_t ** ); + vlc_es_id_t **selected_es_it = selected_es; + for( vlc_es_id_t *id = *selected_es_it; id != NULL; + id = *++selected_es_it ) { - int i_id = selected_es[i + 1]; - if( i_id != -1 ) - { - es_out_id_t *p_es = EsOutGetFromID( out, i_id ); - EsOutCreateDecoder( out, p_es ); - } + EsOutCreateDecoder( out, vlc_es_id_get_out( id ) ); + vlc_es_id_Release( id ); } free(selected_es); EsOutStopFreeVout( out ); diff --git a/src/input/es_out.h b/src/input/es_out.h index 689e10edc3..cc8ce55a6a 100644 --- a/src/input/es_out.h +++ b/src/input/es_out.h @@ -53,11 +53,11 @@ enum es_out_query_private_e ES_OUT_PRIV_SET_ES_CAT_IDS, /* arg1=es_format_category_e arg2=const char *, res=cannot fail */ - /* Stop all selected ES and save the stopped state in a context. free the - * context or call ES_OUT_PRIV_STOP_ALL_ES */ - ES_OUT_PRIV_STOP_ALL_ES, /* arg1=void ** */ + /* Stop all selected ES and save the stopped state in a context. + * Call ES_OUT_PRIV_START_ALL_ES to release the context. */ + ES_OUT_PRIV_STOP_ALL_ES, /* arg1=vlc_es_id_t *** */ /* Start all ES from the context returned by ES_OUT_PRIV_STOP_ALL_ES */ - ES_OUT_PRIV_START_ALL_ES, /* arg1=void * */ + ES_OUT_PRIV_START_ALL_ES, /* arg1=vlc_es_id_t ** */ /* Get buffering state */ ES_OUT_PRIV_GET_BUFFERING, /* arg1=bool* res=cannot fail */ @@ -153,11 +153,11 @@ static inline void es_out_SetEsCatIds( es_out_t *p_out, cat, str_ids ); assert( ret == VLC_SUCCESS ); } -static inline int es_out_StopAllEs( es_out_t *p_out, void **context ) +static inline int es_out_StopAllEs( es_out_t *p_out, vlc_es_id_t ***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 ) +static inline int es_out_StartAllEs( es_out_t *p_out, vlc_es_id_t **context ) { return es_out_PrivControl( p_out, ES_OUT_PRIV_START_ALL_ES, context ); } diff --git a/src/input/input.c b/src/input/input.c index 4f8d70a8ca..34f965ed19 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -2301,7 +2301,7 @@ static bool Control( input_thread_t *p_input, if ( p_item == NULL && p_priv->p_renderer == NULL ) break; - void *context; + vlc_es_id_t **context; if( es_out_StopAllEs( priv->p_es_out_display, &context ) != VLC_SUCCESS ) break; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
