[vlc-commits] dash: Basic CM parser: Parse some Representation attributes

Hugo Beauzée-Luyssen git at videolan.org
Fri Dec 30 18:15:29 CET 2011


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Dec 21 23:31:21 2011 +0100| [3dab8a807627d9ba9274e4e6b12a54d599e9d44f] | committer: Jean-Baptiste Kempf

dash: Basic CM parser: Parse some Representation attributes

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

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

 modules/stream_filter/dash/mpd/BasicCMParser.cpp |   24 ++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index 3fa36b6..33bdd5f 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -106,6 +106,30 @@ void    BasicCMParser::setRepresentations   (Node *root, Group *group)
             delete rep;
             continue ;
         }
+        std::map<std::string, std::string>::const_iterator  it;
+
+        it = attributes.find( "id" );
+        if ( it == attributes.end() )
+        {
+            std::cerr << "Missing mandatory attribute for Representation: @id" << std::endl;
+            delete rep;
+            continue ;
+        }
+        rep->setId( it->second );
+
+        it = attributes.find( "bandwidth" );
+        if ( it == attributes.end() )
+        {
+            std::cerr << "Missing mandatory attribute for Representation: @bandwidth" << std::endl;
+            delete rep;
+            continue ;
+        }
+        rep->setBandwidth( atoi( it->second.c_str() ) );
+
+        it = attributes.find( "qualityRanking" );
+        if ( it != attributes.end() )
+            rep->setQualityRanking( atoi( it->second.c_str() ) );
+
         this->setSegmentInfo(representations.at(i), rep);
         if ( rep->getSegmentInfo() && rep->getSegmentInfo()->getSegments().size() > 0 )
             group->addRepresentation(rep);



More information about the vlc-commits mailing list