[vlc-commits] stream_filter: dash: update profiles
Francois Cartegnie
git at videolan.org
Thu Dec 18 22:39:45 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov 17 20:00:04 2014 +0100| [82a8e3f282e63aba9649293f9fcaea63e9ee32e2] | committer: Francois Cartegnie
stream_filter: dash: update profiles
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=82a8e3f282e63aba9649293f9fcaea63e9ee32e2
---
modules/stream_filter/dash/mpd/IsoffMainParser.cpp | 7 ++-
modules/stream_filter/dash/mpd/MPD.cpp | 6 +-
modules/stream_filter/dash/mpd/MPD.h | 6 +-
modules/stream_filter/dash/mpd/MPDFactory.cpp | 4 +-
modules/stream_filter/dash/mpd/MPDFactory.h | 2 +-
modules/stream_filter/dash/mpd/Profile.cpp | 66 ++++++++++++++------
modules/stream_filter/dash/mpd/Profile.hpp | 10 ++-
modules/stream_filter/dash/xml/DOMParser.cpp | 13 ++--
modules/stream_filter/dash/xml/DOMParser.h | 2 +-
9 files changed, 78 insertions(+), 38 deletions(-)
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index 94c09eb..8329990 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -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());
diff --git a/modules/stream_filter/dash/mpd/MPD.cpp b/modules/stream_filter/dash/mpd/MPD.cpp
index 6270829..7563b9f 100644
--- a/modules/stream_filter/dash/mpd/MPD.cpp
+++ b/modules/stream_filter/dash/mpd/MPD.cpp
@@ -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;
}
diff --git a/modules/stream_filter/dash/mpd/MPD.h b/modules/stream_filter/dash/mpd/MPD.h
index 89da03d..99f59d7 100644
--- a/modules/stream_filter/dash/mpd/MPD.h
+++ b/modules/stream_filter/dash/mpd/MPD.h
@@ -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;
diff --git a/modules/stream_filter/dash/mpd/MPDFactory.cpp b/modules/stream_filter/dash/mpd/MPDFactory.cpp
index 824409d..ecfc567 100644
--- a/modules/stream_filter/dash/mpd/MPDFactory.cpp
+++ b/modules/stream_filter/dash/mpd/MPDFactory.cpp
@@ -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:
diff --git a/modules/stream_filter/dash/mpd/MPDFactory.h b/modules/stream_filter/dash/mpd/MPDFactory.h
index bd63d8b..a3842a4 100644
--- a/modules/stream_filter/dash/mpd/MPDFactory.h
+++ b/modules/stream_filter/dash/mpd/MPDFactory.h
@@ -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);
diff --git a/modules/stream_filter/dash/mpd/Profile.cpp b/modules/stream_filter/dash/mpd/Profile.cpp
index bcc14ca..617bfa6 100644
--- a/modules/stream_filter/dash/mpd/Profile.cpp
+++ b/modules/stream_filter/dash/mpd/Profile.cpp
@@ -25,26 +25,36 @@
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;
+}
diff --git a/modules/stream_filter/dash/mpd/Profile.hpp b/modules/stream_filter/dash/mpd/Profile.hpp
index ab7175d..9b44231 100644
--- a/modules/stream_filter/dash/mpd/Profile.hpp
+++ b/modules/stream_filter/dash/mpd/Profile.hpp
@@ -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;
};
}
}
diff --git a/modules/stream_filter/dash/xml/DOMParser.cpp b/modules/stream_filter/dash/xml/DOMParser.cpp
index f7dc1a0..5fb80ac 100644
--- a/modules/stream_filter/dash/xml/DOMParser.cpp
+++ b/modules/stream_filter/dash/xml/DOMParser.cpp
@@ -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);
}
diff --git a/modules/stream_filter/dash/xml/DOMParser.h b/modules/stream_filter/dash/xml/DOMParser.h
index b9c55c1..9f1f2f4 100644
--- a/modules/stream_filter/dash/xml/DOMParser.h
+++ b/modules/stream_filter/dash/xml/DOMParser.h
@@ -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;
More information about the vlc-commits
mailing list