[vlc-commits] input: Allow the sout to change on the fly
Hugo Beauzée-Luyssen
git at videolan.org
Tue Sep 19 11:48:59 CEST 2017
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jun 19 15:22:51 2017 +0200| [4a0e43fbbdd5fbd86ad848adcbe2ade5cc315a99] | committer: Hugo Beauzée-Luyssen
input: Allow the sout to change on the fly
refs #18605
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a0e43fbbdd5fbd86ad848adcbe2ade5cc315a99
---
include/vlc_es_out.h | 3 +++
src/input/es_out.c | 9 +++++++++
src/input/es_out_timeshift.c | 3 +++
src/input/input.c | 20 ++++++++++++++++++++
4 files changed, 35 insertions(+)
diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 396c7edc98..f8d7aa1b2c 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -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* */
diff --git a/src/input/es_out.c b/src/input/es_out.c
index df13821a6e..777fe3611a 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 )
{
More information about the vlc-commits
mailing list