[vlc-commits] demux: dash: add UniqueNess template

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan  8 17:42:31 2015 +0100| [ea06a8cd3c368973674e9af0648a9164e1779052] | committer: Francois Cartegnie

demux: dash: add UniqueNess template

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

 modules/demux/dash/mpd/Representation.cpp  |   11 -----------
 modules/demux/dash/mpd/Representation.h    |    6 ++----
 modules/demux/dash/mpd/SegmentInfoCommon.h |   15 +++++++++++++++
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/modules/demux/dash/mpd/Representation.cpp b/modules/demux/dash/mpd/Representation.cpp
index 61aa8f1..6a6e481 100644
--- a/modules/demux/dash/mpd/Representation.cpp
+++ b/modules/demux/dash/mpd/Representation.cpp
@@ -53,17 +53,6 @@ Representation::~Representation ()
     delete baseUrl;
 }
 
-const std::string&  Representation::getId                   () const
-{
-    return this->id;
-}
-
-void    Representation::setId(const std::string &id)
-{
-    if ( id.empty() == false )
-        this->id = id;
-}
-
 uint64_t     Representation::getBandwidth            () const
 {
     return this->bandwidth;
diff --git a/modules/demux/dash/mpd/Representation.h b/modules/demux/dash/mpd/Representation.h
index 0fadfc8..20aa3d1 100644
--- a/modules/demux/dash/mpd/Representation.h
+++ b/modules/demux/dash/mpd/Representation.h
@@ -42,14 +42,13 @@ namespace dash
         class MPD;
 
         class Representation : public CommonAttributesElements,
-                               public SegmentInformation
+                               public SegmentInformation,
+                               public UniqueNess<Representation>
         {
             public:
                 Representation( AdaptationSet *, MPD *mpd );
                 virtual ~Representation ();
 
-                const std::string&  getId                   () const;
-                void                setId                   ( const std::string &id );
                 /*
                  *  @return The bitrate required for this representation
                  *          in bits per seconds.
@@ -85,7 +84,6 @@ namespace dash
                 MPD                                *mpd;
                 AdaptationSet                      *adaptationSet;
                 uint64_t                            bandwidth;
-                std::string                         id;
                 int                                 qualityRanking;
                 std::list<const Representation*>    dependencies;
                 TrickModeType                       *trickModeType;
diff --git a/modules/demux/dash/mpd/SegmentInfoCommon.h b/modules/demux/dash/mpd/SegmentInfoCommon.h
index 742940f..9c37aed 100644
--- a/modules/demux/dash/mpd/SegmentInfoCommon.h
+++ b/modules/demux/dash/mpd/SegmentInfoCommon.h
@@ -60,6 +60,21 @@ namespace dash
                 Property<SegmentTimeline *> segmentTimeline;
         };
 
+        template<class T> class UniqueNess
+        {
+            public:
+                UniqueNess(){}
+                ~UniqueNess() {}
+                void setId(const std::string &id_) {id = id_;}
+                const std::string & getId() const {return id;}
+                bool sameAs(const T &other) const
+                {
+                    return (!id.empty() && id == other.id);
+                }
+            private:
+                std::string id;
+        };
+
         class SegmentInfoCommon : public ICanonicalUrl,
                                   public Initializable<Segment>
         {



More information about the vlc-commits mailing list