[vlc-commits] demux: adaptative: inherit playlist

Francois Cartegnie git at videolan.org
Wed Jun 10 18:58:01 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 19 17:53:28 2015 +0200| [4603cb4a27fb0046f86aeac661eb0198cf7154a9] | committer: Francois Cartegnie

demux: adaptative: inherit playlist

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

 modules/demux/adaptative/playlist/BasePeriod.cpp         |   10 ++++++++--
 modules/demux/adaptative/playlist/BasePeriod.h           |    2 ++
 modules/demux/adaptative/playlist/BaseRepresentation.cpp |    8 +-------
 modules/demux/adaptative/playlist/BaseRepresentation.h   |    5 +----
 modules/demux/adaptative/playlist/SegmentInformation.cpp |    8 ++++++++
 modules/demux/adaptative/playlist/SegmentInformation.hpp |    3 ++-
 modules/demux/dash/mpd/IsoffMainParser.cpp               |    2 +-
 modules/demux/dash/mpd/Representation.cpp                |    5 ++---
 modules/demux/dash/mpd/Representation.h                  |    3 +--
 9 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/modules/demux/adaptative/playlist/BasePeriod.cpp b/modules/demux/adaptative/playlist/BasePeriod.cpp
index e88d682..18486e9 100644
--- a/modules/demux/adaptative/playlist/BasePeriod.cpp
+++ b/modules/demux/adaptative/playlist/BasePeriod.cpp
@@ -35,12 +35,13 @@
 
 using namespace adaptative::playlist;
 
-BasePeriod::BasePeriod(AbstractPlaylist *playlist) :
-    SegmentInformation( playlist )
+BasePeriod::BasePeriod(AbstractPlaylist *playlist_) :
+    SegmentInformation( playlist_ )
 {
     duration.Set(0);
     startTime.Set(0);
     baseUrl.Set(NULL);
+    playlist = playlist_;
 }
 
 BasePeriod::~BasePeriod ()
@@ -50,6 +51,11 @@ BasePeriod::~BasePeriod ()
     childs.clear();
 }
 
+AbstractPlaylist *BasePeriod::getPlaylist() const
+{
+    return playlist;
+}
+
 const std::vector<BaseAdaptationSet*>&  BasePeriod::getAdaptationSets() const
 {
     return adaptationSets;
diff --git a/modules/demux/adaptative/playlist/BasePeriod.h b/modules/demux/adaptative/playlist/BasePeriod.h
index fd97920..606cc4a 100644
--- a/modules/demux/adaptative/playlist/BasePeriod.h
+++ b/modules/demux/adaptative/playlist/BasePeriod.h
@@ -48,12 +48,14 @@ namespace adaptative
                 void                                debug               (vlc_object_t *,int = 0) const;
 
                 virtual mtime_t getPeriodStart() const; /* reimpl */
+                virtual AbstractPlaylist *getPlaylist() const; /* reimpl */
 
                 Property<mtime_t> duration;
                 Property<mtime_t> startTime;
 
             private:
                 std::vector<BaseAdaptationSet *>    adaptationSets;
+                AbstractPlaylist *playlist;
         };
     }
 }
diff --git a/modules/demux/adaptative/playlist/BaseRepresentation.cpp b/modules/demux/adaptative/playlist/BaseRepresentation.cpp
index 0cab1a7..cdc9f03 100644
--- a/modules/demux/adaptative/playlist/BaseRepresentation.cpp
+++ b/modules/demux/adaptative/playlist/BaseRepresentation.cpp
@@ -33,9 +33,8 @@
 
 using namespace adaptative::playlist;
 
-BaseRepresentation::BaseRepresentation( BaseAdaptationSet *set, AbstractPlaylist *playlist_ ) :
+BaseRepresentation::BaseRepresentation( BaseAdaptationSet *set ) :
                 SegmentInformation( set ),
-                playlist        ( playlist_ ),
                 adaptationSet   ( set ),
                 bandwidth       (0)
 {
@@ -66,11 +65,6 @@ void BaseRepresentation::debug(vlc_object_t *obj, int indent) const
         (*l)->debug(obj, indent + 1);
 }
 
