[vlc-commits] demux: dash: add missing periods baseUrl

Francois Cartegnie git at videolan.org
Mon Feb 23 23:55:15 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 23 23:54:30 2015 +0100| [9a6b8414222420bdf464f0d3150055c150b99893] | committer: Francois Cartegnie

demux: dash: add missing periods baseUrl

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

 modules/demux/dash/mpd/IsoffMainParser.cpp |    4 ++++
 modules/demux/dash/mpd/Period.cpp          |    7 ++++++-
 modules/demux/dash/mpd/Period.h            |    1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 17708db..50379d6 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -111,6 +111,10 @@ void IsoffMainParser::parsePeriods(Node *root)
             period->duration.Set(IsoTime((*it)->getAttributeValue("duration")));
         if((*it)->hasAttribute("id"))
             period->setId((*it)->getAttributeValue("id"));
+        std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(*it, "BaseURL");
+        if(!baseUrls.empty())
+            period->baseUrl.Set( new Url( baseUrls.front()->getText() ) );
+
         setAdaptationSets(*it, period);
         mpd->addPeriod(period);
     }
diff --git a/modules/demux/dash/mpd/Period.cpp b/modules/demux/dash/mpd/Period.cpp
index 904107b..1487d48 100644
--- a/modules/demux/dash/mpd/Period.cpp
+++ b/modules/demux/dash/mpd/Period.cpp
@@ -39,11 +39,13 @@ Period::Period(MPD *mpd) :
 {
     duration.Set(0);
     startTime.Set(0);
+    baseUrl.Set(NULL);
 }
 
 Period::~Period ()
 {
     vlc_delete_all( this->adaptationSets );
+    delete baseUrl.Get();
     childs.clear();
 }
 
@@ -86,7 +88,10 @@ AdaptationSet * Period::getAdaptationSet(Streams::Type type) const
 
 Url Period::getUrlSegment() const
 {
-    return getParentUrlSegment();
+    if( baseUrl.Get() )
+        return *(baseUrl.Get());
+    else
+        return getParentUrlSegment();
 }
 
 std::vector<std::string> Period::toString(int indent) const
diff --git a/modules/demux/dash/mpd/Period.h b/modules/demux/dash/mpd/Period.h
index 06304dd..ed54b11 100644
--- a/modules/demux/dash/mpd/Period.h
+++ b/modules/demux/dash/mpd/Period.h
@@ -55,6 +55,7 @@ namespace dash
                 virtual Url getUrlSegment() const; /* reimpl */
                 virtual mtime_t getPeriodStart() const; /* reimpl */
 
+                Property<Url *> baseUrl;
                 Property<mtime_t> duration;
                 Property<mtime_t> startTime;
 



More information about the vlc-commits mailing list