[vlc-commits] demux: adaptive: remove segment classid
Francois Cartegnie
git at videolan.org
Tue Jan 5 20:25:38 UTC 2021
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 31 13:31:00 2020 +0100| [1f07df28663123ddd757ffa7df146b41ce152f3d] | committer: Francois Cartegnie
demux: adaptive: remove segment classid
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1f07df28663123ddd757ffa7df146b41ce152f3d
---
modules/demux/adaptive/playlist/Segment.cpp | 10 --------
modules/demux/adaptive/playlist/Segment.h | 8 ------
.../demux/adaptive/playlist/SegmentInformation.cpp | 30 ++++++++--------------
.../demux/adaptive/playlist/SegmentTemplate.cpp | 2 --
4 files changed, 10 insertions(+), 40 deletions(-)
diff --git a/modules/demux/adaptive/playlist/Segment.cpp b/modules/demux/adaptive/playlist/Segment.cpp
index ef023a875b..76480be3f1 100644
--- a/modules/demux/adaptive/playlist/Segment.cpp
+++ b/modules/demux/adaptive/playlist/Segment.cpp
@@ -45,7 +45,6 @@ ISegment::ISegment(const ICanonicalUrl *parent):
endByte (0)
{
debugName = "Segment";
- classId = CLASSID_ISEGMENT;
startTime.Set(0);
duration.Set(0);
sequence = 0;
@@ -182,16 +181,10 @@ void ISegment::setEncryption(CommonEncryption &e)
encryption = e;
}
-int ISegment::getClassId() const
-{
- return classId;
-}
-
Segment::Segment(ICanonicalUrl *parent) :
ISegment(parent)
{
size = -1;
- classId = CLASSID_SEGMENT;
}
SegmentChunk* Segment::createChunk(AbstractChunkSource *source, BaseRepresentation *rep)
@@ -265,14 +258,12 @@ InitSegment::InitSegment(ICanonicalUrl *parent) :
Segment(parent)
{
debugName = "InitSegment";
- classId = CLASSID_INITSEGMENT;
}
IndexSegment::IndexSegment(ICanonicalUrl *parent) :
Segment(parent)
{
debugName = "IndexSegment";
- classId = CLASSID_INDEXSEGMENT;
}
SubSegment::SubSegment(Segment *main, size_t start, size_t end) :
@@ -280,7 +271,6 @@ SubSegment::SubSegment(Segment *main, size_t start, size_t end) :
{
setByteRange(start, end);
debugName = "SubSegment";
- classId = CLASSID_SUBSEGMENT;
}
diff --git a/modules/demux/adaptive/playlist/Segment.h b/modules/demux/adaptive/playlist/Segment.h
index 29843d67d3..0e4c94dc1d 100644
--- a/modules/demux/adaptive/playlist/Segment.h
+++ b/modules/demux/adaptive/playlist/Segment.h
@@ -75,13 +75,10 @@ namespace adaptive
virtual bool contains (size_t byte) const;
virtual int compare (ISegment *) const;
void setEncryption (CommonEncryption &);
- int getClassId () const;
Property<stime_t> startTime;
Property<stime_t> duration;
bool discontinuity;
- static const int CLASSID_ISEGMENT = 0;
-
protected:
virtual bool prepareChunk (SharedResources *,
SegmentChunk *,
@@ -90,7 +87,6 @@ namespace adaptive
size_t startByte;
size_t endByte;
std::string debugName;
- int classId;
bool templated;
uint64_t sequence;
};
@@ -106,7 +102,6 @@ namespace adaptive
virtual const std::vector<Segment*> & subSegments() const;
virtual void debug(vlc_object_t *,int = 0) const;
virtual void addSubSegment(SubSegment *);
- static const int CLASSID_SEGMENT = 1;
protected:
std::vector<Segment *> subsegments;
@@ -118,21 +113,18 @@ namespace adaptive
{
public:
InitSegment( ICanonicalUrl *parent );
- static const int CLASSID_INITSEGMENT = 2;
};
class IndexSegment : public Segment
{
public:
IndexSegment( ICanonicalUrl *parent );
- static const int CLASSID_INDEXSEGMENT = 3;
};
class SubSegment : public Segment
{
public:
SubSegment(Segment *, size_t start, size_t end);
- static const int CLASSID_SUBSEGMENT = 4;
};
}
}
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index c111fc5138..60c5aa26b4 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -251,34 +251,24 @@ void SegmentInformation::setSegmentTemplate(SegmentTemplate *templ)
}
}
-static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start,
+static void insertIntoSegment(Segment *container, size_t start,
size_t end, stime_t time, stime_t duration)
{
- std::vector<Segment *>::iterator segIt;
- for(segIt = seglist.begin(); segIt < seglist.end(); ++segIt)
+ if(end == 0 || container->contains(end))
{
- Segment *segment = *segIt;
- if(segment->getClassId() == Segment::CLASSID_SEGMENT &&
- (end == 0 || segment->contains(end)))
- {
- SubSegment *subsegment = new SubSegment(segment, start, (end != 0) ? end : 0);
- subsegment->startTime.Set(time);
- subsegment->duration.Set(duration);
- segment->addSubSegment(subsegment);
- break;
- }
+ SubSegment *subsegment = new SubSegment(container, start, (end != 0) ? end : 0);
+ subsegment->startTime.Set(time);
+ subsegment->duration.Set(duration);
+ container->addSubSegment(subsegment);
}
}
void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
{
- SegmentBase *segmentBase = inheritSegmentBase();
+ Segment *segmentBase = inheritSegmentBase();
if(!segmentBase)
return;
- std::vector<Segment *> seglist;
- seglist.push_back( segmentBase );
-
size_t prevstart = 0;
stime_t prevtime = 0;
@@ -290,7 +280,7 @@ void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
if(splitIt != splitlist.begin())
{
/* do previous splitpoint */
- insertIntoSegment(seglist, prevstart, split.offset - 1, prevtime, split.duration);
+ insertIntoSegment(segmentBase, prevstart, split.offset - 1, prevtime, split.duration);
}
prevstart = split.offset;
prevtime = split.time;
@@ -298,11 +288,11 @@ void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
if(splitlist.size() == 1)
{
- insertIntoSegment(seglist, prevstart, 0, prevtime, split.duration);
+ insertIntoSegment(segmentBase, prevstart, 0, prevtime, split.duration);
}
else if(splitlist.size() > 1)
{
- insertIntoSegment(seglist, prevstart, split.offset - 1, prevtime, split.duration);
+ insertIntoSegment(segmentBase, prevstart, split.offset - 1, prevtime, split.duration);
}
}
diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.cpp b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
index daf8bbc2a2..17ec39c280 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
@@ -36,7 +36,6 @@ SegmentTemplateSegment::SegmentTemplateSegment( SegmentTemplate *templ_,
Segment( parent )
{
debugName = "SegmentTemplateSegment";
- classId = Segment::CLASSID_SEGMENT;
templated = true;
templ = templ_;
}
@@ -274,7 +273,6 @@ SegmentTemplateInit::SegmentTemplateInit( SegmentTemplate *templ_,
InitSegment(parent)
{
debugName = "InitSegmentTemplate";
- classId = InitSegment::CLASSID_INITSEGMENT;
templ = templ_;
}
More information about the vlc-commits
mailing list