]> git.sesse.net Git - vlc/commitdiff
demux: dash: add timescale inheritance to timeline
authorFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 12 Jan 2015 14:59:08 +0000 (15:59 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 12 Jan 2015 19:21:57 +0000 (20:21 +0100)
modules/demux/dash/mpd/IsoffMainParser.cpp
modules/demux/dash/mpd/IsoffMainParser.h
modules/demux/dash/mpd/SegmentTimeline.cpp
modules/demux/dash/mpd/SegmentTimeline.h

index 5a120790328db575a290570dc12935dd4f8a8e01..51b2fc2e4068c9f11690a2b9279a7c69f757213c 100644 (file)
@@ -353,12 +353,12 @@ void IsoffMainParser::parseInitSegment(Node *initNode, Initializable<Segment> *i
     init->initialisationSegment.Set(seg);
 }
 
-void IsoffMainParser::parseTimeline(Node *node, Timelineable *timelineable)
+void IsoffMainParser::parseTimeline(Node *node, MediaSegmentTemplate *templ)
 {
     if(!node)
         return;
 
-    SegmentTimeline *timeline = new (std::nothrow) SegmentTimeline();
+    SegmentTimeline *timeline = new (std::nothrow) SegmentTimeline(templ);
     if(timeline)
     {
         std::vector<Node *> elements = DOMHelper::getElementByTagName(node, "S", false);
@@ -379,7 +379,7 @@ void IsoffMainParser::parseTimeline(Node *node, Timelineable *timelineable)
             }
             else timeline->addElement(d, r);
 
-            timelineable->segmentTimeline.Set(timeline);
+            templ->segmentTimeline.Set(timeline);
         }
     }
 }
index 0891b37a1f8e70c316f860f951f2414963c7ef1b..4323ce8893e24e5811894e2a275bee3a059c5239 100644 (file)
@@ -54,7 +54,7 @@ namespace dash
                 void    setAdaptationSets   (dash::xml::Node *periodNode, Period *period);
                 void    setRepresentations  (dash::xml::Node *adaptationSetNode, AdaptationSet *adaptationSet);
                 void    parseInitSegment    (dash::xml::Node *, Initializable<Segment> *);
-                void    parseTimeline       (dash::xml::Node *, Timelineable *);
+                void    parseTimeline       (dash::xml::Node *, MediaSegmentTemplate *);
                 void    parsePeriods        (dash::xml::Node *);
                 size_t  parseSegmentInformation(dash::xml::Node *, SegmentInformation *);
                 void    parseSegmentBase    (dash::xml::Node *, SegmentInformation *);
index e67cae0cfec00dd57f4b4ca0209117969d245d2a..7078bf80d8a5fc99ca2c9ddbd116d05a6f828032 100644 (file)
@@ -29,7 +29,8 @@
 
 using namespace dash::mpd;
 
-SegmentTimeline::SegmentTimeline()
+SegmentTimeline::SegmentTimeline(TimescaleAble *parent)
+    :TimescaleAble(parent)
 {
     pruned = 0;
 }
@@ -108,8 +109,9 @@ mtime_t SegmentTimeline::getScaledPlaybackTimeByElementNumber(uint64_t number) c
     return totalscaledtime;
 }
 
-size_t SegmentTimeline::prune(mtime_t scaled)
+size_t SegmentTimeline::prune(mtime_t time)
 {
+    mtime_t scaled = time * inheritTimescale() / CLOCK_FREQ;
     size_t prunednow = 0;
     while(elements.size())
     {
index 3d40c18764fcf6fa02ada7e1dd8317e405ee02c2..1ffa1750d8c642d054a7afc4f5aa050651b20c29 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef SEGMENTTIMELINE_H
 #define SEGMENTTIMELINE_H
 
+#include "SegmentInfoCommon.h"
 #include <vlc_common.h>
 #include <list>
 
@@ -31,12 +32,12 @@ namespace dash
 {
     namespace mpd
     {
-        class SegmentTimeline
+        class SegmentTimeline : public TimescaleAble
         {
             class Element;
 
             public:
-                SegmentTimeline();
+                SegmentTimeline(TimescaleAble * = NULL);
                 virtual ~SegmentTimeline();
                 void addElement(mtime_t d, uint64_t r = 0, mtime_t t = 0);
                 uint64_t getElementNumberByScaledPlaybackTime(time_t) const;