-AbstractPlaylist * BaseRepresentation::getPlaylist() const
-{
-    return playlist;
-}
-
 std::string BaseRepresentation::contextualize(size_t, const std::string &component,
                                               const BaseSegmentTemplate *) const
 {
diff --git a/modules/demux/adaptative/playlist/BaseRepresentation.h b/modules/demux/adaptative/playlist/BaseRepresentation.h
index daf70e2..819e250 100644
--- a/modules/demux/adaptative/playlist/BaseRepresentation.h
+++ b/modules/demux/adaptative/playlist/BaseRepresentation.h
@@ -42,7 +42,7 @@ namespace adaptative
                                    public SegmentInformation
         {
             public:
-                BaseRepresentation( BaseAdaptationSet *, AbstractPlaylist *playlist );
+                BaseRepresentation( BaseAdaptationSet * );
                 virtual ~BaseRepresentation ();
 
                 /*
@@ -54,8 +54,6 @@ namespace adaptative
                 uint64_t            getBandwidth            () const;
                 void                setBandwidth            ( uint64_t bandwidth );
 
-                AbstractPlaylist*   getPlaylist             () const;
-
                 void                debug                   (vlc_object_t *,int = 0) const;
 
                 /* for segment templates */
@@ -63,7 +61,6 @@ namespace adaptative
                                                   const BaseSegmentTemplate *) const;
 
             protected:
-                AbstractPlaylist                   *playlist;
                 BaseAdaptationSet                  *adaptationSet;
                 uint64_t                            bandwidth;
         };
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.cpp b/modules/demux/adaptative/playlist/SegmentInformation.cpp
index e8b2ee8..9861aeb 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.cpp
@@ -61,6 +61,14 @@ SegmentInformation::~SegmentInformation()
     delete mediaSegmentTemplate;
 }
 
+AbstractPlaylist * SegmentInformation::getPlaylist() const
+{
+    if(parent)
+        return parent->getPlaylist();
+    else
+        return NULL;
+}
+
 vector<ISegment *> SegmentInformation::getSegments(SegmentInfoType type) const
 {
     vector<ISegment *> retSegments;
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.hpp b/modules/demux/adaptative/playlist/SegmentInformation.hpp
index ed51743..de0f27e 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.hpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.hpp
@@ -56,6 +56,7 @@ namespace adaptative
                 virtual ~SegmentInformation();
                 bool canBitswitch() const;
                 virtual mtime_t getPeriodStart() const;
+                virtual AbstractPlaylist *getPlaylist() const;
 
                 class SplitPoint
                 {
@@ -82,6 +83,7 @@ namespace adaptative
                 std::vector<ISegment *> getSegments() const;
                 std::vector<ISegment *> getSegments(SegmentInfoType) const;
                 std::vector<SegmentInformation *> childs;
+                SegmentInformation *parent;
 
             public:
                 void setSegmentList(SegmentList *);
@@ -97,7 +99,6 @@ namespace adaptative
                 SegmentList *     inheritSegmentList() const;
                 MediaSegmentTemplate * inheritSegmentTemplate() const;
 
-                SegmentInformation *parent;
                 SegmentBase     *segmentBase;
                 SegmentList     *segmentList;
                 MediaSegmentTemplate *mediaSegmentTemplate;
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index e419c3b..20a6301 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -228,7 +228,7 @@ void    IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
 
     for(size_t i = 0; i < representations.size(); i++)
     {
-        Representation *currentRepresentation = new Representation(adaptationSet, getMPD());
+        Representation *currentRepresentation = new Representation(adaptationSet);
         Node *repNode = representations.at(i);
 
         std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL");
diff --git a/modules/demux/dash/mpd/Representation.cpp b/modules/demux/dash/mpd/Representation.cpp
index 276cf12..35724e6 100644
--- a/modules/demux/dash/mpd/Representation.cpp
+++ b/modules/demux/dash/mpd/Representation.cpp
@@ -36,9 +36,8 @@
 
 using namespace dash::mpd;
 
-Representation::Representation  ( AdaptationSet *set, MPD *mpd_ ) :
-                BaseRepresentation( set, mpd_ ),
-                mpd             ( mpd_ ),
+Representation::Representation  ( AdaptationSet *set ) :
+                BaseRepresentation( set ),
                 qualityRanking  ( -1 ),
                 trickModeType   ( NULL )
 {
diff --git a/modules/demux/dash/mpd/Representation.h b/modules/demux/dash/mpd/Representation.h
index a0bb17d..f0fe553 100644
--- a/modules/demux/dash/mpd/Representation.h
+++ b/modules/demux/dash/mpd/Representation.h
@@ -44,7 +44,7 @@ namespace dash
                                public UniqueNess<Representation>
         {
             public:
-                Representation( AdaptationSet *, MPD *mpd );
+                Representation( AdaptationSet * );
                 virtual ~Representation ();
 
                 int                 getQualityRanking       () const;
@@ -65,7 +65,6 @@ namespace dash
                                                   const BaseSegmentTemplate *) const; // reimpl
 
             private:
-                MPD                                *mpd;
                 int                                 qualityRanking;
                 std::list<const Representation*>    dependencies;
                 TrickModeType                       *trickModeType;



More information about the vlc-commits mailing list