[vlc-devel] [RFC PATCH 1/8] input: Allow the sout to change on the fly
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Wed Jul 19 16:17:41 CEST 2017
---
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 e6dc67b2e0..41bf56689b 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 16e966b91c..06b2b57179 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2339,6 +2339,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 7b1b24d64a..e537682d3c 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1734,6 +1734,26 @@ static void ControlUnpause( input_thread_t *p_input, mtime_t i_control_date )
es_out_SetPauseState( input_priv(p_input)->p_es_out, false, false, i_control_date );
}
+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 )
{
--
2.11.0
More information about the vlc-devel
mailing list