Commit a64f24a7 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: provide playlist duration range for updates

parent b5ac100f
...@@ -130,6 +130,13 @@ void AbstractPlaylist::getTimeLinesBoundaries(mtime_t *min, mtime_t *max) const ...@@ -130,6 +130,13 @@ void AbstractPlaylist::getTimeLinesBoundaries(mtime_t *min, mtime_t *max) const
} }
} }
void AbstractPlaylist::getPlaylistDurationsRange(mtime_t *min, mtime_t *max) const
{
*min = *max = 0;
for(size_t i = 0; i < periods.size(); i++)
periods.at(i)->getDurationsRange(min, max);
}
void AbstractPlaylist::mergeWith(AbstractPlaylist *updatedAbstractPlaylist, mtime_t prunebarrier) void AbstractPlaylist::mergeWith(AbstractPlaylist *updatedAbstractPlaylist, mtime_t prunebarrier)
{ {
availabilityEndTime.Set(updatedAbstractPlaylist->availabilityEndTime.Get()); availabilityEndTime.Set(updatedAbstractPlaylist->availabilityEndTime.Get());
......
...@@ -55,6 +55,7 @@ namespace adaptative ...@@ -55,6 +55,7 @@ namespace adaptative
void mergeWith(AbstractPlaylist *, mtime_t = 0); void mergeWith(AbstractPlaylist *, mtime_t = 0);
void getTimeLinesBoundaries(mtime_t *, mtime_t *) const; void getTimeLinesBoundaries(mtime_t *, mtime_t *) const;
void getPlaylistDurationsRange(mtime_t *, mtime_t *) const;
Property<time_t> duration; Property<time_t> duration;
Property<time_t> playbackStart; Property<time_t> playbackStart;
......
...@@ -251,6 +251,31 @@ void SegmentInformation::collectTimelines(std::vector<SegmentTimeline *> *timeli ...@@ -251,6 +251,31 @@ void SegmentInformation::collectTimelines(std::vector<SegmentTimeline *> *timeli
(*it)->collectTimelines(timelines); (*it)->collectTimelines(timelines);
} }
void SegmentInformation::getDurationsRange(mtime_t *min, mtime_t *max) const
{
/* FIXME: cache stuff in segment holders */
std::vector<ISegment *> seglist = getSegments(INFOTYPE_MEDIA);
std::vector<ISegment *>::const_iterator it;
mtime_t total = 0;
for(it = seglist.begin(); it != seglist.end(); ++it)
{
const mtime_t duration = (*it)->duration.Get();
if(duration)
{
total += duration;
if (!*min || duration < *min)
*min = duration;
}
}
if(total > *max)
*max = total;
for(size_t i=0; i<childs.size(); i++)
childs.at(i)->getDurationsRange(min, max);
}
void SegmentInformation::mergeWith(SegmentInformation *updated, mtime_t prunetime) void SegmentInformation::mergeWith(SegmentInformation *updated, mtime_t prunetime)
{ {
/* Support Segment List for now */ /* Support Segment List for now */
......
...@@ -78,6 +78,7 @@ namespace adaptative ...@@ -78,6 +78,7 @@ namespace adaptative
bool getSegmentNumberByTime(mtime_t, uint64_t *) const; bool getSegmentNumberByTime(mtime_t, uint64_t *) const;
mtime_t getPlaybackTimeBySegmentNumber(uint64_t) const; mtime_t getPlaybackTimeBySegmentNumber(uint64_t) const;
void collectTimelines(std::vector<SegmentTimeline *> *) const; void collectTimelines(std::vector<SegmentTimeline *> *) const;
void getDurationsRange(mtime_t *, mtime_t *) const;
virtual void mergeWith(SegmentInformation *, mtime_t); virtual void mergeWith(SegmentInformation *, mtime_t);
protected: protected:
......
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