From 94f733af227b488b350763354d12d78998fc3705 Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Thu, 19 Jul 2018 12:50:23 +0200 Subject: [PATCH] es_out: add ES_OUT_UNSET_ES This control will allow demuxers to disable an ES track without using "*-es" input variables. --- include/vlc_es_out.h | 1 + src/input/es_out.c | 17 +++++++++++++++++ src/input/es_out_timeshift.c | 3 +++ 3 files changed, 21 insertions(+) diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h index b30d24e873..7ed544022b 100644 --- a/include/vlc_es_out.h +++ b/include/vlc_es_out.h @@ -37,6 +37,7 @@ enum es_out_query_e { /* set or change the selected ES in its category (audio/video/spu) */ ES_OUT_SET_ES, /* arg1= es_out_id_t* */ + ES_OUT_UNSET_ES, /* arg1= es_out_id_t* res=can fail */ ES_OUT_RESTART_ES, /* arg1= es_out_id_t* */ /* set 'default' tag on ES (copied across from container) */ diff --git a/src/input/es_out.c b/src/input/es_out.c index d40713c65a..948bb4407f 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -2403,6 +2403,23 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args ) return VLC_SUCCESS; } + case ES_OUT_UNSET_ES: + { + es_out_id_t *es = va_arg( args, es_out_id_t * ), *other; + foreach_es_then_es_slaves(other) + { + if (es == other) + { + if (EsIsSelected(other)) + { + EsUnselect(out, other, other->p_pgrm == p_sys->p_pgrm); + return VLC_SUCCESS; + } + break; + } + } + return VLC_EGENERIC; + } case ES_OUT_STOP_ALL_ES: { es_out_id_t *es; diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c index 62c633bf4c..552b896132 100644 --- a/src/input/es_out_timeshift.c +++ b/src/input/es_out_timeshift.c @@ -618,6 +618,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args ) case ES_OUT_DEL_GROUP: case ES_OUT_SET_META: case ES_OUT_SET_ES: + case ES_OUT_UNSET_ES: case ES_OUT_RESTART_ES: case ES_OUT_SET_ES_DEFAULT: case ES_OUT_SET_ES_STATE: @@ -1447,6 +1448,7 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co /* Modified control */ case ES_OUT_SET_ES: /* arg1= es_out_id_t* */ + case ES_OUT_UNSET_ES: /* arg1= es_out_id_t* */ case ES_OUT_RESTART_ES: /* arg1= es_out_id_t* */ case ES_OUT_SET_ES_DEFAULT: /* arg1= es_out_id_t* */ p_cmd->u.control.u.p_es = (es_out_id_t*)va_arg( args, es_out_id_t * ); @@ -1558,6 +1560,7 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd ) /* Modified control */ case ES_OUT_SET_ES: /* arg1= es_out_id_t* */ + case ES_OUT_UNSET_ES: /* arg1= es_out_id_t* */ case ES_OUT_RESTART_ES: /* arg1= es_out_id_t* */ case ES_OUT_SET_ES_DEFAULT: /* arg1= es_out_id_t* */ return es_out_Control( p_out, i_query, !p_cmd->u.control.u.p_es ? NULL : -- 2.11.4.GIT