[vlc-commits] dash: Handling Group @subsegmentAlignmentFlag in parser.

Hugo Beauzée-Luyssen git at videolan.org
Tue Jan 24 23:21:56 CET 2012


vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Dec 29 10:55:31 2011 +0100| [18e70595f65640a48b3dd70486f8297fdb48cded] | committer: Jean-Baptiste Kempf

dash: Handling Group @subsegmentAlignmentFlag in parser.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 203307197dce5e750462d19bbf734dd010ee6ff2)

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

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=18e70595f65640a48b3dd70486f8297fdb48cded
---

 modules/stream_filter/dash/mpd/BasicCMParser.cpp |    6 +++++-
 modules/stream_filter/dash/mpd/Group.cpp         |   14 ++++++++------
 modules/stream_filter/dash/mpd/Group.h           |   11 ++++++-----
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index acafcb2..3c9bacd 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -149,12 +149,16 @@ void    BasicCMParser::setGroups            (Node *root, Period *period)
 
     for(size_t i = 0; i < groups.size(); i++)
     {
-        Group *group = new Group(groups.at(i)->getAttributes());
+        const std::map<std::string, std::string>    attr = groups.at(i)->getAttributes();
+        Group *group = new Group();
         if ( this->parseCommonAttributesElements( groups.at( i ), group, NULL ) == false )
         {
             delete group;
             continue ;
         }
+        std::map<std::string, std::string>::const_iterator  it = attr.find( "subsegmentAlignmentFlag" );
+        if ( it != attr.end() && it->second == "true" )
+            group->setSubsegmentAlignmentFlag( true ); //Otherwise it is false by default.
         this->setRepresentations(groups.at(i), group);
         period->addGroup(group);
     }
diff --git a/modules/stream_filter/dash/mpd/Group.cpp b/modules/stream_filter/dash/mpd/Group.cpp
index f8158f6..e090afb 100644
--- a/modules/stream_filter/dash/mpd/Group.cpp
+++ b/modules/stream_filter/dash/mpd/Group.cpp
@@ -30,8 +30,8 @@
 using namespace dash::mpd;
 using namespace dash::exception;
 
-Group::Group    ( const std::map<std::string, std::string>&  attributes) :
-    attributes( attributes )
+Group::Group() :
+    subsegmentAlignmentFlag( false )
 {
 }
 
@@ -40,12 +40,14 @@ Group::~Group   ()
     vlc_delete_all( this->representations );
 }
 
-std::string                     Group::getSubSegmentAlignment   () throw(AttributeNotPresentException)
+bool                Group::getSubsegmentAlignmentFlag() const
 {
-    if(this->attributes.find("subsegmentAlignmentFlag") == this->attributes.end())
-        throw AttributeNotPresentException();
+    return this->subsegmentAlignmentFlag;
+}
 
-    return this->attributes["subsegmentAlignmentFlag"];
+void Group::setSubsegmentAlignmentFlag(bool alignment)
+{
+    this->subsegmentAlignmentFlag = alignment;
 }
 
 std::vector<Representation*>    Group::getRepresentations       ()
diff --git a/modules/stream_filter/dash/mpd/Group.h b/modules/stream_filter/dash/mpd/Group.h
index 124eff6..602b443 100644
--- a/modules/stream_filter/dash/mpd/Group.h
+++ b/modules/stream_filter/dash/mpd/Group.h
@@ -40,17 +40,18 @@ namespace dash
         class Group : public CommonAttributesElements
         {
             public:
-                Group           (const std::map<std::string, std::string>&  attributes);
-                virtual ~Group  ();
+                Group();
+                virtual ~Group();
 
-                std::string                     getSubSegmentAlignment  () throw(dash::exception::AttributeNotPresentException);
+                bool                            getSubsegmentAlignmentFlag() const;
+                void                            setSubsegmentAlignmentFlag( bool alignment );
                 std::vector<Representation *>   getRepresentations      ();
                 const Representation*           getRepresentationById   ( const std::string &id ) const;
 
-                void addRepresentation      (Representation *rep);
+                void addRepresentation( Representation *rep );
 
             private:
-                std::map<std::string, std::string>  attributes;
+                bool                                subsegmentAlignmentFlag;
                 std::vector<Representation *>       representations;
         };
     }



More information about the vlc-commits mailing list