Commit a3f53bb8 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Segments: Avoid copies + cosmetic.

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 0290575bf9fcf61fe5a14695c2e2da9ae6cd2e0e)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent f09fa82b
...@@ -30,11 +30,12 @@ ...@@ -30,11 +30,12 @@
using namespace dash::mpd; using namespace dash::mpd;
using namespace dash::exception; using namespace dash::exception;
SegmentInfo::SegmentInfo(std::map<std::string,std::string> attr) SegmentInfo::SegmentInfo( const std::map<std::string,std::string>& attr) :
attributes( attr ),
initSeg( NULL )
{ {
this->attributes = attr;
this->initSeg = NULL;
} }
SegmentInfo::~SegmentInfo () SegmentInfo::~SegmentInfo ()
{ {
for(size_t i = 0; i < this->segments.size(); i++) for(size_t i = 0; i < this->segments.size(); i++)
...@@ -50,14 +51,17 @@ InitSegment* SegmentInfo::getInitSegment () throw(ElementNotPrese ...@@ -50,14 +51,17 @@ InitSegment* SegmentInfo::getInitSegment () throw(ElementNotPrese
return this->initSeg; return this->initSeg;
} }
std::vector<Segment*> SegmentInfo::getSegments ()
const std::vector<Segment*>& SegmentInfo::getSegments () const
{ {
return this->segments; return this->segments;
} }
void SegmentInfo::addSegment (Segment *seg) void SegmentInfo::addSegment (Segment *seg)
{ {
this->segments.push_back(seg); this->segments.push_back(seg);
} }
void SegmentInfo::setInitSegment (InitSegment *initSeg) void SegmentInfo::setInitSegment (InitSegment *initSeg)
{ {
this->initSeg = initSeg; this->initSeg = initSeg;
......
...@@ -40,11 +40,11 @@ namespace dash ...@@ -40,11 +40,11 @@ namespace dash
class SegmentInfo class SegmentInfo
{ {
public: public:
SegmentInfo (std::map<std::string, std::string> attr); SegmentInfo ( const std::map<std::string, std::string>& attr);
virtual ~SegmentInfo (); virtual ~SegmentInfo ();
InitSegment* getInitSegment () throw(dash::exception::ElementNotPresentException); InitSegment* getInitSegment () throw(dash::exception::ElementNotPresentException);
std::vector<Segment *> getSegments (); const std::vector<Segment *>& getSegments () const;
void setInitSegment (InitSegment *initSeg); void setInitSegment (InitSegment *initSeg);
void addSegment (Segment *seg); void addSegment (Segment *seg);
......
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