[vlc-commits] [Git][videolan/vlc][master] input: fix input-slave url parsing regression

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Mon Sep 6 10:19:08 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
85e1eb7a by Alaric Senat at 2021-09-06T08:59:10+00:00
input: fix input-slave url parsing regression

Fix a regression introduced by bbdaa0b64a0626282d1dca2051c233969f00e1d7
where some access MRL would, by design, make the url parsing fail.
Url parsing failing should not be a blocker to add the input slave,
instead we just warn the user that we couldn't deduce the slave file
type based on the given MRL.

Fixes #26055

- - - - -


1 changed file:

- src/input/input.c


Changes:

=====================================
src/input/input.c
=====================================
@@ -998,6 +998,30 @@ static void SetSubtitlesOptions( input_thread_t *p_input )
     }
 }
 
+static enum slave_type DeduceSlaveType( input_thread_t *p_input,
+                                        const char *psz_uri )
+{
+    vlc_url_t parsed_uri;
+    if( vlc_UrlParse( &parsed_uri, psz_uri ) != VLC_SUCCESS ||
+        parsed_uri.psz_path == NULL )
+    {
+        goto fail;
+    }
+
+    enum slave_type i_type;
+    if( !input_item_slave_GetType( parsed_uri.psz_path, &i_type ) )
+        goto fail;
+
+    vlc_UrlClean( &parsed_uri );
+    return i_type;
+
+fail:
+    msg_Dbg( p_input, "Can't deduce slave type of \"%s\" with file extension.",
+             psz_uri );
+    vlc_UrlClean( &parsed_uri );
+    return SLAVE_TYPE_GENERIC;
+}
+
 static void GetVarSlaves( input_thread_t *p_input,
                           input_item_slave_t ***ppp_slaves, int *p_slaves )
 {
@@ -1027,28 +1051,9 @@ static void GetVarSlaves( input_thread_t *p_input,
         if( uri == NULL )
             continue;
 
-        vlc_url_t parsed_uri;
-        if ( vlc_UrlParse( &parsed_uri, uri ) != VLC_SUCCESS )
-        {
-            msg_Err( p_input,
-                    "Invalid url passed to the \"input-slave\" option" );
-            vlc_UrlClean( &parsed_uri );
-            free( uri );
-            continue;
-        }
-
-        enum slave_type i_type;
-        if ( !input_item_slave_GetType( parsed_uri.psz_path, &i_type ) )
-        {
-            msg_Warn( p_input,
-                     "Can't deduce slave type of `%s\" with file extension.",
-                     uri );
-            i_type = SLAVE_TYPE_GENERIC;
-        }
+        const enum slave_type i_type = DeduceSlaveType( p_input, uri );
         input_item_slave_t *p_slave =
             input_item_slave_New( uri, i_type, SLAVE_PRIORITY_USER );
-
-        vlc_UrlClean( &parsed_uri );
         free( uri );
 
         if( unlikely( p_slave == NULL ) )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/85e1eb7a50cb7e59bba3a3990af2f149cec5eac9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/85e1eb7a50cb7e59bba3a3990af2f149cec5eac9
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list