Commit 6f425614 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

demux: split DEMUX_SET_GROUP in ALL and LIST

parent 80f8e8ab
......@@ -191,12 +191,13 @@ enum demux_query_e
* arg4= int *pi_seekpoint_offset(0) */
DEMUX_GET_TITLE_INFO,
/* DEMUX_SET_GROUP* / DEMUX_SET_ES is only a hint for demuxer (mainly DVB)
/* 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_GROUP_ALL,
DEMUX_SET_GROUP_LIST, /* arg1= vlc_list_t *, can fail */
DEMUX_SET_ES, /* arg1= int can fail */
/* Ask the demux to demux until the given date at the next pf_demux call
......
......@@ -2048,8 +2048,9 @@ 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_SET_GROUP_ALL:
case DEMUX_SET_GROUP_LIST:
case DEMUX_HAS_UNSUPPORTED_META:
default:
return VLC_EGENERIC;
......
......@@ -2192,8 +2192,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
}
case DEMUX_SET_NEXT_DEMUX_TIME:
case DEMUX_SET_GROUP:
case DEMUX_SET_GROUP_DEFAULT:
case DEMUX_SET_GROUP_ALL:
case DEMUX_SET_GROUP_LIST:
case DEMUX_HAS_UNSUPPORTED_META:
case DEMUX_CAN_RECORD:
return VLC_EGENERIC;
......
......@@ -1058,45 +1058,47 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
break;
case DEMUX_SET_GROUP:
{
vlc_list_t *p_list;
p_list = va_arg( args, vlc_list_t * );
msg_Dbg( p_demux, "DEMUX_SET_GROUP %p", (void *)p_list );
/* Deselect/filter current ones */
ARRAY_RESET( p_sys->programs );
case DEMUX_SET_GROUP_DEFAULT:
msg_Dbg( p_demux, "DEMUX_SET_GROUP_%s", "DEFAULT" );
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
if( !p_sys->b_default_selection )
{
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 );
ARRAY_RESET( p_sys->programs );
p_sys->seltype = PROGRAM_AUTO_DEFAULT;
}
return VLC_SUCCESS;
case DEMUX_SET_GROUP_ALL: // All ES Mode
{
msg_Dbg( p_demux, "DEMUX_SET_GROUP_%s", "ALL" );
ARRAY_RESET( p_sys->programs );
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;
}
case DEMUX_SET_GROUP_DEFAULT:
msg_Dbg( p_demux, "DEMUX_SET_GROUP_%s", "DEFAULT" );
case DEMUX_SET_GROUP_LIST:
{
vlc_list_t *p_list = va_arg( args, vlc_list_t * );
if( !p_sys->b_default_selection )
{
ARRAY_RESET( p_sys->programs );
p_sys->seltype = PROGRAM_AUTO_DEFAULT;
}
msg_Dbg( p_demux, "DEMUX_SET_GROUP_%s", "LIST" );
/* 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 );
p_sys->b_default_selection = false;
return VLC_SUCCESS;
}
case DEMUX_SET_ES:
{
......
......@@ -372,8 +372,9 @@ int demux_vaControlHelper( stream_t *s,
case DEMUX_HAS_UNSUPPORTED_META:
case DEMUX_SET_NEXT_DEMUX_TIME:
case DEMUX_GET_TITLE_INFO:
case DEMUX_SET_GROUP:
case DEMUX_SET_GROUP_DEFAULT:
case DEMUX_SET_GROUP_ALL:
case DEMUX_SET_GROUP_LIST:
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, NULL);
demux_Control(demux, DEMUX_SET_GROUP_ALL);
/* Main loop */
mtime_t next_update = 0;
......
......@@ -1259,12 +1259,13 @@ 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, NULL );
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP_ALL );
}
else if( i_es_out_mode == ES_OUT_MODE_PARTIAL )
{
demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_GROUP,
&list );
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP_LIST, &list );
TAB_CLEAN( list.i_count, list.p_values );
}
else
......@@ -1279,7 +1280,7 @@ static void InitPrograms( input_thread_t * p_input )
list.i_count = 1, list.p_values = &val;
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP, &list );
DEMUX_SET_GROUP_LIST, &list );
}
}
}
......@@ -2033,7 +2034,7 @@ static bool Control( input_thread_t *p_input,
vlc_list_t list = { .i_count = 1, list.p_values = &val };
demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP, &list );
DEMUX_SET_GROUP_LIST, &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