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

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


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

dash: Basic CM parser: Parse some Representation attributes

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

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

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

 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