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

demux: adaptative: add segment comparison

parent e8a7895c
......@@ -112,6 +112,26 @@ bool ISegment::contains(size_t byte) const
(!endByte || byte <= endByte) );
}
int ISegment::compare(ISegment *other) const
{
if(startTime.Get() != VLC_TS_INVALID)
{
int64_t diff = startTime.Get() - other->startTime.Get();
if(diff)
return diff / diff;
}
size_t diff = startByte - other->startByte;
if(diff)
return diff / diff;
diff = endByte - other->endByte;
if(diff)
return diff / diff;
return 0;
}
int ISegment::getClassId() const
{
return classId;
......
......@@ -58,6 +58,7 @@ namespace adaptative
virtual void addSubSegment (SubSegment *) = 0;
virtual void debug (vlc_object_t *,int = 0) const;
virtual bool contains (size_t byte) const;
virtual int compare (ISegment *) const;
int getClassId () const;
Property<mtime_t> startTime;
Property<mtime_t> duration;
......
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