[vlc-commits] demux: adaptative: flag template segments
Francois Cartegnie
git at videolan.org
Wed Sep 23 21:15:08 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 23 17:48:28 2015 +0200| [3872f3b2f35d681e89db6b6c7dac02355682971b] | committer: Francois Cartegnie
demux: adaptative: flag template segments
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3872f3b2f35d681e89db6b6c7dac02355682971b
---
modules/demux/adaptative/playlist/Segment.cpp | 6 ++++++
modules/demux/adaptative/playlist/Segment.h | 2 ++
modules/demux/adaptative/playlist/SegmentInformation.cpp | 7 +++----
modules/demux/adaptative/playlist/SegmentTemplate.cpp | 1 +
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp
index 88b16a1..64f2dc8 100644
--- a/modules/demux/adaptative/playlist/Segment.cpp
+++ b/modules/demux/adaptative/playlist/Segment.cpp
@@ -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;
diff --git a/modules/demux/adaptative/playlist/Segment.h b/modules/demux/adaptative/playlist/Segment.h
index 2b0e1f6..7ba7619 100644
--- a/modules/demux/adaptative/playlist/Segment.h
+++ b/modules/demux/adaptative/playlist/Segment.h
@@ -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;
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.cpp b/modules/demux/adaptative/playlist/SegmentInformation.cpp
index 11f8831..485b87c 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.cpp
@@ -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;
}
diff --git a/modules/demux/adaptative/playlist/SegmentTemplate.cpp b/modules/demux/adaptative/playlist/SegmentTemplate.cpp
index 210e873..52b2a31 100644
--- a/modules/demux/adaptative/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptative/playlist/SegmentTemplate.cpp
@@ -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)
More information about the vlc-commits
mailing list