[vlc-commits] access: add a default pf_control for directory accesses

Thomas Guillem git at videolan.org
Thu Jun 4 14:19:21 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jun  3 11:44:05 2015 +0200| [71daa94bdabf6fa37d92c1616053f8da547cec0b] | committer: Thomas Guillem

access: add a default pf_control for directory accesses

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=71daa94bdabf6fa37d92c1616053f8da547cec0b
---

 include/vlc_access.h                |    5 +++++
 modules/access/directory.c          |    1 +
 modules/access/dsm/access.c         |    1 +
 modules/access/ftp.c                |    1 +
 modules/access/sftp.c               |    1 +
 modules/access/smb.c                |    1 +
 modules/services_discovery/upnp.cpp |    1 +
 src/input/access.c                  |   23 +++++++++++++++++++++++
 src/libvlccore.sym                  |    1 +
 9 files changed, 35 insertions(+)

diff --git a/include/vlc_access.h b/include/vlc_access.h
index 1adf669..93b3b7c 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -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;
 
+/**
+ * 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 ) \
     do { \
         p_access->pf_read = (read); \
diff --git a/modules/access/directory.c b/modules/access/directory.c
index 87b5b33..2abe15a 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -93,6 +93,7 @@ int DirOpen (vlc_object_t *p_this)
     p_access->p_sys->p_dir = p_dir;
     p_access->p_sys->psz_base_uri = psz_base_uri;
     p_access->pf_readdir = DirRead;
+    p_access->pf_control = access_vaDirectoryControlHelper;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 8e7fcdd..6a33f3b 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -705,6 +705,7 @@ static int BrowserInit( access_t *p_access )
         p_access->pf_readdir = BrowseDirectory;
         p_access->info.b_dir_can_loop = true;
     }
+    p_access->pf_control = access_vaDirectoryControlHelper;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index 096d54c..e5c5cfc 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -668,6 +668,7 @@ static int InOpen( vlc_object_t *p_this )
     if( b_directory )
     {
         p_access->pf_readdir = DirRead;
+        p_access->pf_control = access_vaDirectoryControlHelper;
         p_access->info.b_dir_can_loop = true;
     } else
         ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); \
diff --git a/modules/access/sftp.c b/modules/access/sftp.c
index 740da6b..b4c281a 100644
--- a/modules/access/sftp.c
+++ b/modules/access/sftp.c
@@ -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_access->pf_readdir = DirRead;
+        p_access->pf_control = access_vaDirectoryControlHelper;
         p_access->info.b_dir_can_loop = true;
 
         if( p_sys->file )
diff --git a/modules/access/smb.c b/modules/access/smb.c
index 3aa9902..83ce77d 100644
--- a/modules/access/smb.c
+++ b/modules/access/smb.c
@@ -253,6 +253,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 #else
         p_access->pf_readdir = DirRead;
+        p_access->pf_control = access_vaDirectoryControlHelper;
         p_access->info.b_dir_can_loop = true;
         i_smb = smbc_opendir( psz_uri );
         i_size = 0;
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 4f5aaf8..602950b 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -839,6 +839,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     p_access->pf_readdir = ReadDirectory;
+    p_access->pf_control = access_vaDirectoryControlHelper;
     p_access->info.b_dir_sorted = true;
     p_access->info.b_dir_can_loop = true;
 
diff --git a/src/input/access.c b/src/input/access.c
index 6b9ae13..fcab560 100644
--- a/src/input/access.c
+++ b/src/input/access.c
@@ -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;
 }
 
+/*****************************************************************************
+ * 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;
+}
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 1ae7c98..be6e4e3 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -1,4 +1,5 @@
 access_GetParentInput
+access_vaDirectoryControlHelper
 AddMD5
 aout_BitsPerSample
 aout_ChannelExtract



More information about the vlc-commits mailing list