]> git.sesse.net Git - vlc/commitdiff
stream_filter: dash: update profiles
authorFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 17 Nov 2014 19:00:04 +0000 (20:00 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 18 Dec 2014 20:23:48 +0000 (21:23 +0100)
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
modules/stream_filter/dash/mpd/MPD.cpp
modules/stream_filter/dash/mpd/MPD.h
modules/stream_filter/dash/mpd/MPDFactory.cpp
modules/stream_filter/dash/mpd/MPDFactory.h
modules/stream_filter/dash/mpd/Profile.cpp
modules/stream_filter/dash/mpd/Profile.hpp
modules/stream_filter/dash/xml/DOMParser.cpp
modules/stream_filter/dash/xml/DOMParser.h

index 94c09eb8edf027787a7dfb2918eaa1f9e957c752..8329990f567b18dd9e12215567ccb2006ec79fd1 100644 (file)
@@ -175,9 +175,10 @@ void    IsoffMainParser::print              ()
 {
     if(mpd)
     {
-        msg_Dbg(p_stream, "MPD profile=%d mediaPresentationDuration=%ld minBufferTime=%ld", mpd->getProfile(),
-                                                                                                  mpd->getDuration(),
-                                                                                                  mpd->getMinBufferTime());
+        msg_Dbg(p_stream, "MPD profile=%s mediaPresentationDuration=%ld minBufferTime=%ld",
+                static_cast<std::string>(mpd->getProfile()).c_str(),
+                mpd->getDuration(),
+                mpd->getMinBufferTime());
         std::vector<BaseUrl *>::const_iterator h;
         for(h = mpd->getBaseUrls().begin(); h != mpd->getBaseUrls().end(); h++)
             msg_Dbg(p_stream, "BaseUrl=%s", (*h)->getUrl().c_str());
index 62708291b4de117f69ff18c833e9e71527220b32..7563b9f5c9cac9533206b90a5cc0115536a67350 100644 (file)
@@ -158,12 +158,12 @@ void MPD::setAvailabilityEndTime(time_t time)
         this->availabilityEndTime = time;
 }
 
-Profile::Name MPD::getProfile() const
+Profile MPD::getProfile() const
 {
-    return this->profile;
+    return profile;
 }
 
-void MPD::setProfile(Profile::Name profile)
+void MPD::setProfile(Profile profile)
 {
     this->profile = profile;
 }
index 89da03dadf720cb4a8251eecf70cfce9ac8333de..99f59d7cfa700ec3b1166387919b8b6693a009a4 100644 (file)
@@ -44,8 +44,8 @@ namespace dash
                 MPD();
                 virtual ~MPD();
 
-                Profile::Name                   getProfile() const;
-                void                            setProfile( Profile::Name profile );
+                Profile                         getProfile() const;
+                void                            setProfile( Profile profile );
                 bool                            isLive() const;
                 void                            setLive( bool live );
                 time_t                          getAvailabilityStartTime() const;
@@ -69,7 +69,7 @@ namespace dash
                 void    setProgramInformation   (ProgramInformation *progInfo);
 
             private:
-                Profile::Name                       profile;
+                Profile                             profile;
                 bool                                live;
                 time_t                              availabilityStartTime;
                 time_t                              availabilityEndTime;
index 824409d811eb3f5c70f4348c78eb2fdeabf8eacd..ecfc56789fc119676444aaeca1ebb150511d202d 100644 (file)
@@ -31,9 +31,9 @@
 using namespace dash::xml;
 using namespace dash::mpd;
 
-MPD* MPDFactory::create             (dash::xml::Node *root, stream_t *p_stream, Profile::Name profile)
+MPD* MPDFactory::create             (dash::xml::Node *root, stream_t *p_stream, Profile profile)
 {
-    switch(profile)
+    switch( profile )
     {
         case dash::mpd::Profile::Full:
         case dash::mpd::Profile::ISOOnDemand:
index bd63d8b3d9166f6901a3732707a728306daae316..a3842a49253ac31bd3b3c91caa18d7a361dbffe8 100644 (file)
@@ -36,7 +36,7 @@ namespace dash
         class MPDFactory
         {
             public:
-                static MPD* create(dash::xml::Node *root, stream_t *p_stream, Profile::Name profile);
+                static MPD* create(dash::xml::Node *root, stream_t *p_stream, Profile profile);
 
             private:
                 static MPD* createBasicCMMPD    (dash::xml::Node *root, stream_t *p_stream);
index bcc14ca41414e19ff4c08299e4c469ad7bc4fc06..617bfa65b7376261c742e1c0f2a98c57ec01dbbf 100644 (file)
 
 using namespace dash::mpd;
 
-Profile::Name Profile::getNameByURN(std::string urn)
+struct
 {
-    struct
-    {
-        const Name name;
-        const char * urn;
-    }
-    urnmap[] =
-    {
-        { Full,         "urn:mpeg:dash:profile:full:2011" },
-        { ISOOnDemand,  "urn:mpeg:dash:profile:isoff-on-demand:2011" },
-        { ISOOnDemand,  "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" },
-        { ISOOnDemand,  "urn:mpeg:dash:profile:isoff-ondemand:2011" },
-        { ISOMain,      "urn:mpeg:dash:profile:isoff-main:2011" },
-        { ISOLive,      "urn:mpeg:dash:profile:isoff-live:2011" },
-        { MPEG2TSMain,  "urn:mpeg:dash:profile:mp2t-main:2011" },
-        { MPEG2TSSimple,"urn:mpeg:dash:profile:mp2t-simple:2011" },
-        { Unknown,      "" },
-    };
+    const Profile::Name name;
+    const char * urn;
+}
+const urnmap[] =
+{
+    { Profile::Full,         "urn:mpeg:dash:profile:full:2011" },
+    { Profile::ISOOnDemand,  "urn:mpeg:dash:profile:isoff-on-demand:2011" },
+    { Profile::ISOOnDemand,  "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" },
+    { Profile::ISOOnDemand,  "urn:mpeg:dash:profile:isoff-ondemand:2011" },
+    { Profile::ISOMain,      "urn:mpeg:dash:profile:isoff-main:2011" },
+    { Profile::ISOLive,      "urn:mpeg:dash:profile:isoff-live:2011" },
+    { Profile::MPEG2TSMain,  "urn:mpeg:dash:profile:mp2t-main:2011" },
+    { Profile::MPEG2TSSimple,"urn:mpeg:dash:profile:mp2t-simple:2011" },
+    { Profile::Unknown,      "" },
+};
+
+Profile::Profile(Name name)
+{
+    type = name;
+}
+
+Profile::Profile(const std::string &urn)
+{
+    type = getNameByURN(urn);
+}
 
+Profile::Name Profile::getNameByURN(const std::string &urn) const
+{
     for( int i=0; urnmap[i].name != Unknown; i++ )
     {
         if ( urn == urnmap[i].urn )
@@ -52,3 +62,23 @@ Profile::Name Profile::getNameByURN(std::string urn)
     }
     return Unknown;
 }
+
+Profile::operator Profile::Name ()
+{
+    return type;
+}
+
+Profile::operator std::string ()
+{
+    for( int i=0; urnmap[i].name != Unknown; i++ )
+    {
+        if ( urnmap[i].name == type )
+            return std::string( urnmap[i].urn );
+    }
+    return std::string();
+}
+
+bool Profile::operator==(Profile &profile) const
+{
+    return profile.type == type;
+}
index ab7175d173801d855ed996198ac87dce335c3489..9b44231f91a84d578e7e40b2eab29c8677ac669e 100644 (file)
@@ -39,7 +39,15 @@ namespace dash
                     MPEG2TSMain,
                     MPEG2TSSimple,
                 };
-                static Name getNameByURN( std::string urn );
+                Profile(Name);
+                Profile(const std::string &);
+                bool operator==(Profile &) const;
+                operator Profile::Name ();
+                operator std::string ();
+
+            private:
+                Name getNameByURN(const std::string &) const;
+                Name type;
         };
     }
 }
index f7dc1a04a05e1f3d57a34ecbd267232ee510adac..5fb80ac80f7e8e6880a46ed32b1a3fe6f7eef2b4 100644 (file)
@@ -161,14 +161,15 @@ bool    DOMParser::isDash                   (stream_t *stream)
     }
     return false;
 }
-Profile::Name DOMParser::getProfile               ()
+
+Profile DOMParser::getProfile() const
 {
     if(this->root == NULL)
-        return dash::mpd::Profile::Unknown;
+        return Profile(Profile::Unknown);
 
-    std::string profile = this->root->getAttributeValue("profiles");
-    if ( profile.length() == 0 )
-        profile = this->root->getAttributeValue("profile"); //The standard spells it the both ways...
+    std::string urn = this->root->getAttributeValue("profiles");
+    if ( urn.length() == 0 )
+        urn = this->root->getAttributeValue("profile"); //The standard spells it the both ways...
 
-    return dash::mpd::Profile::getNameByURN(profile);
+    return Profile(urn);
 }
index b9c55c19bbbd87592bee37513b36a309aca02b5e..9f1f2f48fd5f7d3936fe918e22a9b72d2d91bb7b 100644 (file)
@@ -46,7 +46,7 @@ namespace dash
                 Node*               getRootNode ();
                 void                print       ();
                 static bool         isDash      (stream_t *stream);
-                mpd::Profile::Name  getProfile  ();
+                mpd::Profile        getProfile  () const;
 
             private:
                 Node                *root;