[vlc-commits] demux: dash: enable passive seek for templates as well

Francois Cartegnie git at videolan.org
Sat Jan 3 21:19:45 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jan  3 21:16:08 2015 +0100| [ca51f49a7326ad2e7d7b6f4f19a89635affebda0] | committer: Francois Cartegnie

demux: dash: enable passive seek for templates as well

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

 modules/demux/dash/mpd/SegmentInformation.cpp |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/modules/demux/dash/mpd/SegmentInformation.cpp b/modules/demux/dash/mpd/SegmentInformation.cpp
index 8bbc2d6..7b74359 100644
--- a/modules/demux/dash/mpd/SegmentInformation.cpp
+++ b/modules/demux/dash/mpd/SegmentInformation.cpp
@@ -159,15 +159,29 @@ ISegment * SegmentInformation::getSegment(SegmentInfoType type, uint64_t pos) co
 
 bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) const
 {
-    SegmentList *segList = inheritSegmentList();
-    if ( segList->getDuration() )
+    SegmentList *segList;
+    SegmentTemplate *segTemplate;
+    uint64_t timescale;
+    mtime_t duration = 0;
+    if ( (segList = inheritSegmentList()) )
+    {
+        timescale = segList->timescale.Get();
+        duration = segList->getDuration();
+    }
+    else if( (segTemplate = inheritSegmentTemplate(INFOTYPE_MEDIA)) )
+    {
+        timescale = segTemplate->timescale.Get();
+        duration = segTemplate->duration.Get();
+    }
+
+    if(duration)
     {
-        uint64_t timescale = segList->timescale.Get();
         if(!timescale)
-            timescale = getTimescale();
-        *ret = time / (CLOCK_FREQ * segList->getDuration() / timescale);
+            timescale = getTimescale(); /* inherit */
+        *ret = time / (CLOCK_FREQ * duration / timescale);
         return true;
     }
+
     return false;
 }
 



More information about the vlc-commits mailing list