[vlc-devel] [RFC 06/10] input/demux: prepare input_DemuxNew for future functionality

Filip Roséen filip at atch.se
Mon Nov 28 03:22:25 CET 2016


In order to simplify future functionality within src/input/demux.c,
these changes modifies the argument type of "in" for input_DemuxNew,
as well as passing the anchor directly to the function.

This is done to simplify future functionality that will live inside
src/input/demux.c
---
 src/input/demux.c | 30 ++++++++++++++++--------------
 src/input/demux.h |  5 +++--
 src/input/input.c |  5 +++--
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/input/demux.c b/src/input/demux.c
index 96136a1..352e3df 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -35,6 +35,8 @@
 #include <vlc_modules.h>
 #include <vlc_strings.h>
 
+#include "input_internal.h"
+
 static bool SkipID3Tag( demux_t * );
 static bool SkipAPETag( demux_t *p_demux );
 
@@ -278,8 +280,8 @@ error:
     return NULL;
 }
 
-demux_t *input_DemuxNew( vlc_object_t *obj, const char *access_name,
-                         const char *demux_name, const char *path,
+demux_t *input_DemuxNew( input_source_t* in, const char *access_name,
+                         const char *demux_name, const char *path, char const* anchor,
                          es_out_t *out, bool preparsing, input_thread_t *input )
 {
     char *demux_var = NULL;
@@ -290,11 +292,11 @@ demux_t *input_DemuxNew( vlc_object_t *obj, const char *access_name,
 
     if( demux_name[0] == '\0' )
     {
-        demux_var = var_InheritString( obj, "demux" );
+        demux_var = var_InheritString( in, "demux" );
         if( demux_var != NULL )
         {
             demux_name = demux_var;
-            msg_Dbg( obj, "specified demux: %s", demux_name );
+            msg_Dbg( in, "specified demux: %s", demux_name );
         }
         else
             demux_name = "any";
@@ -307,11 +309,11 @@ demux_t *input_DemuxNew( vlc_object_t *obj, const char *access_name,
         if( strcasecmp( demux_name, "any" ) )
             goto out;
 
-        msg_Dbg( obj, "preparsing %s://%s", access_name, path );
+        msg_Dbg( in, "preparsing %s://%s", access_name, path );
     }
     else /* Try access_demux first */
-        demux = demux_NewAdvanced( obj, input, access_name, demux_name, path,
-                                   NULL, out, false );
+        demux = demux_NewAdvanced( VLC_OBJECT( in ), input, access_name,
+                                   demux_name, path, NULL, out, false );
 
     if( demux == NULL )
     {   /* Then try a real access,stream,demux chain */
@@ -321,27 +323,27 @@ 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, preparsing, url );
+            stream = stream_AccessNew( VLC_OBJECT( in ), input, preparsing, url );
             free( url );
         }
 
         if( stream == NULL )
         {
-            msg_Err( obj, "cannot access %s://%s", access_name, path );
+            msg_Err( in, "cannot access %s://%s", access_name, path );
             goto out;
         }
 
         /* Add stream filters */
         stream = stream_FilterAutoNew( stream );
 
-        char *filters = var_InheritString( obj, "stream-filter" );
+        char *filters = var_InheritString( in, "stream-filter" );
         if( filters != NULL )
         {
             stream = stream_FilterChainNew( stream, filters );
             free( filters );
         }
 
-        if( var_InheritBool( obj, "input-record-native" ) )
+        if( var_InheritBool( in, "input-record-native" ) )
             stream = stream_FilterChainNew( stream, "record" );
 
         /* FIXME: Hysterical raisins. Access is not updated according to any
@@ -358,11 +360,11 @@ demux_t *input_DemuxNew( vlc_object_t *obj, const char *access_name,
             path += 3;
         }
 
-        demux = demux_NewAdvanced( obj, input, access_name, demux_name, path,
-                                   stream, out, preparsing );
+        demux = demux_NewAdvanced( VLC_OBJECT( in ), input, access_name,
+                                   demux_name, path, stream, out, preparsing );
         if( demux == NULL )
         {
-            msg_Err( obj, "cannot parse %s://%s", access_name, path );
+            msg_Err( in, "cannot parse %s://%s", access_name, path );
             vlc_stream_Delete( stream );
         }
     }
diff --git a/src/input/demux.h b/src/input/demux.h
index c981a8d..fb36ac9 100644
--- a/src/input/demux.h
+++ b/src/input/demux.h
@@ -29,6 +29,7 @@
 #include <vlc_demux.h>
 
 #include "stream.h"
+#include "input_internal.h"
 
 /* stream_t *s could be null and then it mean a access+demux in one */
 demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
@@ -36,8 +37,8 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
                             const char *psz_path, stream_t *s, es_out_t *out, bool );
 #define demux_NewAdvanced( a, b, c, d, e, f, g, h ) demux_NewAdvanced(VLC_OBJECT(a),b,c,d,e,f,g,h)
 
-demux_t *input_DemuxNew( vlc_object_t *, const char *access, const char *demux,
-                         const char *path, es_out_t *out, bool quick,
+demux_t *input_DemuxNew( input_source_t* in, const char *access, const char *demux,
+                         const char *path, const char* anchor, es_out_t *out, bool quick,
                          input_thread_t * );
 
 unsigned demux_TestAndClearFlags( demux_t *, unsigned );
diff --git a/src/input/input.c b/src/input/input.c
index 118612c..025e284 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2339,8 +2339,9 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
         TAB_CLEAN( count, tab );
     }
 
-    in->p_demux = input_DemuxNew( VLC_OBJECT(in), psz_access, psz_demux,
-                                  psz_path, input_priv(p_input)->p_es_out,
+    in->p_demux = input_DemuxNew( in, psz_access, psz_demux,
+                                  psz_path, psz_anchor,
+                                  input_priv(p_input)->p_es_out,
                                   input_priv(p_input)->b_preparsing, p_input );
     free( psz_dup );
 
-- 
2.10.2



More information about the vlc-devel mailing list