[vlc-commits] demux: check for pf_readdir directly
Rémi Denis-Courmont
git at videolan.org
Sat Mar 31 17:02:19 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 31 15:54:57 2018 +0300| [69389c1c50fddd9ccb7067a9576376e3b008c024] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=69389c1c50fddd9ccb7067a9576376e3b008c024
---
modules/demux/directory.c | 2 +-
modules/demux/playlist/playlist.h | 3 +--
modules/lua/demux.c | 2 +-
modules/lua/libs/stream.c | 2 +-
modules/stream_filter/record.c | 2 +-
5 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/modules/demux/directory.c b/modules/demux/directory.c
index 31a7cb7ece..3510c77b45 100644
--- a/modules/demux/directory.c
+++ b/modules/demux/directory.c
@@ -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;
diff --git a/modules/demux/playlist/playlist.h b/modules/demux/playlist/playlist.h
index 30c8003d74..43d0d292c5 100644
--- a/modules/demux/playlist/playlist.h
+++ b/modules/demux/playlist/playlist.h
@@ -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)
diff --git a/modules/lua/demux.c b/modules/lua/demux.c
index 95bf40b7ae..677175bfb6 100644
--- a/modules/lua/demux.c
+++ b/modules/lua/demux.c
@@ -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));
diff --git a/modules/lua/libs/stream.c b/modules/lua/libs/stream.c
index 9da67d4c41..db4b3501cc 100644
--- a/modules/lua/libs/stream.c
+++ b/modules/lua/libs/stream.c
@@ -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 );
diff --git a/modules/stream_filter/record.c b/modules/stream_filter/record.c
index 7a155afa00..030cbc30c8 100644
--- a/modules/stream_filter/record.c
+++ b/modules/stream_filter/record.c
@@ -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;
/* */
More information about the vlc-commits
mailing list