Commit 71daa94b authored by Thomas Guillem's avatar Thomas Guillem

access: add a default pf_control for directory accesses

parent 91f08755
...@@ -162,6 +162,11 @@ static inline void access_InitFields( access_t *p_a ) ...@@ -162,6 +162,11 @@ static inline void access_InitFields( access_t *p_a )
*/ */
VLC_API input_thread_t * access_GetParentInput( access_t *p_access ) VLC_USED; VLC_API input_thread_t * access_GetParentInput( access_t *p_access ) VLC_USED;
/**
* Default pf_control callback for directory accesses.
*/
VLC_API int access_vaDirectoryControlHelper( access_t *p_access, int i_query, va_list args );
#define ACCESS_SET_CALLBACKS( read, block, control, seek ) \ #define ACCESS_SET_CALLBACKS( read, block, control, seek ) \
do { \ do { \
p_access->pf_read = (read); \ p_access->pf_read = (read); \
......
...@@ -93,6 +93,7 @@ int DirOpen (vlc_object_t *p_this) ...@@ -93,6 +93,7 @@ int DirOpen (vlc_object_t *p_this)
p_access->p_sys->p_dir = p_dir; p_access->p_sys->p_dir = p_dir;
p_access->p_sys->psz_base_uri = psz_base_uri; p_access->p_sys->psz_base_uri = psz_base_uri;
p_access->pf_readdir = DirRead; p_access->pf_readdir = DirRead;
p_access->pf_control = access_vaDirectoryControlHelper;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -705,6 +705,7 @@ static int BrowserInit( access_t *p_access ) ...@@ -705,6 +705,7 @@ static int BrowserInit( access_t *p_access )
p_access->pf_readdir = BrowseDirectory; p_access->pf_readdir = BrowseDirectory;
p_access->info.b_dir_can_loop = true; p_access->info.b_dir_can_loop = true;
} }
p_access->pf_control = access_vaDirectoryControlHelper;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -668,6 +668,7 @@ static int InOpen( vlc_object_t *p_this ) ...@@ -668,6 +668,7 @@ static int InOpen( vlc_object_t *p_this )
if( b_directory ) if( b_directory )
{ {
p_access->pf_readdir = DirRead; p_access->pf_readdir = DirRead;
p_access->pf_control = access_vaDirectoryControlHelper;
p_access->info.b_dir_can_loop = true; p_access->info.b_dir_can_loop = true;
} else } else
ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \ ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \
......
...@@ -296,6 +296,7 @@ static int Open( vlc_object_t* p_this ) ...@@ -296,6 +296,7 @@ static int Open( vlc_object_t* p_this )
p_sys->file = libssh2_sftp_opendir( p_sys->sftp_session, psz_path ); p_sys->file = libssh2_sftp_opendir( p_sys->sftp_session, psz_path );
p_access->pf_readdir = DirRead; p_access->pf_readdir = DirRead;
p_access->pf_control = access_vaDirectoryControlHelper;
p_access->info.b_dir_can_loop = true; p_access->info.b_dir_can_loop = true;
if( p_sys->file ) if( p_sys->file )
......
...@@ -253,6 +253,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -253,6 +253,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
#else #else
p_access->pf_readdir = DirRead; p_access->pf_readdir = DirRead;
p_access->pf_control = access_vaDirectoryControlHelper;
p_access->info.b_dir_can_loop = true; p_access->info.b_dir_can_loop = true;
i_smb = smbc_opendir( psz_uri ); i_smb = smbc_opendir( psz_uri );
i_size = 0; i_size = 0;
......
...@@ -839,6 +839,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -839,6 +839,7 @@ static int Open( vlc_object_t *p_this )
} }
p_access->pf_readdir = ReadDirectory; p_access->pf_readdir = ReadDirectory;
p_access->pf_control = access_vaDirectoryControlHelper;
p_access->info.b_dir_sorted = true; p_access->info.b_dir_sorted = true;
p_access->info.b_dir_can_loop = true; p_access->info.b_dir_can_loop = true;
......
...@@ -128,3 +128,26 @@ input_thread_t * access_GetParentInput( access_t *p_access ) ...@@ -128,3 +128,26 @@ input_thread_t * access_GetParentInput( access_t *p_access )
return p_access->p_input ? vlc_object_hold((vlc_object_t *)p_access->p_input) : NULL; return p_access->p_input ? vlc_object_hold((vlc_object_t *)p_access->p_input) : NULL;
} }
/*****************************************************************************
* access_vaDirectoryControlHelper:
*****************************************************************************/
int access_vaDirectoryControlHelper( 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:
case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE:
*va_arg( args, bool* ) = false;
break;
case ACCESS_GET_PTS_DELAY:
*va_arg( args, int64_t * ) = 0;
break;
default:
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
access_GetParentInput access_GetParentInput
access_vaDirectoryControlHelper
AddMD5 AddMD5
aout_BitsPerSample aout_BitsPerSample
aout_ChannelExtract aout_ChannelExtract
......
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