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

Alaric Senat git at videolan.org
Fri Apr 9 11:23:01 UTC 2021


vlc/vlc-3.0 | branch: master | Alaric Senat <dev.asenat at posteo.net> | Fri Apr  2 16:30:07 2021 +0200| [6cbe6f5b1774ce491157f8ccaedb5ce36e1159c0] | committer: Steve Lhomme

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>
(cherry picked from commit bbdaa0b64a0626282d1dca2051c233969f00e1d7)

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

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

 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 49eeab3b0e..81cfac86cc 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1058,8 +1058,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.",
@@ -1069,6 +1079,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