Commit 3840a03d authored by Thomas Guillem's avatar 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
parent 88ffe158
......@@ -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;
......
......@@ -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 */
......
......@@ -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:
......
......@@ -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;
......
......@@ -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)
......
......@@ -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:
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment