[vlc-commits] demux: adaptive: use vlc_url_resolve (fix #19164)

Francois Cartegnie git at videolan.org
Tue Nov 28 10:58:17 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Nov 28 10:28:58 2017 +0100| [00c6ac9055cd582d86cae89024cd2d909f61d2a2] | committer: Francois Cartegnie

demux: adaptive: use vlc_url_resolve (fix #19164)

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

 modules/demux/adaptive/playlist/Url.cpp | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/playlist/Url.cpp b/modules/demux/adaptive/playlist/Url.cpp
index c6eb264328..fd9f0d203e 100644
--- a/modules/demux/adaptive/playlist/Url.cpp
+++ b/modules/demux/adaptive/playlist/Url.cpp
@@ -25,6 +25,8 @@
 #include "BaseRepresentation.h"
 #include "SegmentTemplate.h"
 
+#include <vlc_url.h>
+
 using namespace adaptive::playlist;
 
 Url::Url()
@@ -109,14 +111,29 @@ std::string Url::toString(size_t index, const BaseRepresentation *rep) const
 {
     std::string ret;
     std::vector<Component>::const_iterator it;
+
     for(it = components.begin(); it != components.end(); ++it)
     {
+        std::string part;
         const Component *comp = & (*it);
         if(rep)
-            ret.append(rep->contextualize(index, comp->component, comp->templ));
+            part = rep->contextualize(index, comp->component, comp->templ);
         else
-            ret.append(comp->component);
+            part = comp->component;
+
+        if( ret.empty() )
+            ret = part;
+        else
+        {
+            char *psz_resolved = vlc_uri_resolve( ret.c_str(), part.c_str() );
+            if( psz_resolved )
+            {
+                ret = std::string( psz_resolved );
+                free( psz_resolved );
+            }
+        }
     }
+
     return ret;
 }
 



More information about the vlc-commits mailing list