[vlc-commits] demux: adaptative: provide playlist duration range for updates
Francois Cartegnie
git at videolan.org
Wed Jun 10 18:58:03 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 27 22:00:36 2015 +0200| [a64f24a7c904af4bbe448845aa0260db4f0482a5] | committer: Francois Cartegnie
demux: adaptative: provide playlist duration range for updates
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a64f24a7c904af4bbe448845aa0260db4f0482a5
---
.../demux/adaptative/playlist/AbstractPlaylist.cpp | 7 ++++++
.../demux/adaptative/playlist/AbstractPlaylist.hpp | 1 +
.../adaptative/playlist/SegmentInformation.cpp | 25 ++++++++++++++++++++
.../adaptative/playlist/SegmentInformation.hpp | 1 +
4 files changed, 34 insertions(+)
diff --git a/modules/demux/adaptative/playlist/AbstractPlaylist.cpp b/modules/demux/adaptative/playlist/AbstractPlaylist.cpp
index ae0ca9e..5030a8f 100644
--- a/modules/demux/adaptative/playlist/AbstractPlaylist.cpp
+++ b/modules/demux/adaptative/playlist/AbstractPlaylist.cpp
@@ -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)
{
availabilityEndTime.Set(updatedAbstractPlaylist->availabilityEndTime.Get());
diff --git a/modules/demux/adaptative/playlist/AbstractPlaylist.hpp b/modules/demux/adaptative/playlist/AbstractPlaylist.hpp
index 2b96efe..b80621e 100644
--- a/modules/demux/adaptative/playlist/AbstractPlaylist.hpp
+++ b/modules/demux/adaptative/playlist/AbstractPlaylist.hpp
@@ -55,6 +55,7 @@ namespace adaptative
void mergeWith(AbstractPlaylist *, mtime_t = 0);
void getTimeLinesBoundaries(mtime_t *, mtime_t *) const;
+ void getPlaylistDurationsRange(mtime_t *, mtime_t *) const;
Property<time_t> duration;
Property<time_t> playbackStart;
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.cpp b/modules/demux/adaptative/playlist/SegmentInformation.cpp
index 0a5da37..5eb5b6b 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.cpp
@@ -251,6 +251,31 @@ void SegmentInformation::collectTimelines(std::vector<SegmentTimeline *> *timeli
(*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)
{
/* Support Segment List for now */
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.hpp b/modules/demux/adaptative/playlist/SegmentInformation.hpp
index ea7ba25..ff43980 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.hpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.hpp
@@ -78,6 +78,7 @@ namespace adaptative
bool getSegmentNumberByTime(mtime_t, uint64_t *) const;
mtime_t getPlaybackTimeBySegmentNumber(uint64_t) const;
void collectTimelines(std::vector<SegmentTimeline *> *) const;
+ void getDurationsRange(mtime_t *, mtime_t *) const;
virtual void mergeWith(SegmentInformation *, mtime_t);
protected:
More information about the vlc-commits
mailing list