1 /*****************************************************************************
2 * directory.c : Use access readdir to output folder content to playlist
3 *****************************************************************************
4 * Copyright (C) 2014 VLC authors and VideoLAN
6 * Authors: Julien 'Lta' BALLET <contact # lta . io >
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
27 #include <vlc_common.h>
28 #include <vlc_demux.h>
29 #include <vlc_input_item.h>
30 #include <vlc_plugin.h>
32 static int ReadDir(demux_t
*demux
, input_item_node_t
*node
)
34 return vlc_stream_ReadDir(demux
->s
, node
);
37 static int Control(demux_t
*demux
, int query
, va_list args
)
44 return vlc_stream_vaControl(demux
->s
, query
, args
);
46 case DEMUX_HAS_UNSUPPORTED_META
:
48 *(va_arg( args
, bool * )) = false;
55 static int Import_Dir( vlc_object_t
*p_this
)
57 demux_t
*p_demux
= (demux_t
*)p_this
;
59 if( p_demux
->s
->pf_readdir
== NULL
)
61 if( p_demux
->p_input_item
== NULL
)
64 p_demux
->pf_readdir
= ReadDir
;
65 p_demux
->pf_control
= Control
;
66 assert(p_demux
->pf_demux
== NULL
);
72 set_category( CAT_INPUT
)
73 set_subcategory( SUBCAT_INPUT_DEMUX
)
74 set_shortname( N_("Directory") )
75 set_description( N_("Directory import") )
76 add_shortcut( "directory" )
77 set_capability( "demux", 10 )
78 set_callback( Import_Dir
)