[vlc-commits] [Git][videolan/vlc][3.0.x] input: fix input-slave url parsing regression

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Sep 9 13:43:22 UTC 2021



Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
8625e53a by Alaric Senat at 2021-09-09T13:28:05+00:00
input: fix input-slave url parsing regression

Fix a regression introduced by 6cbe6f5b1774ce491157f8ccaedb5ce36e1159c0
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 #26054

(cherry picked from commit 85e1eb7a50cb7e59bba3a3990af2f149cec5eac9)

- - - - -


1 changed file:

- src/input/input.c


Changes:

=====================================
src/input/input.c
=====================================
@@ -1029,6 +1029,30 @@ static void SetSubtitlesOptions( input_thread_t *p_input )
         var_SetInteger( p_input, "spu-delay", (mtime_t)i_delay * 100000 );
 }
 
+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_AUDIO;
+}
+
 static void GetVarSlaves( input_thread_t *p_input,
                           input_item_slave_t ***ppp_slaves, int *p_slaves )
 {
@@ -1058,28 +1082,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_AUDIO;
-        }
+        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/8625e53a91027fd1e2179d2dcc78cc28d17c50df

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




More information about the vlc-commits mailing list