Commit 737a297d authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: add segment start time

parent 6dd2798f
...@@ -231,7 +231,7 @@ MPD * Representation::getMPD() const ...@@ -231,7 +231,7 @@ MPD * Representation::getMPD() const
} }
static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start, static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start,
size_t end) size_t end, mtime_t time)
{ {
std::vector<Segment *>::iterator segIt; std::vector<Segment *>::iterator segIt;
for(segIt = seglist.begin(); segIt < seglist.end(); segIt++) for(segIt = seglist.begin(); segIt < seglist.end(); segIt++)
...@@ -244,6 +244,7 @@ static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start, ...@@ -244,6 +244,7 @@ static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start,
start + segment->getOffset(), start + segment->getOffset(),
end + segment->getOffset()); end + segment->getOffset());
segment->addSubSegment(subsegment); segment->addSubSegment(subsegment);
segment->setStartTime(time);
break; break;
} }
} }
...@@ -254,6 +255,7 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist) ...@@ -254,6 +255,7 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
std::vector<Segment *> seglist = segmentList->getSegments(); std::vector<Segment *> seglist = segmentList->getSegments();
std::vector<SplitPoint>::const_iterator splitIt; std::vector<SplitPoint>::const_iterator splitIt;
size_t start = 0, end = 0; size_t start = 0, end = 0;
mtime_t time = 0;
for(splitIt = splitlist.begin(); splitIt < splitlist.end(); splitIt++) for(splitIt = splitlist.begin(); splitIt < splitlist.end(); splitIt++)
{ {
...@@ -262,7 +264,8 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist) ...@@ -262,7 +264,8 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
end = split.offset; end = split.offset;
if(splitIt == splitlist.begin() && split.offset == 0) if(splitIt == splitlist.begin() && split.offset == 0)
continue; continue;
insertIntoSegment(seglist, start, end); time = split.time;
insertIntoSegment(seglist, start, end, time);
end++; end++;
} }
...@@ -270,6 +273,6 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist) ...@@ -270,6 +273,6 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
{ {
start = end; start = end;
end = 0; end = 0;
insertIntoSegment(seglist, start, end); insertIntoSegment(seglist, start, end, time);
} }
} }
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
# include "config.h" # include "config.h"
#endif #endif
#define __STDC_CONSTANT_MACROS
#include "Segment.h" #include "Segment.h"
#include "Representation.h" #include "Representation.h"
#include "MPD.h" #include "MPD.h"
...@@ -38,7 +40,8 @@ using namespace dash::http; ...@@ -38,7 +40,8 @@ using namespace dash::http;
ISegment::ISegment(const ICanonicalUrl *parent): ISegment::ISegment(const ICanonicalUrl *parent):
ICanonicalUrl( parent ), ICanonicalUrl( parent ),
startByte (0), startByte (0),
endByte (0) endByte (0),
startTime (VLC_TS_INVALID)
{ {
debugName = "Segment"; debugName = "Segment";
classId = CLASSID_ISEGMENT; classId = CLASSID_ISEGMENT;
...@@ -81,6 +84,16 @@ void ISegment::setByteRange(size_t start, size_t end) ...@@ -81,6 +84,16 @@ void ISegment::setByteRange(size_t start, size_t end)
endByte = end; endByte = end;
} }
void ISegment::setStartTime(mtime_t ztime)
{
startTime = ztime;
}
mtime_t ISegment::getStartTime() const
{
return startTime;
}
size_t ISegment::getOffset() const size_t ISegment::getOffset() const
{ {
return startByte; return startByte;
......
...@@ -53,6 +53,8 @@ namespace dash ...@@ -53,6 +53,8 @@ namespace dash
virtual void done (); virtual void done ();
virtual dash::http::Chunk* toChunk (); virtual dash::http::Chunk* toChunk ();
virtual void setByteRange (size_t start, size_t end); virtual void setByteRange (size_t start, size_t end);
virtual void setStartTime (mtime_t ztime);
virtual mtime_t getStartTime () const;
virtual size_t getOffset () const; virtual size_t getOffset () const;
virtual std::vector<ISegment*> subSegments () = 0; virtual std::vector<ISegment*> subSegments () = 0;
virtual std::string toString () const; virtual std::string toString () const;
...@@ -65,6 +67,7 @@ namespace dash ...@@ -65,6 +67,7 @@ namespace dash
protected: protected:
size_t startByte; size_t startByte;
size_t endByte; size_t endByte;
mtime_t startTime;
std::string debugName; std::string debugName;
int classId; int classId;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment