[vlc-devel] [PATCH 01/10] Add pf_readdir callback to acces_t

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


Document the error case and don't break the build (for git bisect), please. Otherwise seems fine.

-- 
Rémi Denis-Courmont
Sent from my NVIDIA Tegra-powered device

----- Reply message -----
De : "Julien 'Lta' BALLET" <elthariel at gmail.com>
Pour : <vlc-devel at videolan.org>
Cc : "Julien 'Lta' BALLET" <contact at lta.io>
Objet : [vlc-devel] [PATCH 01/10] Add pf_readdir callback to acces_t
Date : lun., juin 16, 2014 15:41

From: Julien 'Lta' BALLET <contact at lta.io>

---
include/vlc_access.h | 20 +++++++++++---------
src/input/access.c   |  1 +
2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/include/vlc_access.h b/include/vlc_access.h
index 8a8f1fa..d7df927 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -88,10 +88,11 @@ struct access_t
* (if you fail, this value won't be reseted */
char        *psz_demux;

-    /* pf_read/pf_block is used to read data.
+    /* pf_read/pf_block/pf_readdir is used to read data.
* 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 */
+    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 */
+    input_item_t *(*pf_readdir)( access_t * );                   /* Return an input_item_t */

/* Called for each seek.
* XXX can be null */
@@ -150,18 +151,19 @@ static inline void access_InitFields( access_t *p_a )
*/
VLC_API input_thread_t * access_GetParentInput( access_t *p_access ) VLC_USED;

-#define ACCESS_SET_CALLBACKS( read, block, control, seek ) \
+#define ACCESS_SET_CALLBACKS( read, block, readdir, control, seek ) \
do { \
-        p_access->pf_read = (read); \
-        p_access->pf_block = (block); \
+        p_access->pf_read    = (read); \
+        p_access->pf_block   = (block); \
+        p_access->pf_readdir = (readdir); \
p_access->pf_control = (control); \
-        p_access->pf_seek = (seek); \
+        p_access->pf_seek    = (seek); \
} while(0)

#define STANDARD_READ_ACCESS_INIT \
do { \
access_InitFields( p_access ); \
-        ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \
+        ACCESS_SET_CALLBACKS( Read, NULL, NULL, Control, Seek ); \
p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) ); \
if( !p_sys ) return VLC_ENOMEM;\
} while(0);
@@ -169,7 +171,7 @@ VLC_API input_thread_t * access_GetParentInput( access_t *p_access ) VLC_USED;
#define STANDARD_BLOCK_ACCESS_INIT \
do { \
access_InitFields( p_access ); \
-        ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek ); \
+        ACCESS_SET_CALLBACKS( NULL, Block, NULL, Control, Seek ); \
p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) ); \
if( !p_sys ) return VLC_ENOMEM; \
} while(0);
diff --git a/src/input/access.c b/src/input/access.c
index 850fccd..a9b2804 100644
--- a/src/input/access.c
+++ b/src/input/access.c
@@ -78,6 +78,7 @@ access_t *access_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,

p_access->pf_read    = NULL;
p_access->pf_block   = NULL;
+    p_access->pf_readdir = NULL;
p_access->pf_seek    = NULL;
p_access->pf_control = NULL;
p_access->p_sys      = NULL;
-- 
1.9.3

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20140616/85241e6a/attachment.html>


More information about the vlc-devel mailing list