[vlc-commits] demux: dash: add timelines gathering

Francois Cartegnie git at videolan.org
Mon Jan 12 20:22:08 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jan 10 21:21:55 2015 +0100| [ec5b75bad05def5121da5a71af7544a596050eea] | committer: Francois Cartegnie

demux: dash: add timelines gathering

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

 modules/demux/dash/mpd/AdaptationSet.cpp      |    2 ++
 modules/demux/dash/mpd/Period.cpp             |    4 ++++
 modules/demux/dash/mpd/SegmentInformation.cpp |   10 ++++++++++
 modules/demux/dash/mpd/SegmentInformation.hpp |    3 +++
 4 files changed, 19 insertions(+)

diff --git a/modules/demux/dash/mpd/AdaptationSet.cpp b/modules/demux/dash/mpd/AdaptationSet.cpp
index 5aa8135..785a84c 100644
--- a/modules/demux/dash/mpd/AdaptationSet.cpp
+++ b/modules/demux/dash/mpd/AdaptationSet.cpp
@@ -46,6 +46,7 @@ AdaptationSet::AdaptationSet(Period *period) :
 AdaptationSet::~AdaptationSet   ()
 {
     vlc_delete_all( this->representations );
+    childs.clear();
 }
 
 const std::string& AdaptationSet::getMimeType() const
@@ -88,6 +89,7 @@ const Representation *AdaptationSet::getRepresentationById(const std::string &id
 void                            AdaptationSet::addRepresentation        (Representation *rep)
 {
     this->representations.push_back(rep);
+    childs.push_back(rep);
 }
 
 
diff --git a/modules/demux/dash/mpd/Period.cpp b/modules/demux/dash/mpd/Period.cpp
index 607f3d0..904107b 100644
--- a/modules/demux/dash/mpd/Period.cpp
+++ b/modules/demux/dash/mpd/Period.cpp
@@ -44,6 +44,7 @@ Period::Period(MPD *mpd) :
 Period::~Period ()
 {
     vlc_delete_all( this->adaptationSets );
+    childs.clear();
 }
 
 const std::vector<AdaptationSet*>&  Period::getAdaptationSets() const
@@ -66,7 +67,10 @@ const std::vector<AdaptationSet*>   Period::getAdaptationSets(Streams::Type type
 void                                Period::addAdaptationSet(AdaptationSet *adaptationSet)
 {
     if ( adaptationSet != NULL )
+    {
         this->adaptationSets.push_back(adaptationSet);
+        childs.push_back(adaptationSet);
+    }
 }
 
 AdaptationSet * Period::getAdaptationSet(Streams::Type type) const
diff --git a/modules/demux/dash/mpd/SegmentInformation.cpp b/modules/demux/dash/mpd/SegmentInformation.cpp
index fc80959..680b1af 100644
--- a/modules/demux/dash/mpd/SegmentInformation.cpp
+++ b/modules/demux/dash/mpd/SegmentInformation.cpp
@@ -219,6 +219,16 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
     return time;
 }
 
+void SegmentInformation::collectTimelines(std::vector<SegmentTimeline *> *timelines) const
+{
+    if(mediaSegmentTemplate && mediaSegmentTemplate->segmentTimeline.Get())
+        timelines->push_back(mediaSegmentTemplate->segmentTimeline.Get());
+
+    std::vector<SegmentInformation *>::const_iterator it;
+    for(it = childs.begin(); it != childs.end(); it++)
+        (*it)->collectTimelines(timelines);
+}
+
 bool SegmentInformation::canBitswitch() const
 {
     if(bitswitch_policy == BITSWITCH_INHERIT)
diff --git a/modules/demux/dash/mpd/SegmentInformation.hpp b/modules/demux/dash/mpd/SegmentInformation.hpp
index f099645..ef0de5b 100644
--- a/modules/demux/dash/mpd/SegmentInformation.hpp
+++ b/modules/demux/dash/mpd/SegmentInformation.hpp
@@ -39,6 +39,7 @@ namespace dash
         class SegmentBase;
         class SegmentList;
         class SegmentTemplate;
+        class SegmentTimeline;
 
         /* common segment elements for period/adaptset/rep 5.3.9.1,
          * with properties inheritance */
@@ -73,10 +74,12 @@ namespace dash
                 ISegment * getSegment(SegmentInfoType, uint64_t = 0) const;
                 bool getSegmentNumberByTime(mtime_t, uint64_t *) const;
                 mtime_t getPlaybackTimeBySegmentNumber(uint64_t) const;
+                void collectTimelines(std::vector<SegmentTimeline *> *) const;
 
             protected:
                 std::vector<ISegment *> getSegments() const;
                 std::vector<ISegment *> getSegments(SegmentInfoType) const;
+                std::vector<SegmentInformation *> childs;
 
             private:
                 void setSegmentList(SegmentList *);



More information about the vlc-commits mailing list