[vlc-commits] input/input: handle demux selection in InputSourceNew

Filip Roséen git at videolan.org
Tue Dec 6 15:58:28 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Dec  3 12:58:22 2016 +0100| [0da42c15d6ecfa32710eb26c7baab9df04935e64] | committer: Thomas Guillem

input/input: handle demux selection in InputSourceNew

These changes moves logic from within InputDemuxNew, so that explicit
demux selection is in one place.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 src/input/input.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index cbbff14..68a5035 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2252,24 +2252,10 @@ static demux_t *InputDemuxNew( vlc_object_t *obj, const char *access_name,
                                const char *demux_name, const char *path,
                                es_out_t *out, bool preparsing, input_thread_t *input )
 {
-    char *demux_var = NULL;
-
     assert( access_name != NULL );
     assert( demux_name != NULL );
     assert( path != NULL );
 
-    if( demux_name[0] == '\0' )
-    {
-        demux_var = var_InheritString( obj, "demux" );
-        if( demux_var != NULL )
-        {
-            demux_name = demux_var;
-            msg_Dbg( obj, "specified demux: %s", demux_name );
-        }
-        else
-            demux_name = "any";
-    }
-
     demux_t *demux = NULL;
 
     if( preparsing )
@@ -2337,7 +2323,6 @@ static demux_t *InputDemuxNew( vlc_object_t *obj, const char *access_name,
         }
     }
 out:
-    free( demux_var );
     return demux;
 }
 
@@ -2358,6 +2343,7 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
 
     assert( psz_mrl );
     char *psz_dup = strdup( psz_mrl );
+    char *psz_demux_var = NULL;
 
     if( psz_dup == NULL )
     {
@@ -2368,9 +2354,15 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
     /* Split uri */
     input_SplitMRL( &psz_access, &psz_demux, &psz_path, &psz_anchor, psz_dup );
 
+    if( psz_demux == NULL || psz_demux[0] == '\0' )
+        psz_demux = psz_demux_var = var_InheritString( in, "demux" );
+
     if( psz_forced_demux != NULL )
         psz_demux = psz_forced_demux;
 
+    if( psz_demux == NULL )
+        psz_demux = "any";
+
     msg_Dbg( p_input, "`%s' gives access `%s' demux `%s' path `%s'",
              psz_mrl, psz_access, psz_demux, psz_path );
 
@@ -2434,6 +2426,7 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
     in->p_demux = InputDemuxNew( VLC_OBJECT(in), psz_access, psz_demux,
                                  psz_path, input_priv(p_input)->p_es_out,
                                  input_priv(p_input)->b_preparsing, p_input );
+    free( psz_demux_var );
     free( psz_dup );
 
     if( in->p_demux == NULL )



More information about the vlc-commits mailing list