]> git.sesse.net Git - vlc/commitdiff
dash: Avoid some copies & useless initializations
authorHugo Beauzée-Luyssen <beauze.h@gmail.com>
Thu, 24 Nov 2011 11:23:11 +0000 (12:23 +0100)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 24 Nov 2011 17:03:40 +0000 (19:03 +0200)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
modules/stream_filter/dash/mpd/BasicCMManager.cpp
modules/stream_filter/dash/mpd/BasicCMManager.h
modules/stream_filter/dash/mpd/IMPDManager.h
modules/stream_filter/dash/mpd/NullManager.cpp
modules/stream_filter/dash/mpd/NullManager.h

index 7f224952dd9a35f610062ecdcbc52ba1cbdfeef4..5cd8b7afa4a032af948520c87f545693e26f4dca 100644 (file)
@@ -60,10 +60,11 @@ std::vector<ISegment*>  BasicCMManager::getSegments             (Representation
 
     return retSegments;
 }
-std::vector<Period*>    BasicCMManager::getPeriods              ()
+const std::vector<Period*>&    BasicCMManager::getPeriods              () const
 {
     return this->mpd->getPeriods();
 }
+
 Representation*         BasicCMManager::getBestRepresentation   (Period *period)
 {
     std::vector<Group *> groups = period->getGroups();
index 9c399c90064fc69065d40165767dc7acb6039403..ee8072ac93a409b9d282c42488d382e7bf251471 100644 (file)
@@ -51,7 +51,7 @@ namespace dash
                 BasicCMManager          (MPD *mpd);
                 virtual ~BasicCMManager ();
 
-                std::vector<Period *>   getPeriods              ();
+                const std::vector<Period *>&   getPeriods              () const;
                 Period*                 getFirstPeriod          ();
                 Period*                 getNextPeriod           (Period *period);
                 Representation*         getBestRepresentation   (Period *period);
index 1c2b5c75bcbc20b6ab35f1545b5e85a5dfd00962..c5a3e6eeb51956f55fc2909c309f21816f1dff2b 100644 (file)
@@ -26,7 +26,7 @@ namespace dash
         class IMPDManager
         {
             public:
-                virtual std::vector<Period *>   getPeriods              ()                              = 0;
+                virtual const std::vector<Period *>&   getPeriods              () const                 = 0;
                 virtual Period*                 getFirstPeriod          ()                              = 0;
                 virtual Period*                 getNextPeriod           (Period *period)                = 0;
                 virtual Representation*         getBestRepresentation   (Period *period)                = 0;
index ff1262ec452cac7cbffe382b3b59d5af32c7a68e..e7fa6ce0b6005f452eccd5b58bb8491614323288 100644 (file)
@@ -37,9 +37,9 @@ NullManager::~NullManager   ()
 {
 }
 
-std::vector<Period *>   NullManager::getPeriods              ()
+const std::vector<Period *>&   NullManager::getPeriods              () const
 {
-    return std::vector<Period *>();
+    return this->periods;
 }
 Period*                 NullManager::getFirstPeriod          ()
 {
@@ -55,7 +55,7 @@ Representation*         NullManager::getBestRepresentation   (Period *)
 }
 std::vector<ISegment *> NullManager::getSegments             (Representation *)
 {
-    return std::vector<ISegment *>();
+    return this->segments;
 }
 Representation*         NullManager::getRepresentation       (Period *, long )
 {
index fc17bfa14f85ac26c7da3c776b5b42368c3ef96b..361ef07d35091dc6bcacd939f6ced9c51e10f851 100644 (file)
@@ -42,12 +42,16 @@ namespace dash
                 NullManager         ();
                 virtual ~NullManager();
 
-                std::vector<Period *>   getPeriods              ();
+                const std::vector<Period *>&   getPeriods              () const;
                 Period*                 getFirstPeriod          ();
                 Period*                 getNextPeriod           (Period *period);
                 Representation*         getBestRepresentation   (Period *period);
                 std::vector<ISegment *> getSegments             (Representation *rep);
                 Representation*         getRepresentation       (Period *period, long bitrate);
+
+            private:
+                std::vector<Period *>   periods;
+                std::vector<ISegment *> segments;
         };
     }
 }