[vlc-commits] dash: Cleaning Period class.

Hugo Beauzée-Luyssen git at videolan.org
Fri Jan 6 12:40:38 CET 2012


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Jan  5 14:53:09 2012 +0100| [98a01d40722a080842a7e85b2a657bd946a7ea14] | committer: Jean-Baptiste Kempf

dash: Cleaning Period class.

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

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

 modules/stream_filter/dash/mpd/BasicCMParser.cpp |    2 +-
 modules/stream_filter/dash/mpd/Period.cpp        |   19 ++++++++++++-------
 modules/stream_filter/dash/mpd/Period.h          |   11 +++--------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index 708b577..7590f1d 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -157,7 +157,7 @@ void    BasicCMParser::setPeriods           (Node *root)
 
     for(size_t i = 0; i < periods.size(); i++)
     {
-        Period *period = new Period(periods.at(i)->getAttributes());
+        Period *period = new Period();
         this->setGroups(periods.at(i), period);
         this->mpd->addPeriod(period);
     }
diff --git a/modules/stream_filter/dash/mpd/Period.cpp b/modules/stream_filter/dash/mpd/Period.cpp
index 98b2c74..6d94474 100644
--- a/modules/stream_filter/dash/mpd/Period.cpp
+++ b/modules/stream_filter/dash/mpd/Period.cpp
@@ -21,29 +21,34 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 #include "Period.h"
 
+#include <vlc_common.h>
+#include <vlc_arrays.h>
+
 using namespace dash::mpd;
 
-Period::Period  (std::map<std::string, std::string> attributes)
+Period::Period()
 {
-    this->attributes = attributes;
 }
+
 Period::~Period ()
 {
-    for(size_t i = 0; i < this->groups.size(); i++)
-        delete(this->groups.at(i));
+    vlc_delete_all( this->groups );
 }
 
-std::vector<Group*> Period::getGroups   ()
+const std::vector<Group*>&      Period::getGroups() const
 {
     return this->groups;
 }
-void                Period::addGroup    (Group *group)
+
+void                Period::addGroup(Group *group)
 {
-    this->groups.push_back(group);
+    if ( group != NULL )
+        this->groups.push_back(group);
 }
diff --git a/modules/stream_filter/dash/mpd/Period.h b/modules/stream_filter/dash/mpd/Period.h
index d019bc4..469f1f1 100644
--- a/modules/stream_filter/dash/mpd/Period.h
+++ b/modules/stream_filter/dash/mpd/Period.h
@@ -26,10 +26,8 @@
 
 #include <vector>
 #include <string>
-#include <map>
 
 #include "mpd/Group.h"
-#include "mpd/Representation.h"
 
 namespace dash
 {
@@ -38,17 +36,14 @@ namespace dash
         class Period
         {
             public:
-                Period          (std::map<std::string, std::string> attributes);
+                Period();
                 virtual ~Period ();
 
-                std::vector<Group *>    getGroups   ();
-                void                    addGroup    (Group *group);
+                const std::vector<Group *>&     getGroups() const;
+                void                            addGroup( Group *group );
 
             private:
-                std::map<std::string, std::string>  attributes;
                 std::vector<Group *>                groups;
-
-
         };
     }
 }



More information about the vlc-commits mailing list