[vlc-commits] input: add url parsing of `input-slave` option

Alaric Senat git at videolan.org
Thu Apr 8 12:29:07 UTC 2021


vlc | branch: master | Alaric Senat <dev.asenat at posteo.net> | Fri Apr  2 16:30:07 2021 +0200| [bbdaa0b64a0626282d1dca2051c233969f00e1d7] | committer: Thomas Guillem

input: add url parsing of `input-slave` option

As shown in #25549, we need to extract the path from the url in order to
check the file extension without the eventual HTTP's options noise.

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

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

 src/input/input.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/input/input.c b/src/input/input.c
index 286dfe3fd7..e52fdd9d2f 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -984,8 +984,18 @@ 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(uri, &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.",
@@ -995,6 +1005,7 @@ static void GetVarSlaves( input_thread_t *p_input,
         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 ) )



More information about the vlc-commits mailing list