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

demux: check for pf_readdir directly

Since we anyway test for pf_read and pf_block, and for pf_demux, we
might as well check for pf_readdir being non-NULL directly.

Maybe someone wants to add a VLC stream equivalent for fstat(),
replacing those NULL tests and STREAM_GETSIZE but that is left for
future study.
parent 2ec4bfe7
......@@ -76,7 +76,7 @@ static int Import_Dir( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
if( vlc_stream_Control( p_demux->s, STREAM_IS_DIRECTORY ) )
if( p_demux->s->pf_readdir == NULL )
return VLC_EGENERIC;
if( p_demux->p_input == NULL )
return VLC_ETIMEOUT;
......
......@@ -62,7 +62,6 @@ void Close_WPL ( vlc_object_t * );
#define CHECK_FILE(obj) \
do { \
if( vlc_stream_Control( GetSource(obj), \
STREAM_IS_DIRECTORY ) == VLC_SUCCESS ) \
if( GetSource(obj)->pf_readdir != NULL ) \
return VLC_EGENERIC; \
} while(0)
......@@ -279,7 +279,7 @@ int Import_LuaPlaylist(vlc_object_t *obj)
return VLC_EGENERIC;
stream_t *s = (stream_t *)obj;
if( !vlc_stream_Control( s->s, STREAM_IS_DIRECTORY ) )
if( s->s->pf_readdir != NULL )
return VLC_EGENERIC;
struct vlclua_playlist *sys = malloc(sizeof (*sys));
......
......@@ -210,7 +210,7 @@ static int vlclua_stream_readdir( lua_State *L )
if( !pp_stream || !*pp_stream )
return vlclua_error( L );
if ( vlc_stream_Control( *pp_stream, STREAM_IS_DIRECTORY ) != VLC_SUCCESS )
if( (*pp_stream)->pf_readdir == NULL )
return vlclua_error( L );
input_item_t *p_input = input_item_New( (*pp_stream)->psz_url, NULL );
......
......@@ -80,7 +80,7 @@ static int Open ( vlc_object_t *p_this )
stream_t *s = (stream_t*)p_this;
stream_sys_t *p_sys;
if( vlc_stream_Control( s->s, STREAM_IS_DIRECTORY ) == VLC_SUCCESS )
if( s->s->pf_readdir != NULL )
return VLC_EGENERIC;
/* */
......
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