[vlc-devel] [PATCH 1/8] access: refactor pf_readdir

Rémi Denis-Courmont remi at remlab.net
Thu May 7 13:31:03 CEST 2015


Le 2015-05-07 13:10, Thomas Guillem a écrit :
> It behaves more like the readdir_r() posix function.
>
> The main advantage is to move the management of the input_item_node_t
> from all
> accesses to the directory demux.
> ---
>  include/vlc_access.h                |   7 +-
>  include/vlc_stream.h                |   6 +-
>  modules/access/archive/stream.c     |   9 ++-
>  modules/access/directory.c          |  26 ++------
>  modules/access/dsm/access.c         | 127
> +++++++++++++++++-------------------
>  modules/access/fs.h                 |   2 +-
>  modules/access/ftp.c                |  28 ++++----
>  modules/access/sftp.c               |  30 ++++-----
>  modules/demux/playlist/directory.c  |  31 +++++++--
>  modules/services_discovery/upnp.cpp | 106 
> ++++++++++++++++++------------
>  modules/services_discovery/upnp.hpp |  16 +++--
>  src/input/stream.c                  |  17 +++--
>  src/input/stream_filter.c           |   4 +-
>  13 files changed, 224 insertions(+), 185 deletions(-)
>
> diff --git a/include/vlc_access.h b/include/vlc_access.h
> index 1f3cb03..ca107a6 100644
> --- a/include/vlc_access.h
> +++ b/include/vlc_access.h
> @@ -92,7 +92,12 @@ struct access_t
>       * XXX A access should set one and only one of them */
>      ssize_t     (*pf_read)   ( access_t *, uint8_t *, size_t );  /*
> Return -1 if no data yet, 0 if no more data, else real data read */
>      block_t    *(*pf_block)  ( access_t * );                     /*
> Return a block of data in his 'natural' size, NULL if not yet data or
> eof */
> -    int         (*pf_readdir)( access_t *, input_item_node_t * );/*
> Fills the provided item_node, see doc/browsing.txt for details */
> +
> +    /* pf_readdir: Read the next input_item_t from the stream. It
> returns 0 on
> +     * success and returns the next input item in *pp_item. On 
> error, it
> +     * returns a VLC error code and *pp_item is no touched. If the
> end of the
> +     * directory is reached, it returns 0, and returns NULL in 
> *pp_item */
> +    int         (*pf_readdir)( access_t *, input_item_t **pp_item );

IMHO, returning an item or NULL would be simpler. I think that's how 
the original proposal was, before recursion was added.

>
>      /* Called for each seek.
>       * XXX can be null */

-- 
Rémi Denis-Courmont
Remlab T:mi
http://www.remlab.net/



More information about the vlc-devel mailing list