[vlc-commits] stream_filter: dash: handle segments through interface

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Nov 23 20:18:23 2014 +0100| [58e9be2a3a43d9533c0c0b04b02b250dc95cbf4c] | committer: Francois Cartegnie

stream_filter: dash: handle segments through interface

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

 .../adaptationlogic/AlwaysBestAdaptationLogic.cpp  |    4 +-
 .../adaptationlogic/AlwaysBestAdaptationLogic.h    |    2 +-
 .../adaptationlogic/RateBasedAdaptationLogic.cpp   |    4 +-
 modules/stream_filter/dash/mpd/Representation.cpp  |   46 ++++++++++++--------
 modules/stream_filter/dash/mpd/Representation.h    |    2 +-
 5 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
index c35ea2b..6fe3a5d 100644
--- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
@@ -75,8 +75,8 @@ void    AlwaysBestAdaptationLogic::initSchedule ()
             Representation *best = selector.select(*it);
             if(best)
             {
-                std::vector<Segment *> segments = best->getSegments();
-                std::vector<Segment *>::const_iterator segIt;
+                std::vector<ISegment *> segments = best->getSegments();
+                std::vector<ISegment *>::const_iterator segIt;
                 for(segIt=segments.begin(); segIt!=segments.end(); segIt++)
                 {
                     schedule.push_back(*segIt);
diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
index 7fb9a23..b72b8dc 100644
--- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
+++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
@@ -48,7 +48,7 @@ namespace dash
                 const mpd::Representation *getCurrentRepresentation() const;
 
             private:
-                std::vector<mpd::Segment *>         schedule;
+                std::vector<mpd::ISegment *>        schedule;
                 dash::mpd::MPDManager              *mpdManager;
                 size_t                              count;
                 dash::mpd::Representation           *bestRepresentation;
diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
index 3543250..5e6c61b 100644
--- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
+++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
@@ -52,7 +52,7 @@ Chunk*  RateBasedAdaptationLogic::getNextChunk()
     if (!rep)
         return NULL;
 
-    std::vector<Segment *> segments = rep->getSegments();
+    std::vector<ISegment *> segments = rep->getSegments();
 
     if ( this->count == segments.size() )
     {
@@ -63,7 +63,7 @@ Chunk*  RateBasedAdaptationLogic::getNextChunk()
 
     if ( segments.size() > this->count )
     {
-        Segment *seg = segments.at( this->count );
+        ISegment *seg = segments.at( this->count );
         Chunk *chunk = seg->toChunk();
         //In case of UrlTemplate, we must stay on the same segment.
         if ( seg->isSingleShot() == true )
diff --git a/modules/stream_filter/dash/mpd/Representation.cpp b/modules/stream_filter/dash/mpd/Representation.cpp
index 8567b7b..93e077e 100644
--- a/modules/stream_filter/dash/mpd/Representation.cpp
+++ b/modules/stream_filter/dash/mpd/Representation.cpp
@@ -131,28 +131,42 @@ void Representation::addDependency(const Representation *dep)
         this->dependencies.push_back( dep );
 }
 
-std::vector<Segment *> Representation::getSegments() const
+std::vector<ISegment *> Representation::getSegments() const
 {
-    std::vector<Segment *>  retSegments;
+    std::vector<ISegment *>  retSegments;
 
     if ( segmentInfo )
     {
+        /* init segments are always single segment */
         retSegments.push_back( segmentInfo->getInitialisationSegment() );
 
         if ( !segmentInfo->getSegments().empty() )
-            retSegments.insert( retSegments.end(),
-                                segmentInfo->getSegments().begin(),
-                                segmentInfo->getSegments().end() );
+        {
+            std::vector<Segment *>::const_iterator it;
+            for(it=segmentInfo->getSegments().begin();
+                it!=segmentInfo->getSegments().end(); it++)
+            {
+                std::vector<ISegment *> list = (*it)->subSegments();
+                retSegments.insert( retSegments.end(), list.begin(), list.end() );
+            }
+        }
     }
     else
     {
+        /* init segments are always single segment */
         if( segmentBase && segmentBase->getInitSegment() )
             retSegments.push_back( segmentBase->getInitSegment() );
 
-        if ( segmentList )
-            retSegments.insert( retSegments.end(),
-                                segmentList->getSegments().begin(),
-                                segmentList->getSegments().end() );
+        if ( segmentList && !segmentList->getSegments().empty() )
+        {
+            std::vector<Segment *>::const_iterator it;
+            for(it=segmentList->getSegments().begin();
+                it!=segmentList->getSegments().end(); it++)
+            {
+                std::vector<ISegment *> list = (*it)->subSegments();
+                retSegments.insert( retSegments.end(), list.begin(), list.end() );
+            }
+        }
     }
 
     return retSegments;
@@ -194,17 +208,11 @@ std::vector<std::string> Representation::toString() const
 {
     std::vector<std::string> ret;
     ret.push_back(std::string("  Representation"));
-    std::vector<Segment *> list = getSegments();
-    std::vector<Segment *>::const_iterator l;
+    std::vector<ISegment *> list = getSegments();
+    std::vector<ISegment *>::const_iterator l;
     for(l = list.begin(); l < list.end(); l++)
-    {
-        if ((*l)->isInit())
-            ret.push_back(std::string("    InitSeg url=")
-                          .append((*l)->getUrlSegment()));
-        else
-            ret.push_back(std::string("    Segment url=")
-                          .append((*l)->getUrlSegment()));
-    }
+        ret.push_back((*l)->toString());
+
     return ret;
 }
 
diff --git a/modules/stream_filter/dash/mpd/Representation.h b/modules/stream_filter/dash/mpd/Representation.h
index d5525d4..7a09714 100644
--- a/modules/stream_filter/dash/mpd/Representation.h
+++ b/modules/stream_filter/dash/mpd/Representation.h
@@ -76,7 +76,7 @@ namespace dash
                 const AdaptationSet*        getParentGroup() const;
                 void                setParentGroup( const AdaptationSet *group );
 
-                std::vector<Segment*> getSegments           ()const;
+                std::vector<ISegment*> getSegments          ()const;
                 void                setSegmentList          (SegmentList *list);
                 void                setSegmentBase          (SegmentBase *base);
                 void                setWidth                (int width);



More information about the vlc-commits mailing list