[vlc-devel] [PATCH 2/8] access: extend STREAM_IS_DIRECTORY
Thomas Guillem
thomas at gllm.fr
Thu May 7 12:10:26 CEST 2015
It now takes a second bool* argument that specify if the access returns items
that are already sorted.
---
include/vlc_access.h | 3 +++
include/vlc_stream.h | 2 +-
modules/access/archive/stream.c | 1 +
modules/demux/playlist/directory.c | 2 +-
src/input/demux.c | 6 +++++-
src/input/stream.c | 3 +++
6 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/vlc_access.h b/include/vlc_access.h
index ca107a6..5017501 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -112,6 +112,9 @@ 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 */
} info;
access_sys_t *p_sys;
diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index 84cedb3..d1fefd1 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 * 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 974c1f1..94e2ac8 100644
--- a/modules/access/archive/stream.c
+++ b/modules/access/archive/stream.c
@@ -48,6 +48,7 @@ static int Control(stream_t *p_stream, int i_query, va_list args)
{
case STREAM_IS_DIRECTORY:
*va_arg( args, bool* ) = true;
+ *va_arg( args, bool* ) = false;
break;
case STREAM_CAN_SEEK:
diff --git a/modules/demux/playlist/directory.c b/modules/demux/playlist/directory.c
index 932349a..654f57f 100644
--- a/modules/demux/playlist/directory.c
+++ b/modules/demux/playlist/directory.c
@@ -44,7 +44,7 @@ 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 );
if ( !( i_err == VLC_SUCCESS && b_is_dir ) )
return VLC_EGENERIC;
diff --git a/src/input/demux.c b/src/input/demux.c
index dcc6b16..bc3fa5c 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 );
+ }
case DEMUX_GET_PTS_DELAY:
case DEMUX_GET_FPS:
diff --git a/src/input/stream.c b/src/input/stream.c
index 4935691..99f4461 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -644,7 +644,10 @@ 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 * );
*pb_canreaddir = p_sys->method == STREAM_METHOD_READDIR;
+ if( pb_dirsorted )
+ *pb_dirsorted = p_access->info.b_dir_sorted;
return VLC_SUCCESS;
}
--
2.1.4
More information about the vlc-devel
mailing list