[vlc-devel] [RFC PATCH 5/7] demux: add DEMUX_CAN_HAVE_SUB_ITEMS

Thomas Guillem thomas at gllm.fr
Wed Jan 7 12:06:40 CET 2015


---
 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..179996b 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_CAN_HAVE_SUB_ITEMS returns true if the demux can have sub items
+     * (ie. if it is a playlist, an archive, a directory or a network share) */
+    DEMUX_CAN_HAVE_SUB_ITEMS,  /* 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..435a938 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_CAN_HAVE_SUB_ITEMS:
+        {
+            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..76dcfd0 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_CAN_HAVE_SUB_ITEMS:
+            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