[vlc-devel] [PATCH 2/6] input/access: add preparsing flag

Thomas Guillem thomas at gllm.fr
Sun Jun 5 10:56:11 CEST 2016


This flag will be used to notify the access module that we are preparsing.
---
 include/vlc_access.h | 1 +
 src/input/access.c   | 9 +++++----
 src/input/demux.c    | 2 +-
 src/input/stream.c   | 2 +-
 src/input/stream.h   | 2 +-
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/vlc_access.h b/include/vlc_access.h
index dd288af..d37af3d 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -83,6 +83,7 @@ struct access_t
     char        *psz_url; /**< Full URL or MRL */
     const char  *psz_location; /**< Location (URL with the scheme stripped) */
     char        *psz_filepath; /**< Local file path (if applicable) */
+    bool         b_preparsing; /**< True if this access is used to preparse */
 
     /* pf_read/pf_block/pf_readdir is used to read data.
      * XXX A access should set one and only one of them */
diff --git a/src/input/access.c b/src/input/access.c
index c48f975..79417ac 100644
--- a/src/input/access.c
+++ b/src/input/access.c
@@ -61,7 +61,7 @@ char *get_path(const char *location)
  * access_New:
  *****************************************************************************/
 static access_t *access_New(vlc_object_t *parent, input_thread_t *input,
-                            const char *mrl)
+                            bool preparsing, const char *mrl)
 {
     char *redirv[MAX_REDIR];
     unsigned redirc = 0;
@@ -80,6 +80,7 @@ static access_t *access_New(vlc_object_t *parent, input_thread_t *input,
     access->pf_seek = NULL;
     access->pf_control = NULL;
     access->p_sys = NULL;
+    access->b_preparsing = preparsing;
     access_InitFields(access);
 
     if (unlikely(access->psz_url == NULL))
@@ -142,7 +143,7 @@ error:
 
 access_t *vlc_access_NewMRL(vlc_object_t *parent, const char *mrl)
 {
-    return access_New(parent, NULL, mrl);
+    return access_New(parent, NULL, false, mrl);
 }
 
 void vlc_access_Delete(access_t *access)
@@ -378,7 +379,7 @@ static void AStreamDestroy(stream_t *s)
 }
 
 stream_t *stream_AccessNew(vlc_object_t *parent, input_thread_t *input,
-                           const char *url)
+                           bool preparsing, const char *url)
 {
     stream_t *s = stream_CommonNew(parent, AStreamDestroy);
     if (unlikely(s == NULL))
@@ -388,7 +389,7 @@ stream_t *stream_AccessNew(vlc_object_t *parent, input_thread_t *input,
     if (unlikely(sys == NULL))
         goto error;
 
-    sys->access = access_New(VLC_OBJECT(s), input, url);
+    sys->access = access_New(VLC_OBJECT(s), input, preparsing, url);
     if (sys->access == NULL)
         goto error;
 
diff --git a/src/input/demux.c b/src/input/demux.c
index 49b7fbc..c532752 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -285,7 +285,7 @@ demux_t *input_DemuxNew( vlc_object_t *obj, const char *access_name,
 
         if( likely(asprintf( &url, "%s://%s", access_name, path) >= 0) )
         {
-            stream = stream_AccessNew( obj, input, url );
+            stream = stream_AccessNew( obj, input, preparsing, url );
             free( url );
         }
 
diff --git a/src/input/stream.c b/src/input/stream.c
index c7cb4b4..b1b0488 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -130,7 +130,7 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
     if( !psz_url )
         return NULL;
 
-    stream_t *s = stream_AccessNew( p_parent, NULL, psz_url );
+    stream_t *s = stream_AccessNew( p_parent, NULL, false, psz_url );
     if( s == NULL )
         msg_Err( p_parent, "no suitable access module for `%s'", psz_url );
     return s;
diff --git a/src/input/stream.h b/src/input/stream.h
index 4031c7a..261ba7c 100644
--- a/src/input/stream.h
+++ b/src/input/stream.h
@@ -35,7 +35,7 @@ void stream_CommonDelete( stream_t *s );
 /**
  * This function creates a stream_t with an access_t back-end.
  */
-stream_t *stream_AccessNew(vlc_object_t *, input_thread_t *, const char *);
+stream_t *stream_AccessNew(vlc_object_t *, input_thread_t *, bool, const char *);
 
 /**
  * This function creates a new stream_t filter.
-- 
2.8.1



More information about the vlc-devel mailing list