[vlc-devel] [PATCH 3/7] directory: simplify by providing pf_readdir
RĂ©mi Denis-Courmont
remi at remlab.net
Sun Sep 27 12:36:04 CEST 2020
This trivial module is still necessary to handle directory access
modules.
---
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;
}
--
2.28.0
More information about the vlc-devel
mailing list