[vlc-commits] dash: Rework profile handling.

Hugo Beauzée-Luyssen git at videolan.org
Wed May 30 12:08:23 CEST 2012


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue May 29 18:35:53 2012 +0200| [ea61bf32a5ecd79eaee01b668b7d7c13c8b98de2] | committer: Hugo Beauzée-Luyssen

dash: Rework profile handling.

Profile was parsed twice.

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

 modules/stream_filter/dash/mpd/BasicCMParser.cpp   |    6 ------
 modules/stream_filter/dash/mpd/IsoffMainParser.cpp |    4 ----
 modules/stream_filter/dash/mpd/MPD.cpp             |   12 ------------
 modules/stream_filter/dash/mpd/MPD.h               |    1 -
 modules/stream_filter/dash/mpd/MPDFactory.cpp      |    4 ++--
 modules/stream_filter/dash/xml/DOMParser.cpp       |    4 +++-
 6 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index 86c2fd1..c854ee2 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -75,12 +75,6 @@ bool    BasicCMParser::setMPD()
     this->mpd = new MPD;
 
     std::map<std::string, std::string>::const_iterator  it;
-    it = attr.find( "profile" );
-    if ( it == attr.end() )
-        it = attr.find( "profiles" ); //The standard spells it the two ways...
-    if ( it != attr.end() )
-        this->mpd->setProfile( it->second );
-
     it = attr.find("mediaPresentationDuration");
     /*
         Standard specifies a default of "On-Demand",
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index f2d5f20..5c930ef 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -62,10 +62,6 @@ void    IsoffMainParser::setMPDAttributes   ()
 
     std::map<std::string, std::string>::const_iterator it;
 
-    it = attr.find("profiles");
-    if(it != attr.end())
-        this->mpd->setProfile(it->second);
-
     it = attr.find("mediaPresentationDuration");
     if(it != attr.end())
         this->mpd->setDuration(str_duration(it->second.c_str()));
diff --git a/modules/stream_filter/dash/mpd/MPD.cpp b/modules/stream_filter/dash/mpd/MPD.cpp
index c28b0aa..04ee269 100644
--- a/modules/stream_filter/dash/mpd/MPD.cpp
+++ b/modules/stream_filter/dash/mpd/MPD.cpp
@@ -167,15 +167,3 @@ void MPD::setProfile(Profile profile)
 {
     this->profile = profile;
 }
-
-void MPD::setProfile( const std::string &strProfile )
-{
-    if( strProfile == "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" )
-        this->profile = dash::mpd::BasicCM;
-    else if ( strProfile == "urn:mpeg:mpegB:profile:dash:full:2011" )
-        this->profile = dash::mpd::Full2011;
-    else if ( strProfile == "urn:mpeg:dash:profile:isoff-main:2011" )
-        this->profile = dash::mpd::IsoffMain;
-    else
-        this->profile = dash::mpd::UnknownProfile;
-}
diff --git a/modules/stream_filter/dash/mpd/MPD.h b/modules/stream_filter/dash/mpd/MPD.h
index 4f9c186..e982184 100644
--- a/modules/stream_filter/dash/mpd/MPD.h
+++ b/modules/stream_filter/dash/mpd/MPD.h
@@ -45,7 +45,6 @@ namespace dash
                 virtual ~MPD();
 
                 Profile                         getProfile() const;
-                void                            setProfile( const std::string &strProfile );
                 void                            setProfile( Profile profile );
                 bool                            isLive() const;
                 void                            setLive( bool live );
diff --git a/modules/stream_filter/dash/mpd/MPDFactory.cpp b/modules/stream_filter/dash/mpd/MPDFactory.cpp
index 88d6e36..8afa248 100644
--- a/modules/stream_filter/dash/mpd/MPDFactory.cpp
+++ b/modules/stream_filter/dash/mpd/MPDFactory.cpp
@@ -49,7 +49,7 @@ MPD* MPDFactory::createBasicCMMPD    (dash::xml::Node *root, stream_t *p_stream)
 
     if(mpdParser.parse() == false || mpdParser.getMPD() == NULL)
         return NULL;
-
+    mpdParser.getMPD()->setProfile( dash::mpd::BasicCM );
     return mpdParser.getMPD();
 }
 MPD* MPDFactory::createIsoffMainMPD  (dash::xml::Node *root, stream_t *p_stream)
@@ -58,6 +58,6 @@ MPD* MPDFactory::createIsoffMainMPD  (dash::xml::Node *root, stream_t *p_stream)
 
     if(mpdParser.parse() == false || mpdParser.getMPD() == NULL)
         return NULL;
-
+    mpdParser.getMPD()->setProfile( dash::mpd::IsoffMain );
     return mpdParser.getMPD();
 }
diff --git a/modules/stream_filter/dash/xml/DOMParser.cpp b/modules/stream_filter/dash/xml/DOMParser.cpp
index f1eac4b..8b184da 100644
--- a/modules/stream_filter/dash/xml/DOMParser.cpp
+++ b/modules/stream_filter/dash/xml/DOMParser.cpp
@@ -157,7 +157,9 @@ Profile DOMParser::getProfile               ()
     if(this->root == NULL)
         return dash::mpd::UnknownProfile;
 
-    const std::string profile = this->root->getAttributeValue("profiles");
+    std::string profile = this->root->getAttributeValue("profiles");
+    if ( profile.length() == 0 )
+        profile = this->root->getAttributeValue("profile"); //The standard spells it the both ways...
 
     if(profile.find("urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm") != std::string::npos ||
             profile.find("urn:mpeg:dash:profile:isoff-ondemand:2011") != std::string::npos ||



More information about the vlc-commits mailing list