[vlc-commits] demux: dash: add segmentList duration

Francois Cartegnie git at videolan.org
Fri Jan 2 15:39:49 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan  1 16:46:19 2015 +0100| [18186c84d44f844c2e113126b887692c483622e8] | committer: Francois Cartegnie

demux: dash: add segmentList duration

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

 modules/demux/dash/mpd/IsoffMainParser.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 75b3cce..9271e41 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -270,12 +270,16 @@ void IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformatio
 size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation *info)
 {
     size_t total = 0;
+    mtime_t totaltime = 0;
     if(segListNode)
     {
         std::vector<Node *> segments = DOMHelper::getElementByTagName(segListNode, "SegmentURL", false);
         SegmentList *list;
         if(!segments.empty() && (list = new (std::nothrow) SegmentList()))
         {
+            if(segListNode->hasAttribute("duration"))
+                list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration")));
+
             std::vector<Node *>::const_iterator it;
             for(it = segments.begin(); it != segments.end(); it++)
             {
@@ -297,6 +301,12 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
                     seg->setByteRange(atoi(range.substr(0, pos).c_str()), atoi(range.substr(pos + 1, range.size()).c_str()));
                 }
 
+                if(totaltime || list->getDuration())
+                {
+                    seg->startTime.Set(totaltime);
+                    totaltime += list->getDuration();
+                }
+
                 list->addSegment(seg);
                 total++;
             }



More information about the vlc-commits mailing list