[vlc-commits] access: extend STREAM_IS_DIRECTORY
Thomas Guillem
git at videolan.org
Wed May 20 16:10:25 CEST 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May 7 09:34:27 2015 +0200| [3840a03dbbf8a3f530fa16e0f029970881564716] | committer: Thomas Guillem
access: extend STREAM_IS_DIRECTORY
It now takes two new bool* arguments.
- specify if the access returns items that are already sorted.
- specify if directories can loop into themselves
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3840a03dbbf8a3f530fa16e0f029970881564716
---
include/vlc_access.h | 7 +++++++
include/vlc_stream.h | 2 +-
modules/access/archive/stream.c | 11 ++++++++++-
modules/demux/playlist/directory.c | 3 ++-
modules/demux/playlist/playlist.h | 2 +-
src/input/demux.c | 6 +++++-
src/input/stream.c | 6 ++++++
7 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/include/vlc_access.h b/include/vlc_access.h
index a23d3b1..a6a84cf 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -111,6 +111,13 @@ struct access_t
{
uint64_t i_pos; /* idem */
bool b_eof; /* idem */
+
+ bool b_dir_sorted; /* Set it to true if items returned by
+ * pf_readdir are already sorted. */
+
+ bool b_dir_can_loop; /* Set it to true if the access can't know
+ * if children can loop into their parents.
+ * It's the case for most network accesses. */
} info;
access_sys_t *p_sys;
diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index a9e8586..dda58ce 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -93,7 +93,7 @@ enum stream_query_e
STREAM_CAN_FASTSEEK, /**< arg1= bool * res=cannot fail*/
STREAM_CAN_PAUSE, /**< arg1= bool * res=cannot fail*/
STREAM_CAN_CONTROL_PACE, /**< arg1= bool * res=cannot fail*/
- STREAM_IS_DIRECTORY, /**< arg1= bool * res=cannot fail*/
+ STREAM_IS_DIRECTORY, /**< arg1= bool *, arg2= bool *, arg3=bool *, res=cannot fail*/
/* */
STREAM_SET_POSITION, /**< arg1= uint64_t res=can fail */
diff --git a/modules/access/archive/stream.c b/modules/access/archive/stream.c
index a74bf53..3b9887e 100644
--- a/modules/access/archive/stream.c
+++ b/modules/access/archive/stream.c
@@ -47,8 +47,17 @@ static int Control(stream_t *p_stream, int i_query, va_list args)
switch( i_query )
{
case STREAM_IS_DIRECTORY:
- *va_arg( args, bool* ) = true;
+ {
+ bool *pb_canreaddir = va_arg( args, bool * );
+ bool *pb_dirsorted = va_arg( args, bool * );
+ bool *pb_dircanloop = va_arg( args, bool * );
+ *pb_canreaddir = true;
+ if (pb_dirsorted)
+ *pb_dirsorted = false;
+ if (pb_dircanloop)
+ pb_dircanloop = false;
break;
+ }
case STREAM_CAN_SEEK:
case STREAM_CAN_FASTSEEK:
diff --git a/modules/demux/playlist/directory.c b/modules/demux/playlist/directory.c
index f614307..30b2bfa 100644
--- a/modules/demux/playlist/directory.c
+++ b/modules/demux/playlist/directory.c
@@ -44,7 +44,8 @@ int Import_Dir ( vlc_object_t *p_this)
demux_t *p_demux = (demux_t *)p_this;
bool b_is_dir = false;
- int i_err = stream_Control( p_demux->s, STREAM_IS_DIRECTORY, &b_is_dir );
+ int i_err = stream_Control( p_demux->s, STREAM_IS_DIRECTORY, &b_is_dir,
+ NULL, NULL );
if ( !( i_err == VLC_SUCCESS && b_is_dir ) )
return VLC_EGENERIC;
diff --git a/modules/demux/playlist/playlist.h b/modules/demux/playlist/playlist.h
index ea6ef4b..eb3a583 100644
--- a/modules/demux/playlist/playlist.h
+++ b/modules/demux/playlist/playlist.h
@@ -84,7 +84,7 @@ bool CheckContentType( stream_t * p_stream, const char * psz_ctype );
#define CHECK_FILE() do { \
bool b_is_dir = false; \
- stream_Control( ((demux_t *)p_this)->s, STREAM_IS_DIRECTORY, &b_is_dir ); \
+ stream_Control( ((demux_t *)p_this)->s, STREAM_IS_DIRECTORY, &b_is_dir, NULL, NULL ); \
if( b_is_dir ) \
return VLC_EGENERIC; \
} while(0)
diff --git a/src/input/demux.c b/src/input/demux.c
index dcc6b16..ff5c1ba 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -309,7 +309,11 @@ int demux_vaControlHelper( stream_t *s,
return stream_vaControl( s, STREAM_GET_META, args );
case DEMUX_IS_PLAYLIST:
- return stream_vaControl(s, STREAM_IS_DIRECTORY, args );
+ {
+ bool *pb_isplaylist = va_arg( args, bool * );
+ return stream_Control( s, STREAM_IS_DIRECTORY, pb_isplaylist,
+ NULL, NULL );
+ }
case DEMUX_GET_PTS_DELAY:
case DEMUX_GET_FPS:
diff --git a/src/input/stream.c b/src/input/stream.c
index e220742..b74a05c 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -644,7 +644,13 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
case STREAM_IS_DIRECTORY:
{
bool *pb_canreaddir = va_arg( args, bool * );
+ bool *pb_dirsorted = va_arg( args, bool * );
+ bool *pb_dircanloop = va_arg( args, bool * );
*pb_canreaddir = p_sys->method == STREAM_METHOD_READDIR;
+ if( pb_dirsorted )
+ *pb_dirsorted = p_access->info.b_dir_sorted;
+ if( pb_dircanloop )
+ *pb_dircanloop = p_access->info.b_dir_can_loop;
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list