Commit 3872f3b2 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: flag template segments

parent 52457046
......@@ -48,6 +48,7 @@ ISegment::ISegment(const ICanonicalUrl *parent):
duration.Set(0);
chunksuse.Set(0);
sequence = SEQUENCE_INVALID;
templated = false;
}
ISegment::~ISegment()
......@@ -90,6 +91,11 @@ SegmentChunk* ISegment::toChunk(size_t index, BaseRepresentation *ctxrep)
return chunk;
}
bool ISegment::isTemplate() const
{
return templated;
}
void ISegment::setByteRange(size_t start, size_t end)
{
startByte = start;
......
......@@ -57,6 +57,7 @@ namespace adaptative
virtual void setByteRange (size_t start, size_t end);
virtual void setSequenceNumber(uint64_t);
virtual uint64_t getSequenceNumber() const;
virtual bool isTemplate () const;
virtual size_t getOffset () const;
virtual std::vector<ISegment*> subSegments () = 0;
virtual void addSubSegment (SubSegment *) = 0;
......@@ -77,6 +78,7 @@ namespace adaptative
size_t endByte;
std::string debugName;
int classId;
bool templated;
uint64_t sequence;
static const int SEQUENCE_INVALID;
static const int SEQUENCE_FIRST;
......
......@@ -159,11 +159,10 @@ ISegment * SegmentInformation::getSegment(SegmentInfoType type, uint64_t pos) co
const size_t size = getSegments( type, retSegments );
if( size )
{
/* check if that's a template (fixme: find a better way) */
MediaSegmentTemplate *templ;
if( size == 1 && (templ = dynamic_cast<MediaSegmentTemplate*>(retSegments[0])) )
if(size == 1 && retSegments[0]->isTemplate())
{
if(templ->segmentTimeline.Get() == NULL ||
MediaSegmentTemplate *templ = dynamic_cast<MediaSegmentTemplate*>(retSegments[0]);
if(!templ || templ->segmentTimeline.Get() == NULL ||
templ->segmentTimeline.Get()->maxElementNumber() > pos)
return templ;
}
......
......@@ -43,6 +43,7 @@ MediaSegmentTemplate::MediaSegmentTemplate( SegmentInformation *parent ) :
classId = Segment::CLASSID_SEGMENT;
startNumber.Set( 1 );
initialisationSegment.Set( NULL );
templated = true;
}
void MediaSegmentTemplate::mergeWith(MediaSegmentTemplate *updated, mtime_t prunebarrier)
......
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