[vlc-devel] [PATCH 09/10] Add new directory 'playlist' module whose job is to feed the playlist with the content of pf_readdir enabled access

Rémi Denis-Courmont remi at remlab.net
Mon Jun 16 16:44:06 CEST 2014


Le 2014-06-16 20:41, Julien 'Lta' BALLET a écrit :
> From: Julien 'Lta' BALLET <contact at lta.io>
>
> ---
>  modules/demux/playlist/directory.c | 85
> ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 85 insertions(+)
>  create mode 100644 modules/demux/playlist/directory.c
>
> diff --git a/modules/demux/playlist/directory.c
> b/modules/demux/playlist/directory.c
> new file mode 100644
> index 0000000..e229b4e
> --- /dev/null
> +++ b/modules/demux/playlist/directory.c
> @@ -0,0 +1,85 @@
> 
> +/*****************************************************************************
> + * directory.c : Use access readdir to output folder content to 
> playlist
> +
> 
> *****************************************************************************
> + * Copyright (C) 2014 VLC authors and VideoLAN
> + * $Id$
> + *
> + * Authors: Julien 'Lta' BALLET <contact # lta . io >
> + *
> + * This program is free software; you can redistribute it and/or 
> modify it
> + * under the terms of the GNU Lesser General Public License as 
> published by
> + * the Free Software Foundation; either version 2.1 of the License, 
> or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public 
> License
> + * along with this program; if not, write to the Free Software 
> Foundation,
> + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> +
> 
> *****************************************************************************/
> +
> 
> +/*****************************************************************************
> + * Preamble
> +
> 
> *****************************************************************************/
> +#ifdef HAVE_CONFIG_H
> +# include "config.h"
> +#endif
> +
> +#include <vlc_common.h>
> +#include <vlc_demux.h>
> +
> +#include "playlist.h"
> +
> +struct demux_sys_t
> +{
> +    char *psz_prefix;
> +};

What for?

> +
> 
> +/*****************************************************************************
> + * Local prototypes
> +
> 
> *****************************************************************************/
> +static int Demux( demux_t *p_demux );
> +
> +
> +int Import_Dir ( vlc_object_t *p_this)
> +{
> +    demux_t  *p_demux = (demux_t *)p_this;
> +
> +    bool b_is_dir = false;
> +    stream_Control( p_demux->s, STREAM_IS_DIRECTORY, &b_is_dir );

In principles, b_is_dir is undefined on error, so slightly flawed 
logic.

> +
> +    if ( !b_is_dir )
> +        return VLC_EGENERIC;
> +
> +    STANDARD_DEMUX_INIT_MSG( "reading directory content" );
> +
> +    return VLC_SUCCESS;
> +}
> +
> +void Close_Dir ( vlc_object_t *p_this)
> +{
> +
> +}

No compiler warnings?

> +
> +static int Demux( demux_t *p_demux )
> +{
> +    input_item_t *p_input;
> +    input_item_t *p_current_input = GetCurrentItem(p_demux);
> +    input_item_node_t *p_subitems = input_item_node_Create(
> p_current_input );
> +
> +    while( ( p_input = stream_ReadDir(p_demux->s) ) != NULL )
> +    {
> +        msg_Warn(p_demux, "FOUND ITEM: %s", p_input->psz_name);

...

> +
> +        input_item_node_AppendItem( p_subitems, p_input );
> +        input_item_Release( p_input );
> +    }
> +
> +    input_item_node_PostAndDelete( p_subitems );
> +    input_item_Release(p_current_input);
> +
> +    return VLC_SUCCESS;
> +}

-- 
Rémi Denis-Courmont



More information about the vlc-devel mailing list