vlc | branch: master | Thomas Guillem <tho...@gllm.fr> | Mon May 4 09:11:08 2015 +0200| [763e765d2446cc87380a342a4f450f44a1bf89d3] | committer: Thomas Guillem
access: pf_control is not mandatory for directory accesses > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=763e765d2446cc87380a342a4f450f44a1bf89d3 --- include/vlc_access.h | 3 ++- modules/access/directory.c | 30 ------------------------------ modules/access/dsm/access.c | 27 --------------------------- modules/access/sftp.c | 28 ---------------------------- modules/services_discovery/upnp.cpp | 31 ------------------------------- src/input/access.c | 5 +++++ 6 files changed, 7 insertions(+), 117 deletions(-) diff --git a/include/vlc_access.h b/include/vlc_access.h index e83d53f..1f3cb03 100644 --- a/include/vlc_access.h +++ b/include/vlc_access.h @@ -117,7 +117,8 @@ struct access_t static inline int access_vaControl( access_t *p_access, int i_query, va_list args ) { if( !p_access ) return VLC_EGENERIC; - return p_access->pf_control( p_access, i_query, args ); + return p_access->pf_control ? p_access->pf_control( p_access, i_query, args ) + : VLC_EGENERIC; } static inline int access_Control( access_t *p_access, int i_query, ... ) diff --git a/modules/access/directory.c b/modules/access/directory.c index 7209978..5cac748 100644 --- a/modules/access/directory.c +++ b/modules/access/directory.c @@ -327,7 +327,6 @@ int DirInit (access_t *p_access, DIR *handle) p_sys->ignored_exts = var_InheritString (p_access, "ignore-filetypes"); p_access->pf_readdir = DirRead; - p_access->pf_control = DirControl; return VLC_SUCCESS; @@ -417,32 +416,3 @@ int DirRead (access_t *p_access, input_item_node_t *p_current_node) return VLC_SUCCESS; } - -/***************************************************************************** - * Control: - *****************************************************************************/ -int DirControl (access_t *p_access, int i_query, va_list args) -{ - VLC_UNUSED (p_access); - - switch (i_query) - { - case ACCESS_CAN_SEEK: - case ACCESS_CAN_FASTSEEK: - *va_arg (args, bool*) = false; - break; - - case ACCESS_CAN_PAUSE: - case ACCESS_CAN_CONTROL_PACE: - *va_arg (args, bool*) = true; - break; - - case ACCESS_GET_PTS_DELAY: - *va_arg (args, int64_t *) = DEFAULT_PTS_DELAY * 1000; - break; - - default: - return VLC_EGENERIC; - } - return VLC_SUCCESS; - } diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c index d6c83f6..5695718 100644 --- a/modules/access/dsm/access.c +++ b/modules/access/dsm/access.c @@ -692,32 +692,6 @@ static int BrowseDirectory( access_t *p_access, input_item_node_t *p_node ) return i_ret; } -static int BrowserControl( access_t *p_access, int i_query, va_list args ) -{ - VLC_UNUSED( p_access ); - - switch( i_query ) - { - case ACCESS_CAN_SEEK: - case ACCESS_CAN_FASTSEEK: - *va_arg( args, bool* ) = false; - break; - - case ACCESS_CAN_PAUSE: - case ACCESS_CAN_CONTROL_PACE: - *va_arg( args, bool* ) = true; - break; - - case ACCESS_GET_PTS_DELAY: - *va_arg( args, int64_t * ) = DEFAULT_PTS_DELAY * 1000; - break; - - default: - return VLC_EGENERIC; - } - return VLC_SUCCESS; -} - static int BrowserInit( access_t *p_access ) { access_sys_t *p_sys = p_access->p_sys; @@ -726,7 +700,6 @@ static int BrowserInit( access_t *p_access ) p_access->pf_readdir = BrowseShare; else p_access->pf_readdir = BrowseDirectory; - p_access->pf_control = BrowserControl; return VLC_SUCCESS; } diff --git a/modules/access/sftp.c b/modules/access/sftp.c index 3a59fd2..43edca1 100644 --- a/modules/access/sftp.c +++ b/modules/access/sftp.c @@ -272,7 +272,6 @@ static int Open( vlc_object_t* p_this ) p_sys->file = libssh2_sftp_opendir( p_sys->sftp_session, url.psz_path ); p_access->pf_readdir = DirRead; - p_access->pf_control = DirControl; if( p_sys->file ) { @@ -506,30 +505,3 @@ static int DirRead (access_t *p_access, input_item_node_t *p_current_node) free( psz_file ); return VLC_SUCCESS; } - - -static int DirControl( access_t *p_access, int i_query, va_list args ) -{ - VLC_UNUSED( p_access ); - - switch( i_query ) - { - case ACCESS_CAN_SEEK: - case ACCESS_CAN_FASTSEEK: - *va_arg( args, bool* ) = false; - break; - - case ACCESS_CAN_PAUSE: - case ACCESS_CAN_CONTROL_PACE: - *va_arg( args, bool* ) = true; - break; - - case ACCESS_GET_PTS_DELAY: - *va_arg( args, int64_t * ) = DEFAULT_PTS_DELAY * 1000; - break; - - default: - return VLC_EGENERIC; - } - return VLC_SUCCESS; -} diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp index a16794a..7cc3438 100644 --- a/modules/services_discovery/upnp.cpp +++ b/modules/services_discovery/upnp.cpp @@ -806,36 +806,6 @@ static int ReadDirectory( access_t *p_access, input_item_node_t* p_node ) return VLC_SUCCESS; } -static int Control( access_t *, int i_query, va_list args ) -{ - switch ( i_query ) - { - case ACCESS_CAN_SEEK: - case ACCESS_CAN_FASTSEEK: - case ACCESS_CAN_PAUSE: - case ACCESS_CAN_CONTROL_PACE: - *va_arg( args, bool* ) = false; - break; - - case ACCESS_GET_SIZE: - { - *va_arg( args, uint64_t * ) = 0; - break; - } - case ACCESS_GET_PTS_DELAY: - *va_arg( args, int64_t * ) = 0; - break; - - case ACCESS_SET_PAUSE_STATE: - /* Nothing to do */ - break; - - default: - return VLC_EGENERIC; - } - return VLC_SUCCESS; -} - static int Open( vlc_object_t *p_this ) { access_t* p_access = (access_t*)p_this; @@ -852,7 +822,6 @@ static int Open( vlc_object_t *p_this ) } p_access->pf_readdir = ReadDirectory; - ACCESS_SET_CALLBACKS( NULL, NULL, Control, NULL ); return VLC_SUCCESS; } diff --git a/src/input/access.c b/src/input/access.c index a9b2804..7bf4390 100644 --- a/src/input/access.c +++ b/src/input/access.c @@ -25,6 +25,8 @@ # include "config.h" #endif +#include <assert.h> + #include "access.h" #include <libvlc.h> #include <vlc_url.h> @@ -89,6 +91,9 @@ access_t *access_New( vlc_object_t *p_obj, input_thread_t *p_parent_input, if( p_access->p_module == NULL ) goto error; + /* if access has pf_readdir, pf_control is not mandatory */ + assert( p_access->pf_control || p_access->pf_readdir ); + return p_access; error: _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits