[vlc-commits] demux: dash: add timescale inheritance to timeline
Francois Cartegnie
git at videolan.org
Mon Jan 12 20:22:09 CET 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jan 12 15:59:08 2015 +0100| [08bf5c8dccef0ab3661ca8a072bc1fb73c122a02] | committer: Francois Cartegnie
demux: dash: add timescale inheritance to timeline
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=08bf5c8dccef0ab3661ca8a072bc1fb73c122a02
---
modules/demux/dash/mpd/IsoffMainParser.cpp | 6 +++---
modules/demux/dash/mpd/IsoffMainParser.h | 2 +-
modules/demux/dash/mpd/SegmentTimeline.cpp | 6 ++++--
modules/demux/dash/mpd/SegmentTimeline.h | 5 +++--
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 5a12079..51b2fc2 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -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);
}
}
}
diff --git a/modules/demux/dash/mpd/IsoffMainParser.h b/modules/demux/dash/mpd/IsoffMainParser.h
index 0891b37..4323ce8 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.h
+++ b/modules/demux/dash/mpd/IsoffMainParser.h
@@ -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 *);
diff --git a/modules/demux/dash/mpd/SegmentTimeline.cpp b/modules/demux/dash/mpd/SegmentTimeline.cpp
index e67cae0..7078bf8 100644
--- a/modules/demux/dash/mpd/SegmentTimeline.cpp
+++ b/modules/demux/dash/mpd/SegmentTimeline.cpp
@@ -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())
{
diff --git a/modules/demux/dash/mpd/SegmentTimeline.h b/modules/demux/dash/mpd/SegmentTimeline.h
index 3d40c18..1ffa175 100644
--- a/modules/demux/dash/mpd/SegmentTimeline.h
+++ b/modules/demux/dash/mpd/SegmentTimeline.h
@@ -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;
More information about the vlc-commits
mailing list