[vlc-commits] demux: pass PIDs table rather than vlc_list_t
Rémi Denis-Courmont
git at videolan.org
Sun Jun 10 12:10:49 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 9 12:46:47 2018 +0300| [6da812e76df8e030cb871ca5b03788e3506b0c0e] | committer: Rémi Denis-Courmont
demux: pass PIDs table rather than vlc_list_t
(in DEMUX_SET_GROUP_LIST)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6da812e76df8e030cb871ca5b03788e3506b0c0e
---
include/vlc_demux.h | 2 +-
modules/demux/mpeg/ts.c | 7 ++++---
src/input/input.c | 29 +++++++++++------------------
3 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 474c330d83..bfbd383f64 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -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). */
DEMUX_SET_GROUP_DEFAULT,
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 */
/* Ask the demux to demux until the given date at the next pf_demux call
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 44d897b259..e7beaa32d3 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1085,15 +1085,16 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
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" );
/* 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 );
+ for( size_t i = 0; i < count; i++ )
+ ARRAY_APPEND( p_sys->programs, pids[i] );
UpdatePESFilters( p_demux, false );
p_sys->b_default_selection = false;
diff --git a/src/input/input.c b/src/input/input.c
index d697f9df34..80fcea5d3d 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1219,7 +1219,8 @@ static void UpdatePtsDelay( input_thread_t *p_input )
static void InitPrograms( input_thread_t * p_input )
{
int i_es_out_mode;
- vlc_list_t list;
+ int *tab;
+ size_t count;
/* Compute correct pts_delay */
UpdatePtsDelay( p_input );
@@ -1234,16 +1235,15 @@ static void InitPrograms( input_thread_t * p_input )
{
char *buf;
- TAB_INIT( list.i_count, list.p_values );
+ TAB_INIT(count, tab);
for( const char *prgm = strtok_r( prgms, ",", &buf );
prgm != NULL;
prgm = strtok_r( NULL, ",", &buf ) )
{
- vlc_value_t val = { .i_int = atoi( prgm ) };
- TAB_APPEND(list.i_count, list.p_values, val);
+ TAB_APPEND(count, tab, atoi(prgm));
}
- if( list.i_count > 0 )
+ if( count > 0 )
i_es_out_mode = ES_OUT_MODE_PARTIAL;
/* Note : we should remove the "program" callback. */
@@ -1265,8 +1265,8 @@ static void InitPrograms( input_thread_t * p_input )
else if( i_es_out_mode == ES_OUT_MODE_PARTIAL )
{
demux_Control( input_priv(p_input)->master->p_demux,
- DEMUX_SET_GROUP_LIST, &list );
- TAB_CLEAN( list.i_count, list.p_values );
+ DEMUX_SET_GROUP_LIST, count, tab );
+ free(tab);
}
else
{
@@ -1275,13 +1275,9 @@ static void InitPrograms( input_thread_t * p_input )
demux_Control( input_priv(p_input)->master->p_demux,
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_LIST, &list );
- }
+ DEMUX_SET_GROUP_LIST, (size_t)1,
+ (const int *)&program );
}
}
@@ -2030,12 +2026,9 @@ static bool Control( input_thread_t *p_input,
demux_Control( input_priv(p_input)->master->p_demux,
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_LIST, &list );
- }
+ DEMUX_SET_GROUP_LIST,
+ (size_t)1, &(const int){ val.i_int });
break;
case INPUT_CONTROL_SET_ES:
More information about the vlc-commits
mailing list