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

index cb8c7e072298c25dc9cdcc28e645b0394e8eba91..ce11efc0ea0bbf41d490262b6bd9e1570448f53e 100644 (file)
@@ -50,33 +50,36 @@ MPD::~MPD   ()
     delete(this->programInfo);
 }
 
-std::vector<Period*>    MPD::getPeriods             ()
+const std::vector<Period*>&    MPD::getPeriods             () const
 {
     return this->periods;
 }
-std::vector<BaseUrl*>   MPD::getBaseUrls            ()
+
+const std::vector<BaseUrl*>&   MPD::getBaseUrls            () const
 {
     return this->baseUrls;
 }
-std::string             MPD::getMinBufferTime       () throw(AttributeNotPresentException)
+
+const std::string&             MPD::getMinBufferTime       () const throw(AttributeNotPresentException)
 {
-    AttributesMap::iterator     it = this->attributes.find("minBufferTime");
+    AttributesMap::const_iterator     it = this->attributes.find("minBufferTime");
     if( it == this->attributes.end())
         throw AttributeNotPresentException();
 
     return it->second;
 }
-std::string             MPD::getType                () throw(AttributeNotPresentException)
+
+const std::string&             MPD::getType                () const throw(AttributeNotPresentException)
 {
-    AttributesMap::iterator     it = this->attributes.find( "type" );
+    AttributesMap::const_iterator     it = this->attributes.find( "type" );
     if( it == this->attributes.end() )
         throw AttributeNotPresentException();
 
     return it->second;
 }
-std::string             MPD::getDuration            () throw(AttributeNotPresentException)
+const std::string&             MPD::getDuration            () const throw(AttributeNotPresentException)
 {
-    AttributesMap::iterator     it = this->attributes.find("mediaPresentationDuration");
+    AttributesMap::const_iterator     it = this->attributes.find("mediaPresentationDuration");
 
     if( it == this->attributes.end())
         throw AttributeNotPresentException();
index 2942b182746da999115a3baa845ca973051e5ab2..bb2f1d19fe111dc0240f9ea5a7dd99eae8d99068 100644 (file)
@@ -48,11 +48,11 @@ namespace dash
                 MPD         ();
                 virtual ~MPD();
 
-                std::string             getType                 () throw(dash::exception::AttributeNotPresentException);
-                std::string             getDuration             () throw(dash::exception::AttributeNotPresentException);
-                std::string             getMinBufferTime        () throw(dash::exception::AttributeNotPresentException);
-                std::vector<BaseUrl *>  getBaseUrls             ();
-                std::vector<Period *>   getPeriods              ();
+                const std::string&             getType                 () const throw(dash::exception::AttributeNotPresentException);
+                const std::string&             getDuration             () const throw(dash::exception::AttributeNotPresentException);
+                const std::string&             getMinBufferTime        () const throw(dash::exception::AttributeNotPresentException);
+                const std::vector<BaseUrl *>&  getBaseUrls      () const;
+                const std::vector<Period *>&   getPeriods       () const;
                 ProgramInformation*     getProgramInformation   () throw(dash::exception::ElementNotPresentException);
 
                 void    addPeriod               (Period *period);