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

input: Allow demux_filter to be enabled/disabled

refs #18605
parent 53c06cf4
......@@ -323,6 +323,13 @@ enum demux_query_e
DEMUX_NAV_POPUP,
/** Activate disc Root Menu. Can fail */
DEMUX_NAV_MENU, /* res=can fail */
/** Enable/Disable a demux filter
* \warning This has limited support, and is likely to break if more than
* a single demux_filter is present in the chain. This is not guaranteed to
* work in future VLC versions, nor with all demux filters
*/
DEMUX_FILTER_ENABLE,
DEMUX_FILTER_DISABLE
};
/*************************************************************************
......
......@@ -487,6 +487,8 @@ int demux_vaControlHelper( stream_t *s,
case DEMUX_NAV_RIGHT:
case DEMUX_NAV_POPUP:
case DEMUX_NAV_MENU:
case DEMUX_FILTER_ENABLE:
case DEMUX_FILTER_DISABLE:
return VLC_EGENERIC;
case DEMUX_SET_TITLE:
......@@ -629,3 +631,31 @@ demux_t *demux_FilterChainNew( demux_t *p_demux, const char *psz_chain )
return p_demux;
}
static bool demux_filter_enable_disable( demux_t *p_demux_chain,
const char* psz_demux, bool b_enable )
{
demux_t *p_demux = p_demux_chain;
while ( p_demux )
{
if( strcmp( module_get_name( p_demux->p_module, false ), psz_demux) == 0 ||
strcmp( module_get_name( p_demux->p_module, true ), psz_demux ) == 0 )
{
demux_Control( p_demux,
b_enable ? DEMUX_FILTER_ENABLE : DEMUX_FILTER_DISABLE );
return true;
}
p_demux = p_demux->p_next;
}
return false;
}
bool demux_FilterEnable( demux_t *p_demux_chain, const char* psz_demux )
{
return demux_filter_enable_disable( p_demux_chain, psz_demux, true );
}
bool demux_FilterDisable( demux_t *p_demux_chain, const char* psz_demux )
{
return demux_filter_enable_disable( p_demux_chain, psz_demux, false );
}
......@@ -41,5 +41,7 @@ int demux_GetTitle( demux_t * );
int demux_GetSeekpoint( demux_t * );
demux_t *demux_FilterChainNew( demux_t *p_demux, const char *psz_name );
bool demux_FilterEnable( demux_t *p_demux_chain, const char* psz_demux );
bool demux_FilterDisable( demux_t *p_demux_chain, const char* psz_demux );
#endif
......@@ -1871,6 +1871,16 @@ static void ControlUpdateSout( input_thread_t *p_input, const char* psz_chain )
es_out_Control( input_priv(p_input)->p_es_out, ES_OUT_RESTART_ALL_ES );
}
static void ControlInsertDemuxFilter( input_thread_t* p_input, const char* psz_demux_chain )
{
input_source_t *p_inputSource = input_priv(p_input)->master;
demux_t *p_filtered_demux = demux_FilterChainNew( p_inputSource->p_demux, psz_demux_chain );
if ( p_filtered_demux != NULL )
p_inputSource->p_demux = p_filtered_demux;
else if ( psz_demux_chain != NULL )
msg_Dbg(p_input, "Failed to create demux filter %s", psz_demux_chain);
}
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