[vlc-devel] [RFC PATCH 01/10] input: Allow the sout to change on the fly
Rémi Denis-Courmont
remi at remlab.net
Thu Sep 7 16:52:26 CEST 2017
Le torstaina 7. syyskuuta 2017, 15.45.57 EEST Hugo Beauzée-Luyssen a écrit :
> ---
> include/vlc_es_out.h | 1 +
> src/input/es_out.c | 9 +++++++++
> src/input/es_out_timeshift.c | 3 +++
> src/input/input.c | 20 ++++++++++++++++++++
> 4 files changed, 33 insertions(+)
>
> diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
> index 396c7edc98..424a0f2aa4 100644
> --- a/include/vlc_es_out.h
> +++ b/include/vlc_es_out.h
> @@ -38,6 +38,7 @@ enum es_out_query_e
> /* set ES selected for the es category (audio/video/spu) */
> ES_OUT_SET_ES, /* arg1= es_out_id_t* */
> ES_OUT_RESTART_ES, /* arg1= es_out_id_t* */
> + ES_OUT_RESTART_ALL_ES, /* No arg */
>
> /* set 'default' tag on ES (copied across from container) */
> ES_OUT_SET_ES_DEFAULT, /* arg1= es_out_id_t* */
> diff --git a/src/input/es_out.c b/src/input/es_out.c
> index 33e10eed87..679e6e6ba8 100644
> --- a/src/input/es_out.c
> +++ b/src/input/es_out.c
> @@ -2342,6 +2342,15 @@ static int EsOutControlLocked( es_out_t *out, int
> i_query, va_list args ) }
> return VLC_SUCCESS;
> }
> + case ES_OUT_RESTART_ALL_ES:
> + {
> + for( int i = 0; i < p_sys->i_es; i++ )
> + {
> + EsDestroyDecoder( out, p_sys->es[i] );
> + EsCreateDecoder( out, p_sys->es[i] );
> + }
> + return VLC_SUCCESS;
> + }
>
> case ES_OUT_SET_ES_DEFAULT:
> {
> diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
> index ff5bd6bdbe..48f42f5f45 100644
> --- a/src/input/es_out_timeshift.c
> +++ b/src/input/es_out_timeshift.c
> @@ -644,6 +644,7 @@ static int ControlLocked( es_out_t *p_out, int i_query,
> va_list args ) case ES_OUT_SET_META:
> case ES_OUT_SET_ES:
> case ES_OUT_RESTART_ES:
> + case ES_OUT_RESTART_ALL_ES:
> case ES_OUT_SET_ES_DEFAULT:
> case ES_OUT_SET_ES_STATE:
> case ES_OUT_SET_ES_CAT_POLICY:
> @@ -1401,6 +1402,7 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int
> i_query, va_list args, bool b_co
>
> case ES_OUT_RESET_PCR: /* no arg */
> case ES_OUT_SET_EOS:
> + case ES_OUT_RESTART_ALL_ES:
> break;
>
> case ES_OUT_SET_META: /* arg1=const vlc_meta_t* */
> @@ -1552,6 +1554,7 @@ static int CmdExecuteControl( es_out_t *p_out,
> ts_cmd_t *p_cmd )
>
> case ES_OUT_RESET_PCR: /* no arg */
> case ES_OUT_SET_EOS:
> + case ES_OUT_RESTART_ALL_ES:
> return es_out_Control( p_out, i_query );
>
> case ES_OUT_SET_GROUP_META: /* arg1=int i_group arg2=const vlc_meta_t*
> */ diff --git a/src/input/input.c b/src/input/input.c
> index d76640121e..94413449f6 100644
> --- a/src/input/input.c
> +++ b/src/input/input.c
> @@ -1850,6 +1850,26 @@ static void ControlNav( input_thread_t *p_input, int
> i_type ) }
> }
>
> +static void ControlUpdateSout( input_thread_t *p_input, const char*
> psz_chain ) +{
> + var_SetString( p_input, "sout", psz_chain );
> + if( psz_chain && *psz_chain )
> + {
> + if( InitSout( p_input ) != VLC_SUCCESS )
> + {
> + msg_Err( p_input, "Failed to start sout" );
> + return;
> + }
> + }
> + else
> + {
> + input_resource_RequestSout( input_priv(p_input)->p_resource,
> + input_priv(p_input)->p_sout, NULL );
> + input_priv(p_input)->p_sout = NULL;
> + }
> + es_out_Control( input_priv(p_input)->p_es_out, ES_OUT_RESTART_ALL_ES );
> +}
> +
> static bool Control( input_thread_t *p_input,
> int i_type, vlc_value_t val )
> {
I don´t have a fundamental objection to changing the stream output on a live
input thread. But it breaks a number of assumptions in input thread and ES out
that would need to be addressed first.
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list