[vlc-commits] dash: Segments: Avoid copies + cosmetic.

Hugo Beauzée-Luyssen git at videolan.org
Mon Nov 28 20:24:32 CET 2011


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Nov 28 14:55:44 2011 +0100| [0290575bf9fcf61fe5a14695c2e2da9ae6cd2e0e] | committer: Jean-Baptiste Kempf

dash: Segments: Avoid copies + cosmetic.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_filter/dash/mpd/SegmentInfo.cpp |   12 ++++++++----
 modules/stream_filter/dash/mpd/SegmentInfo.h   |    4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/SegmentInfo.cpp b/modules/stream_filter/dash/mpd/SegmentInfo.cpp
index 703a54b..c7d7126 100644
--- a/modules/stream_filter/dash/mpd/SegmentInfo.cpp
+++ b/modules/stream_filter/dash/mpd/SegmentInfo.cpp
@@ -30,11 +30,12 @@
 using namespace dash::mpd;
 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   ()
 {
     for(size_t i = 0; i < this->segments.size(); i++)
@@ -50,14 +51,17 @@ InitSegment*            SegmentInfo::getInitSegment     () throw(ElementNotPrese
 
     return this->initSeg;
 }
-std::vector<Segment*>   SegmentInfo::getSegments        ()
+
+const std::vector<Segment*>&   SegmentInfo::getSegments        () const
 {
     return this->segments;
 }
+
 void                    SegmentInfo::addSegment         (Segment *seg)
 {
     this->segments.push_back(seg);
 }
+
 void                    SegmentInfo::setInitSegment     (InitSegment *initSeg)
 {
     this->initSeg = initSeg;
diff --git a/modules/stream_filter/dash/mpd/SegmentInfo.h b/modules/stream_filter/dash/mpd/SegmentInfo.h
index 43cce91..120ec14 100644
--- a/modules/stream_filter/dash/mpd/SegmentInfo.h
+++ b/modules/stream_filter/dash/mpd/SegmentInfo.h
@@ -40,11 +40,11 @@ namespace dash
         class SegmentInfo
         {
             public:
-                SegmentInfo             (std::map<std::string, std::string> attr);
+                SegmentInfo             ( const std::map<std::string, std::string>& attr);
                 virtual ~SegmentInfo    ();
 
                 InitSegment*            getInitSegment  () throw(dash::exception::ElementNotPresentException);
-                std::vector<Segment *>  getSegments     ();
+                const std::vector<Segment *>&   getSegments () const;
                 void                    setInitSegment  (InitSegment *initSeg);
                 void                    addSegment      (Segment *seg);
 



More information about the vlc-commits mailing list