Commit 80f8e8ab authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

demux: split DEMUX_SET_GROUP_DEFAULT from DEMUX_SET_GROUP

This adds a separate control for (re)setting selection to the default
program. This removes the semi-useless first variable argument to
DEMUX_SET_GROUP.
parent 67a25bad
......@@ -191,11 +191,12 @@ enum demux_query_e
* arg4= int *pi_seekpoint_offset(0) */
DEMUX_GET_TITLE_INFO,
/* DEMUX_SET_GROUP/SET_ES only a hint for demuxer (mainly DVB) to allow not
* reading everything (you should not use this to call es_out_Control)
* if you don't know what to do with it, just IGNORE it, it is safe(r)
* -1 means all group, 0 default group (first es added) */
DEMUX_SET_GROUP, /* arg1= int, arg2=const vlc_list_t * can fail */
/* DEMUX_SET_GROUP* / DEMUX_SET_ES is only a hint for demuxer (mainly DVB)
* to avoid parsing everything (you should not use this to call
* es_out_Control()).
* If you don't know what to do with it, just IGNORE it: it is safe(r). */
DEMUX_SET_GROUP, /* arg1=const vlc_list_t * can fail */
DEMUX_SET_GROUP_DEFAULT,
DEMUX_SET_ES, /* arg1= int can fail */
/* Ask the demux to demux until the given date at the next pf_demux call
......
......@@ -2049,6 +2049,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
case DEMUX_CAN_RECORD:
case DEMUX_GET_FPS:
case DEMUX_SET_GROUP:
case DEMUX_SET_GROUP_DEFAULT:
case DEMUX_HAS_UNSUPPORTED_META:
default:
return VLC_EGENERIC;
......
......@@ -2193,6 +2193,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
case DEMUX_SET_NEXT_DEMUX_TIME:
case DEMUX_SET_GROUP:
case DEMUX_SET_GROUP_DEFAULT:
case DEMUX_HAS_UNSUPPORTED_META:
case DEMUX_CAN_RECORD:
return VLC_EGENERIC;
......
......@@ -1062,41 +1062,41 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
vlc_list_t *p_list;
i_int = va_arg( args, int );
p_list = va_arg( args, vlc_list_t * );
msg_Dbg( p_demux, "DEMUX_SET_GROUP %d %p", i_int, (void *)p_list );
msg_Dbg( p_demux, "DEMUX_SET_GROUP %p", (void *)p_list );
/* Deselect/filter current ones */
ARRAY_RESET( p_sys->programs );
if( i_int != 0 ) /* If not default program */
if( likely(p_list != NULL) )
{
/* Deselect/filter current ones */
ARRAY_RESET( p_sys->programs );
p_sys->seltype = PROGRAM_LIST;
for( int i = 0; i < p_list->i_count; i++ )
ARRAY_APPEND( p_sys->programs, p_list->p_values[i].i_int );
UpdatePESFilters( p_demux, false );
}
else // All ES Mode
{
p_pat = GetPID(p_sys, 0)->u.p_pat;
for( int i = 0; i < p_pat->programs.i_size; i++ )
ARRAY_APPEND( p_sys->programs, p_pat->programs.p_elems[i]->i_pid );
p_sys->seltype = PROGRAM_ALL;
UpdatePESFilters( p_demux, true );
}
if( likely(p_list != NULL) )
{
p_sys->seltype = PROGRAM_LIST;
for( int i = 0; i < p_list->i_count; i++ )
ARRAY_APPEND( p_sys->programs, p_list->p_values[i].i_int );
UpdatePESFilters( p_demux, false );
}
else // All ES Mode
{
p_pat = GetPID(p_sys, 0)->u.p_pat;
for( int i = 0; i < p_pat->programs.i_size; i++ )
ARRAY_APPEND( p_sys->programs, p_pat->programs.p_elems[i]->i_pid );
p_sys->seltype = PROGRAM_ALL;
UpdatePESFilters( p_demux, true );
}
p_sys->b_default_selection = false;
return VLC_SUCCESS;
}
p_sys->b_default_selection = false;
}
else if( !p_sys->b_default_selection )
case DEMUX_SET_GROUP_DEFAULT:
msg_Dbg( p_demux, "DEMUX_SET_GROUP_%s", "DEFAULT" );
if( !p_sys->b_default_selection )
{
ARRAY_RESET( p_sys->programs );
p_sys->seltype = PROGRAM_AUTO_DEFAULT;
}
return VLC_SUCCESS;
}
case DEMUX_SET_ES:
{
......
......@@ -373,6 +373,7 @@ int demux_vaControlHelper( stream_t *s,
case DEMUX_SET_NEXT_DEMUX_TIME:
case DEMUX_GET_TITLE_INFO:
case DEMUX_SET_GROUP:
case DEMUX_SET_GROUP_DEFAULT:
case DEMUX_SET_ES:
case DEMUX_GET_ATTACHMENTS:
case DEMUX_CAN_RECORD:
......
......@@ -63,7 +63,7 @@ static void *vlc_demux_chained_Thread(void *data)
/* Stream FIFO cannot apply DVB filters.
* Get all programs and let the E/S output sort them out. */
demux_Control(demux, DEMUX_SET_GROUP, -1, NULL);
demux_Control(demux, DEMUX_SET_GROUP, NULL);
/* Main loop */
mtime_t next_update = 0;
......
......@@ -1259,11 +1259,11 @@ static void InitPrograms( input_thread_t * p_input )
/* Inform the demuxer about waited group (needed only for DVB) */
if( i_es_out_mode == ES_OUT_MODE_ALL )
{
demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_GROUP, -1, NULL );
demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_GROUP, NULL );
}
else if( i_es_out_mode == ES_OUT_MODE_PARTIAL )
{
demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_GROUP, -1,
demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_GROUP,
&list );
TAB_CLEAN( list.i_count, list.p_values );
}
......@@ -1272,14 +1272,14 @@ static void InitPrograms( input_thread_t * p_input )
int program = es_out_GetGroupForced( input_priv(p_input)->p_es_out );
if( program == 0 )
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP, 0, NULL );
DEMUX_SET_GROUP_DEFAULT );
else
{
vlc_value_t val = { .i_int = program };
list.i_count = 1, list.p_values = &val;
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP, -1, &list );
DEMUX_SET_GROUP, &list );
}
}
}
......@@ -2027,13 +2027,13 @@ static bool Control( input_thread_t *p_input,
if( val.i_int == 0 )
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP, 0, NULL );
DEMUX_SET_GROUP_DEFAULT );
else
{
vlc_list_t list = { .i_count = 1, list.p_values = &val };
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP, -1, &list );
DEMUX_SET_GROUP, &list );
}
break;
......
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