[vlc-devel] [PATCH 1/7] demux: add DEMUX_IS_PLAYLIST

Thomas Guillem thomas at gllm.fr
Thu Jan 15 16:24:35 CET 2015


It returns true if the demux is a playlist (an archive, a directory or a
network share is also a playlist).

It will be used by the preparser in order to know if it should call demux_Demux
to fetch sub items.
---
 include/vlc_demux.h               |  4 ++++
 modules/demux/playlist/playlist.c | 11 ++++++++++-
 src/input/demux.c                 |  3 +++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 19f4d09..93197ad 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -173,6 +173,10 @@ enum demux_query_e
 
     DEMUX_CAN_SEEK,            /* arg1= bool*    can fail (assume false)*/
 
+    /* DEMUX_IS_PLAYLIST returns true if the demux is a playlist
+     * (an archive, a directory or a network share is also a playlist) */
+    DEMUX_IS_PLAYLIST,  /* arg1= bool*    can fail (assume false)*/
+
     /* Navigation */
     DEMUX_NAV_ACTIVATE,        /* res=can fail */
     DEMUX_NAV_UP,              /* res=can fail */
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index 0d0e794..4b25dd3 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -154,7 +154,16 @@ vlc_module_end ()
 
 int Control(demux_t *demux, int query, va_list args)
 {
-    (void) demux; (void) query; (void) args;
+    (void) demux;
+    switch( query )
+    {
+        case DEMUX_IS_PLAYLIST:
+        {
+            bool *pb_bool = (bool*)va_arg( args, bool * );
+            *pb_bool = true;
+            return VLC_SUCCESS;
+        }
+    }
     return VLC_EGENERIC;
 }
 
diff --git a/src/input/demux.c b/src/input/demux.c
index a0095ab..dcc6b16 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -308,6 +308,9 @@ int demux_vaControlHelper( stream_t *s,
         case DEMUX_GET_META:
             return stream_vaControl( s, STREAM_GET_META, args );
 
+        case DEMUX_IS_PLAYLIST:
+            return stream_vaControl(s, STREAM_IS_DIRECTORY, args );
+
         case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_HAS_UNSUPPORTED_META:
-- 
2.1.3




More information about the vlc-devel mailing list