[vlc-commits] directory: simplify by providing pf_readdir

Rémi Denis-Courmont git at videolan.org
Mon Sep 28 17:09:00 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 27 12:33:54 2020 +0300| [d74b52930fca10e8d08df68443238039c584eef9] | committer: Rémi Denis-Courmont

directory: simplify by providing pf_readdir

This trivial module is still necessary to handle directory access
modules.

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

 modules/demux/directory.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/modules/demux/directory.c b/modules/demux/directory.c
index 191825adc4..cc9ac61d46 100644
--- a/modules/demux/directory.c
+++ b/modules/demux/directory.c
@@ -29,33 +29,15 @@
 #include <vlc_input_item.h>
 #include <vlc_plugin.h>
 
-static int Demux( demux_t *p_demux )
+static int ReadDir(demux_t *demux, input_item_node_t *node)
 {
-    input_item_node_t *p_node = input_item_node_Create( p_demux->p_input_item );
-
-    if( vlc_stream_ReadDir( p_demux->s, p_node ) )
-    {
-        msg_Warn( p_demux, "unable to read directory" );
-        input_item_node_Delete( p_node );
-        return VLC_EGENERIC;
-    }
-
-    if (es_out_Control(p_demux->out, ES_OUT_POST_SUBNODE, p_node))
-        input_item_node_Delete(p_node);
-
-    return VLC_SUCCESS;
+    return vlc_stream_ReadDir(demux->s, node);
 }
 
 static int Control(demux_t *demux, int query, va_list args)
 {
     switch( query )
     {
-        case DEMUX_IS_PLAYLIST:
-        {
-            bool *pb_bool = va_arg( args, bool * );
-            *pb_bool = true;
-            return VLC_SUCCESS;
-        }
         case DEMUX_GET_META:
         case DEMUX_GET_TYPE:
         {
@@ -79,8 +61,9 @@ static int Import_Dir( vlc_object_t *p_this )
     if( p_demux->p_input_item == NULL )
         return VLC_ETIMEOUT;
 
-    p_demux->pf_demux = Demux;
+    p_demux->pf_readdir = ReadDir;
     p_demux->pf_control = Control;
+    assert(p_demux->pf_demux == NULL);
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list