Commit 4a0e43fb authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

input: Allow the sout to change on the fly

refs #18605
parent 3a8bb3d9
......@@ -38,6 +38,9 @@ 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* */
/* Restart all ES, destroying and recreating decoder/sout and potential
* video/audio outputs. This is not recommended and might not even work */
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* */
......
......@@ -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:
{
......
......@@ -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* */
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment