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

demux: pass PIDs table rather than vlc_list_t

(in DEMUX_SET_GROUP_LIST)
parent 6f425614
...@@ -197,7 +197,7 @@ enum demux_query_e ...@@ -197,7 +197,7 @@ enum demux_query_e
* If you don't know what to do with it, just IGNORE it: it is safe(r). */ * If you don't know what to do with it, just IGNORE it: it is safe(r). */
DEMUX_SET_GROUP_DEFAULT, DEMUX_SET_GROUP_DEFAULT,
DEMUX_SET_GROUP_ALL, DEMUX_SET_GROUP_ALL,
DEMUX_SET_GROUP_LIST, /* arg1= vlc_list_t *, can fail */ DEMUX_SET_GROUP_LIST, /* arg1= size_t, arg2= const int *, can fail */
DEMUX_SET_ES, /* arg1= int can fail */ DEMUX_SET_ES, /* arg1= int can fail */
/* Ask the demux to demux until the given date at the next pf_demux call /* Ask the demux to demux until the given date at the next pf_demux call
......
...@@ -1085,15 +1085,16 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1085,15 +1085,16 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_SET_GROUP_LIST: case DEMUX_SET_GROUP_LIST:
{ {
vlc_list_t *p_list = va_arg( args, vlc_list_t * ); size_t count = va_arg(args, size_t);
const int *pids = va_arg(args, const int *);
msg_Dbg( p_demux, "DEMUX_SET_GROUP_%s", "LIST" ); msg_Dbg( p_demux, "DEMUX_SET_GROUP_%s", "LIST" );
/* Deselect/filter current ones */ /* Deselect/filter current ones */
ARRAY_RESET( p_sys->programs ); ARRAY_RESET( p_sys->programs );
p_sys->seltype = PROGRAM_LIST; p_sys->seltype = PROGRAM_LIST;
for( int i = 0; i < p_list->i_count; i++ ) for( size_t i = 0; i < count; i++ )
ARRAY_APPEND( p_sys->programs, p_list->p_values[i].i_int ); ARRAY_APPEND( p_sys->programs, pids[i] );
UpdatePESFilters( p_demux, false ); UpdatePESFilters( p_demux, false );
p_sys->b_default_selection = false; p_sys->b_default_selection = false;
......
...@@ -1219,7 +1219,8 @@ static void UpdatePtsDelay( input_thread_t *p_input ) ...@@ -1219,7 +1219,8 @@ static void UpdatePtsDelay( input_thread_t *p_input )
static void InitPrograms( input_thread_t * p_input ) static void InitPrograms( input_thread_t * p_input )
{ {
int i_es_out_mode; int i_es_out_mode;
vlc_list_t list; int *tab;
size_t count;
/* Compute correct pts_delay */ /* Compute correct pts_delay */
UpdatePtsDelay( p_input ); UpdatePtsDelay( p_input );
...@@ -1234,16 +1235,15 @@ static void InitPrograms( input_thread_t * p_input ) ...@@ -1234,16 +1235,15 @@ static void InitPrograms( input_thread_t * p_input )
{ {
char *buf; char *buf;
TAB_INIT( list.i_count, list.p_values ); TAB_INIT(count, tab);
for( const char *prgm = strtok_r( prgms, ",", &buf ); for( const char *prgm = strtok_r( prgms, ",", &buf );
prgm != NULL; prgm != NULL;
prgm = strtok_r( NULL, ",", &buf ) ) prgm = strtok_r( NULL, ",", &buf ) )
{ {
vlc_value_t val = { .i_int = atoi( prgm ) }; TAB_APPEND(count, tab, atoi(prgm));
TAB_APPEND(list.i_count, list.p_values, val);
} }
if( list.i_count > 0 ) if( count > 0 )
i_es_out_mode = ES_OUT_MODE_PARTIAL; i_es_out_mode = ES_OUT_MODE_PARTIAL;
/* Note : we should remove the "program" callback. */ /* Note : we should remove the "program" callback. */
...@@ -1265,8 +1265,8 @@ static void InitPrograms( input_thread_t * p_input ) ...@@ -1265,8 +1265,8 @@ static void InitPrograms( input_thread_t * p_input )
else if( i_es_out_mode == ES_OUT_MODE_PARTIAL ) else if( i_es_out_mode == ES_OUT_MODE_PARTIAL )
{ {
demux_Control( input_priv(p_input)->master->p_demux, demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP_LIST, &list ); DEMUX_SET_GROUP_LIST, count, tab );
TAB_CLEAN( list.i_count, list.p_values ); free(tab);
} }
else else
{ {
...@@ -1275,13 +1275,9 @@ static void InitPrograms( input_thread_t * p_input ) ...@@ -1275,13 +1275,9 @@ static void InitPrograms( input_thread_t * p_input )
demux_Control( input_priv(p_input)->master->p_demux, demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP_DEFAULT ); DEMUX_SET_GROUP_DEFAULT );
else 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_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP_LIST, &list ); DEMUX_SET_GROUP_LIST, (size_t)1,
} (const int *)&program );
} }
} }
...@@ -2030,12 +2026,9 @@ static bool Control( input_thread_t *p_input, ...@@ -2030,12 +2026,9 @@ static bool Control( input_thread_t *p_input,
demux_Control( input_priv(p_input)->master->p_demux, demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP_DEFAULT ); DEMUX_SET_GROUP_DEFAULT );
else else
{
vlc_list_t list = { .i_count = 1, list.p_values = &val };
demux_Control( input_priv(p_input)->master->p_demux, demux_Control( input_priv(p_input)->master->p_demux,
DEMUX_SET_GROUP_LIST, &list ); DEMUX_SET_GROUP_LIST,
} (size_t)1, &(const int){ val.i_int });
break; break;
case INPUT_CONTROL_SET_ES: case INPUT_CONTROL_SET_ES:
......
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