[vlc-commits] demux/playlist/xspf: fix input-item uri creation

Filip Roséen git at videolan.org
Fri Oct 28 19:09:37 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu Oct 13 22:43:13 2016 +0200| [36bee7702fe9f12b44f8228332813b05fdd125a4] | committer: Thomas Guillem

demux/playlist/xspf: fix input-item uri creation

The previous implementation inaccurately treated "p_sys->psz_base" as
if it was referring to whatever directory (uri-wise) that contains the
playlist we are currently processing.

Given that this is not the case, it would not handle relative paths
correctly.

These changes make sure that we use ProcessMRL to properly handle the
paths found within the playlist (the function handles both absolute
and relative ones).

fixes #17506

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

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

 modules/demux/playlist/xspf.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 5dfbfe4..16ee1b3 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -484,24 +484,19 @@ static bool parse_track_node COMPLEX_INTERFACE
             if (psz_value == NULL)
                 input_item_SetURI(p_new_input, "vlc://nop");
             else
-            /* FIXME (#4005): This is broken. Scheme-relative (//...) locations
-             * and anchors (#...) are not resolved correctly. Also,
-             * host-relative (/...) and directory-relative locations
-             * ("relative path" in vernacular) should be resolved.
-             * -- Courmisch */
-            if (p_sys->psz_base && !strstr(psz_value, "://"))
             {
-                char* psz_tmp;
-                if (asprintf(&psz_tmp, "%s%s", p_sys->psz_base, psz_value)
-                    == -1)
+                char* psz_uri = ProcessMRL( psz_value, p_sys->psz_base );
+
+                if( !psz_uri )
                 {
+                    msg_Warn( p_demux, "unable to process MRL: %s", psz_value );
                     goto end;
                 }
-                input_item_SetURI(p_new_input, psz_tmp);
-                free(psz_tmp);
+
+                input_item_SetURI(p_new_input, psz_uri);
+                free(psz_uri);
             }
-            else
-                input_item_SetURI(p_new_input, psz_value);
+
             input_item_CopyOptions(p_new_input, p_input_item);
         }
         else



More information about the vlc-commits mailing list