Commit 83687443 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: remove first parameter to STREAM_IS_DIRECTORY

Return an error code if the stream is not a directory (similar to
STREAM_GET_SIZE).
parent c1de0957
...@@ -83,7 +83,7 @@ enum stream_query_e ...@@ -83,7 +83,7 @@ enum stream_query_e
STREAM_CAN_CONTROL_PACE, /**< arg1= bool * res=cannot fail*/ STREAM_CAN_CONTROL_PACE, /**< arg1= bool * res=cannot fail*/
/* */ /* */
STREAM_GET_SIZE=6, /**< arg1= uint64_t * res=can fail */ STREAM_GET_SIZE=6, /**< arg1= uint64_t * res=can fail */
STREAM_IS_DIRECTORY, /**< arg1= bool *, arg2= bool *, arg3=bool *, res=can fail*/ STREAM_IS_DIRECTORY, /**< arg1= bool *, arg2= bool *, res=can fail*/
/* */ /* */
STREAM_GET_PTS_DELAY = 0x101,/**< arg1= int64_t* res=cannot fail */ STREAM_GET_PTS_DELAY = 0x101,/**< arg1= int64_t* res=cannot fail */
......
...@@ -39,7 +39,6 @@ static int Control(stream_t *p_stream, int i_query, va_list args) ...@@ -39,7 +39,6 @@ static int Control(stream_t *p_stream, int i_query, va_list args)
switch( i_query ) switch( i_query )
{ {
case STREAM_IS_DIRECTORY: case STREAM_IS_DIRECTORY:
*va_arg( args, bool * ) = true;
*va_arg( args, bool * ) = false; *va_arg( args, bool * ) = false;
*va_arg( args, bool * ) = false; *va_arg( args, bool * ) = false;
break; break;
......
...@@ -48,10 +48,10 @@ static int Demux( demux_t *p_demux ); ...@@ -48,10 +48,10 @@ static int Demux( demux_t *p_demux );
int Import_Dir ( vlc_object_t *p_this) int Import_Dir ( vlc_object_t *p_this)
{ {
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
bool b_is_dir, b_dir_sorted, b_dir_can_loop; bool b_dir_sorted, b_dir_can_loop;
if( stream_Control( p_demux->s, STREAM_IS_DIRECTORY, &b_is_dir, if( stream_Control( p_demux->s, STREAM_IS_DIRECTORY,
&b_dir_sorted, &b_dir_can_loop ) || !b_is_dir ) &b_dir_sorted, &b_dir_can_loop ) )
return VLC_EGENERIC; return VLC_EGENERIC;
STANDARD_DEMUX_INIT_MSG( "reading directory content" ); STANDARD_DEMUX_INIT_MSG( "reading directory content" );
......
...@@ -84,10 +84,9 @@ bool CheckContentType( stream_t * p_stream, const char * psz_ctype ); ...@@ -84,10 +84,9 @@ bool CheckContentType( stream_t * p_stream, const char * psz_ctype );
#define CHECK_FILE() \ #define CHECK_FILE() \
do { \ do { \
bool b_is_dir, b_sorted, b_loop; \ bool b_sorted, b_loop; \
if( stream_Control( ((demux_t *)p_this)->s, STREAM_IS_DIRECTORY, \ if( stream_Control( ((demux_t *)p_this)->s, STREAM_IS_DIRECTORY, \
&b_is_dir, &b_sorted, &b_loop ) == VLC_SUCCESS && \ &b_sorted, &b_loop ) == VLC_SUCCESS ) \
b_is_dir ) \
return VLC_EGENERIC; \ return VLC_EGENERIC; \
} while(0) } while(0)
......
...@@ -311,7 +311,8 @@ static int AStreamControl(stream_t *s, int cmd, va_list args) ...@@ -311,7 +311,8 @@ static int AStreamControl(stream_t *s, int cmd, va_list args)
return access_vaControl(access, cmd, args); return access_vaControl(access, cmd, args);
case STREAM_IS_DIRECTORY: case STREAM_IS_DIRECTORY:
*va_arg(args, bool *) = access->pf_readdir != NULL; if (access->pf_readdir == NULL)
return VLC_EGENERIC;
*va_arg(args, bool *) = access->info.b_dir_sorted; *va_arg(args, bool *) = access->info.b_dir_sorted;
*va_arg(args, bool *) = access->info.b_dir_can_loop; *va_arg(args, bool *) = access->info.b_dir_can_loop;
break; break;
......
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