]> git.sesse.net Git - vlc/commitdiff
demux: dash: add UniqueNess template
authorFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 8 Jan 2015 16:42:31 +0000 (17:42 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 12 Jan 2015 19:21:57 +0000 (20:21 +0100)
modules/demux/dash/mpd/Representation.cpp
modules/demux/dash/mpd/Representation.h
modules/demux/dash/mpd/SegmentInfoCommon.h

index 61aa8f12fe17b4603e61688ff88304680b411e3e..6a6e48198f88a17473e7a40462f6d08c3d13f47d 100644 (file)
@@ -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;
index 0fadfc83b3ec3782c502a518e13785ff53a43586..20aa3d18b23ecb61de4190647928d1cb47817737 100644 (file)
@@ -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;
index 742940fa0de719de1d7e41cd4f6fa51b12873b68..9c37aed28e6ae4da6a21ab070f6d530ef1aa7621 100644 (file)
@@ -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>
         {