[vlc-commits] demux: adaptative: add timeline seeking

Francois Cartegnie git at videolan.org
Tue Oct 27 19:13:52 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 23 19:14:26 2015 +0200| [3a01d97a0b6ba55f4f1b73a925c3a614311d8b10] | committer: Francois Cartegnie

demux: adaptative: add timeline seeking

Timeline was only supposed for live usage

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3a01d97a0b6ba55f4f1b73a925c3a614311d8b10
---

 modules/demux/adaptative/playlist/SegmentInformation.cpp |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/demux/adaptative/playlist/SegmentInformation.cpp b/modules/demux/adaptative/playlist/SegmentInformation.cpp
index 0aaf18c..3515d14 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.cpp
@@ -230,6 +230,15 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
     if( mediaSegmentTemplate )
     {
         const uint64_t timescale = mediaSegmentTemplate->inheritTimescale();
+
+        SegmentTimeline *timeline = mediaSegmentTemplate->segmentTimeline.Get();
+        if(timeline)
+        {
+            time = time * timescale / CLOCK_FREQ;
+            *ret = timeline->getElementNumberByScaledPlaybackTime(time);
+            return true;
+        }
+
         const mtime_t duration = mediaSegmentTemplate->duration.Get();
         *ret = mediaSegmentTemplate->startNumber.Get();
         if(duration)



More information about the vlc-commits mailing list