[vlc-commits] demux: split DEMUX_SET_GROUP in ALL and LIST

Rémi Denis-Courmont git at videolan.org
Sun Jun 10 12:10:48 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  9 11:51:59 2018 +0300| [6f4256146a57d30383f33bfa3f6a5a2fd572fcb6] | committer: Rémi Denis-Courmont

demux: split DEMUX_SET_GROUP in ALL and LIST

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f4256146a57d30383f33bfa3f6a5a2fd572fcb6
---

 include/vlc_demux.h       |  5 ++--
 modules/access/bluray.c   |  3 ++-
 modules/demux/mp4/mp4.c   |  3 ++-
 modules/demux/mpeg/ts.c   | 60 ++++++++++++++++++++++++-----------------------
 src/input/demux.c         |  3 ++-
 src/input/demux_chained.c |  2 +-
 src/input/input.c         | 11 +++++----
 7 files changed, 47 insertions(+), 40 deletions(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index caf47acbb4..474c330d83 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -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
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 8b3e16ab2b..43841689ee 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -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;
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 18dbf6721f..faefa1ce2d 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -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;
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index b4912c81ec..44d897b259 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -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:
     {
diff --git a/src/input/demux.c b/src/input/demux.c
index 4f65286add..f13eda7b5d 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -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:
diff --git a/src/input/demux_chained.c b/src/input/demux_chained.c
index a4749332e2..f91adf164b 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, NULL);
+    demux_Control(demux, DEMUX_SET_GROUP_ALL);
 
     /* Main loop */
     mtime_t next_update = 0;
diff --git a/src/input/input.c b/src/input/input.c
index e8a435a942..d697f9df34 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -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;
 



More information about the vlc-commits mailing list