Commit 49e90877 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Rémi Denis-Courmont

dash: Avoid some copies & useless initializations

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 57ee2560
...@@ -60,10 +60,11 @@ std::vector<ISegment*> BasicCMManager::getSegments (Representation ...@@ -60,10 +60,11 @@ std::vector<ISegment*> BasicCMManager::getSegments (Representation
return retSegments; return retSegments;
} }
std::vector<Period*> BasicCMManager::getPeriods () const std::vector<Period*>& BasicCMManager::getPeriods () const
{ {
return this->mpd->getPeriods(); return this->mpd->getPeriods();
} }
Representation* BasicCMManager::getBestRepresentation (Period *period) Representation* BasicCMManager::getBestRepresentation (Period *period)
{ {
std::vector<Group *> groups = period->getGroups(); std::vector<Group *> groups = period->getGroups();
......
...@@ -51,7 +51,7 @@ namespace dash ...@@ -51,7 +51,7 @@ namespace dash
BasicCMManager (MPD *mpd); BasicCMManager (MPD *mpd);
virtual ~BasicCMManager (); virtual ~BasicCMManager ();
std::vector<Period *> getPeriods (); const std::vector<Period *>& getPeriods () const;
Period* getFirstPeriod (); Period* getFirstPeriod ();
Period* getNextPeriod (Period *period); Period* getNextPeriod (Period *period);
Representation* getBestRepresentation (Period *period); Representation* getBestRepresentation (Period *period);
......
...@@ -26,7 +26,7 @@ namespace dash ...@@ -26,7 +26,7 @@ namespace dash
class IMPDManager class IMPDManager
{ {
public: public:
virtual std::vector<Period *> getPeriods () = 0; virtual const std::vector<Period *>& getPeriods () const = 0;
virtual Period* getFirstPeriod () = 0; virtual Period* getFirstPeriod () = 0;
virtual Period* getNextPeriod (Period *period) = 0; virtual Period* getNextPeriod (Period *period) = 0;
virtual Representation* getBestRepresentation (Period *period) = 0; virtual Representation* getBestRepresentation (Period *period) = 0;
......
...@@ -37,9 +37,9 @@ NullManager::~NullManager () ...@@ -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 () Period* NullManager::getFirstPeriod ()
{ {
...@@ -55,7 +55,7 @@ Representation* NullManager::getBestRepresentation (Period *) ...@@ -55,7 +55,7 @@ Representation* NullManager::getBestRepresentation (Period *)
} }
std::vector<ISegment *> NullManager::getSegments (Representation *) std::vector<ISegment *> NullManager::getSegments (Representation *)
{ {
return std::vector<ISegment *>(); return this->segments;
} }
Representation* NullManager::getRepresentation (Period *, long ) Representation* NullManager::getRepresentation (Period *, long )
{ {
......
...@@ -42,12 +42,16 @@ namespace dash ...@@ -42,12 +42,16 @@ namespace dash
NullManager (); NullManager ();
virtual ~NullManager(); virtual ~NullManager();
std::vector<Period *> getPeriods (); const std::vector<Period *>& getPeriods () const;
Period* getFirstPeriod (); Period* getFirstPeriod ();
Period* getNextPeriod (Period *period); Period* getNextPeriod (Period *period);
Representation* getBestRepresentation (Period *period); Representation* getBestRepresentation (Period *period);
std::vector<ISegment *> getSegments (Representation *rep); std::vector<ISegment *> getSegments (Representation *rep);
Representation* getRepresentation (Period *period, long bitrate); Representation* getRepresentation (Period *period, long bitrate);
private:
std::vector<Period *> periods;
std::vector<ISegment *> segments;
}; };
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment