[vlc-commits] demux: adaptative: add element number to timelines

Francois Cartegnie git at videolan.org
Tue Sep 22 00:38:52 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 21 14:57:16 2015 +0200| [0b57f64dfaefa83c96072675c2cf6606c0570883] | committer: Francois Cartegnie

demux: adaptative: add element number to timelines

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

 modules/demux/adaptative/playlist/SegmentTimeline.cpp |    7 ++++---
 modules/demux/adaptative/playlist/SegmentTimeline.h   |    5 +++--
 modules/demux/dash/mpd/IsoffMainParser.cpp            |   11 +++++++++--
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/demux/adaptative/playlist/SegmentTimeline.cpp b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
index 23ac613..cb04095 100644
--- a/modules/demux/adaptative/playlist/SegmentTimeline.cpp
+++ b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
@@ -40,9 +40,9 @@ SegmentTimeline::~SegmentTimeline()
         delete *it;
 }
 
-void SegmentTimeline::addElement(stime_t d, uint64_t r, stime_t t)
+void SegmentTimeline::addElement(uint64_t number, stime_t d, uint64_t r, stime_t t)
 {
-    Element *element = new (std::nothrow) Element(d, r, t);
+    Element *element = new (std::nothrow) Element(number, d, r, t);
     if(element)
     {
         if(!elements.empty() && !t)
@@ -203,8 +203,9 @@ mtime_t SegmentTimeline::end() const
     return scaled  * CLOCK_FREQ / inheritTimescale();
 }
 
-SegmentTimeline::Element::Element(stime_t d_, uint64_t r_, stime_t t_)
+SegmentTimeline::Element::Element(uint64_t number_, stime_t d_, uint64_t r_, stime_t t_)
 {
+    number = number_;
     d = d_;
     t = t_;
     r = r_;
diff --git a/modules/demux/adaptative/playlist/SegmentTimeline.h b/modules/demux/adaptative/playlist/SegmentTimeline.h
index 4b5a60f..dbb67be 100644
--- a/modules/demux/adaptative/playlist/SegmentTimeline.h
+++ b/modules/demux/adaptative/playlist/SegmentTimeline.h
@@ -43,7 +43,7 @@ namespace adaptative
             public:
                 SegmentTimeline(TimescaleAble * = NULL);
                 virtual ~SegmentTimeline();
-                void addElement(stime_t d, uint64_t r = 0, stime_t t = 0);
+                void addElement(uint64_t, stime_t d, uint64_t r = 0, stime_t t = 0);
                 uint64_t getElementNumberByScaledPlaybackTime(stime_t) const;
                 stime_t getScaledPlaybackTimeByElementNumber(uint64_t) const;
                 size_t maxElementNumber() const;
@@ -59,10 +59,11 @@ namespace adaptative
                 class Element
                 {
                     public:
-                        Element(stime_t, uint64_t, stime_t);
+                        Element(uint64_t, stime_t, uint64_t, stime_t);
                         stime_t  t;
                         stime_t  d;
                         uint64_t r;
+                        uint64_t number;
                 };
         };
     }
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 6ba2653..9733def 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -428,6 +428,10 @@ void IsoffMainParser::parseTimeline(Node *node, MediaSegmentTemplate *templ)
     if(!node)
         return;
 
+    uint64_t number = 0;
+    if(node->hasAttribute("startNumber"))
+        number = Integer<uint64_t>(node->getAttributeValue("startNumber"));
+
     SegmentTimeline *timeline = new (std::nothrow) SegmentTimeline(templ);
     if(timeline)
     {
@@ -442,12 +446,15 @@ void IsoffMainParser::parseTimeline(Node *node, MediaSegmentTemplate *templ)
             uint64_t r = 0; // never repeats by default
             if(s->hasAttribute("r"))
                 r = Integer<uint64_t>(s->getAttributeValue("r"));
+
             if(s->hasAttribute("t"))
             {
                 stime_t t = Integer<stime_t>(s->getAttributeValue("t"));
-                timeline->addElement(d, r, t);
+                timeline->addElement(number, d, r, t);
             }
-            else timeline->addElement(d, r);
+            else timeline->addElement(number, d, r);
+
+            number += (1 + r);
 
             templ->segmentTimeline.Set(timeline);
         }



More information about the vlc-commits mailing list