[vlc-commits] stream_filter: dash: add segment start time

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:52 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec  1 17:36:47 2014 +0100| [737a297d3d84ae8ef73c5d89e11ded8869133b54] | committer: Francois Cartegnie

stream_filter: dash: add segment start time

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

 modules/stream_filter/dash/mpd/Representation.cpp |    9 ++++++---
 modules/stream_filter/dash/mpd/Segment.cpp        |   15 ++++++++++++++-
 modules/stream_filter/dash/mpd/Segment.h          |    3 +++
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/Representation.cpp b/modules/stream_filter/dash/mpd/Representation.cpp
index cda86dc..ffbe46c 100644
--- a/modules/stream_filter/dash/mpd/Representation.cpp
+++ b/modules/stream_filter/dash/mpd/Representation.cpp
@@ -231,7 +231,7 @@ MPD * Representation::getMPD() const
 }
 
 static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start,
-                              size_t end)
+                              size_t end, mtime_t time)
 {
     std::vector<Segment *>::iterator segIt;
     for(segIt = seglist.begin(); segIt < seglist.end(); segIt++)
@@ -244,6 +244,7 @@ static void insertIntoSegment(std::vector<Segment *> &seglist, size_t start,
                                                     start + segment->getOffset(),
                                                     end + segment->getOffset());
             segment->addSubSegment(subsegment);
+            segment->setStartTime(time);
             break;
         }
     }
@@ -254,6 +255,7 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
     std::vector<Segment *> seglist = segmentList->getSegments();
     std::vector<SplitPoint>::const_iterator splitIt;
     size_t start = 0, end = 0;
+    mtime_t time = 0;
 
     for(splitIt = splitlist.begin(); splitIt < splitlist.end(); splitIt++)
     {
@@ -262,7 +264,8 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
         end = split.offset;
         if(splitIt == splitlist.begin() && split.offset == 0)
             continue;
-        insertIntoSegment(seglist, start, end);
+        time = split.time;
+        insertIntoSegment(seglist, start, end, time);
         end++;
     }
 
@@ -270,6 +273,6 @@ void Representation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
     {
         start = end;
         end = 0;
-        insertIntoSegment(seglist, start, end);
+        insertIntoSegment(seglist, start, end, time);
     }
 }
diff --git a/modules/stream_filter/dash/mpd/Segment.cpp b/modules/stream_filter/dash/mpd/Segment.cpp
index 0397c11..4557dae 100644
--- a/modules/stream_filter/dash/mpd/Segment.cpp
+++ b/modules/stream_filter/dash/mpd/Segment.cpp
@@ -25,6 +25,8 @@
 # include "config.h"
 #endif
 
+#define __STDC_CONSTANT_MACROS
+
 #include "Segment.h"
 #include "Representation.h"
 #include "MPD.h"
@@ -38,7 +40,8 @@ using namespace dash::http;
 ISegment::ISegment(const ICanonicalUrl *parent):
     ICanonicalUrl( parent ),
     startByte  (0),
-    endByte    (0)
+    endByte    (0),
+    startTime  (VLC_TS_INVALID)
 {
     debugName = "Segment";
     classId = CLASSID_ISEGMENT;
@@ -81,6 +84,16 @@ void ISegment::setByteRange(size_t start, size_t end)
     endByte   = end;
 }
 
+void ISegment::setStartTime(mtime_t ztime)
+{
+    startTime = ztime;
+}
+
+mtime_t ISegment::getStartTime() const
+{
+    return startTime;
+}
+
 size_t ISegment::getOffset() const
 {
     return startByte;
diff --git a/modules/stream_filter/dash/mpd/Segment.h b/modules/stream_filter/dash/mpd/Segment.h
index 4e09c5d..ae77ace 100644
--- a/modules/stream_filter/dash/mpd/Segment.h
+++ b/modules/stream_filter/dash/mpd/Segment.h
@@ -53,6 +53,8 @@ namespace dash
                 virtual void                            done            ();
                 virtual dash::http::Chunk*              toChunk         ();
                 virtual void                            setByteRange    (size_t start, size_t end);
+                virtual void                            setStartTime    (mtime_t ztime);
+                virtual mtime_t                         getStartTime    () const;
                 virtual size_t                          getOffset       () const;
                 virtual std::vector<ISegment*>          subSegments     () = 0;
                 virtual std::string                     toString        () const;
@@ -65,6 +67,7 @@ namespace dash
             protected:
                 size_t                  startByte;
                 size_t                  endByte;
+                mtime_t                 startTime;
                 std::string             debugName;
                 int                     classId;
 



More information about the vlc-commits mailing list