[vlc-commits] demux: split DEMUX_SET_GROUP_DEFAULT from DEMUX_SET_GROUP
Rémi Denis-Courmont
git at videolan.org
Sun Jun 10 12:10:47 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 9 12:31:44 2018 +0300| [80f8e8ab0a8c6807c07cc8ae9a1a021305941f00] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=80f8e8ab0a8c6807c07cc8ae9a1a021305941f00
---
include/vlc_demux.h | 11 ++++++-----
modules/access/bluray.c | 1 +
modules/demux/mp4/mp4.c | 1 +
modules/demux/mpeg/ts.c | 50 +++++++++++++++++++++++------------------------
src/input/demux.c | 1 +
src/input/demux_chained.c | 2 +-
src/input/input.c | 12 ++++++------
7 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 3888ac57ce..caf47acbb4 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -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
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index bfc14fa7c6..8b3e16ab2b 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -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;
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index e3786e5124..18dbf6721f 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -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;
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 54e456a2ae..b4912c81ec 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -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:
{
diff --git a/src/input/demux.c b/src/input/demux.c
index 8d3d33c02e..4f65286add 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -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:
diff --git a/src/input/demux_chained.c b/src/input/demux_chained.c
index 1c1e539329..a4749332e2 100644
--- a/src/input/demux_chained.c
+++ b/src/input/demux_chained.c
@@ -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;
diff --git a/src/input/input.c b/src/input/input.c
index 4d49ba21ec..e8a435a942 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -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;
More information about the vlc-commits
mailing list