Commit f6f45bce authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptative: split segments using interface

parent 381b34a5
......@@ -215,7 +215,7 @@ IndexSegment::IndexSegment(ICanonicalUrl *parent) :
classId = CLASSID_INDEXSEGMENT;
}
SubSegment::SubSegment(Segment *main, size_t start, size_t end) :
SubSegment::SubSegment(ISegment *main, size_t start, size_t end) :
ISegment(main), parent(main)
{
setByteRange(start, end);
......@@ -234,3 +234,8 @@ std::vector<ISegment*> SubSegment::subSegments()
list.push_back(this);
return list;
}
void SubSegment::addSubSegment(SubSegment *)
{
}
......@@ -55,6 +55,7 @@ namespace adaptative
virtual void setByteRange (size_t start, size_t end);
virtual size_t getOffset () const;
virtual std::vector<ISegment*> subSegments () = 0;
virtual void addSubSegment (SubSegment *) = 0;
virtual std::string toString (int = 0) const;
virtual bool contains (size_t byte) const;
int getClassId () const;
......@@ -121,12 +122,13 @@ namespace adaptative
class SubSegment : public ISegment
{
public:
SubSegment(Segment *, size_t start, size_t end);
SubSegment(ISegment *, size_t start, size_t end);
virtual Url getUrlSegment() const; /* impl */
virtual std::vector<ISegment*> subSegments();
virtual void addSubSegment(SubSegment *);
static const int CLASSID_SUBSEGMENT = 4;
private:
Segment *parent;
ISegment *parent;
};
}
}
......
......@@ -267,13 +267,13 @@ void SegmentInformation::setSegmentTemplate(MediaSegmentTemplate *templ)
mediaSegmentTemplate = templ;
}
static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start,
static void insertIntoSegment(std::vector<ISegment *> &seglist, size_t start,
size_t end, mtime_t time)
{
std::vector<Segment *>::iterator segIt;
std::vector<ISegment *>::iterator segIt;
for(segIt = seglist.begin(); segIt < seglist.end(); ++segIt)
{
Segment *segment = *segIt;
ISegment *segment = *segIt;
if(segment->getClassId() == Segment::CLASSID_SEGMENT &&
segment->contains(end + segment->getOffset()))
{
......@@ -289,7 +289,7 @@ static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start,
void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
{
std::vector<Segment *> seglist = segmentList->getSegments();
std::vector<ISegment *> seglist = getSegments(INFOTYPE_MEDIA);
std::vector<SplitPoint>::const_iterator splitIt;
size_t start = 0, end = 0;
mtime_t time = 0;
......
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