Commit 82a8e3f2 authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: update profiles

parent 4f091cf0
...@@ -175,9 +175,10 @@ void IsoffMainParser::print () ...@@ -175,9 +175,10 @@ void IsoffMainParser::print ()
{ {
if(mpd) if(mpd)
{ {
msg_Dbg(p_stream, "MPD profile=%d mediaPresentationDuration=%ld minBufferTime=%ld", mpd->getProfile(), msg_Dbg(p_stream, "MPD profile=%s mediaPresentationDuration=%ld minBufferTime=%ld",
mpd->getDuration(), static_cast<std::string>(mpd->getProfile()).c_str(),
mpd->getMinBufferTime()); mpd->getDuration(),
mpd->getMinBufferTime());
std::vector<BaseUrl *>::const_iterator h; std::vector<BaseUrl *>::const_iterator h;
for(h = mpd->getBaseUrls().begin(); h != mpd->getBaseUrls().end(); h++) for(h = mpd->getBaseUrls().begin(); h != mpd->getBaseUrls().end(); h++)
msg_Dbg(p_stream, "BaseUrl=%s", (*h)->getUrl().c_str()); msg_Dbg(p_stream, "BaseUrl=%s", (*h)->getUrl().c_str());
......
...@@ -158,12 +158,12 @@ void MPD::setAvailabilityEndTime(time_t time) ...@@ -158,12 +158,12 @@ void MPD::setAvailabilityEndTime(time_t time)
this->availabilityEndTime = 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; this->profile = profile;
} }
...@@ -44,8 +44,8 @@ namespace dash ...@@ -44,8 +44,8 @@ namespace dash
MPD(); MPD();
virtual ~MPD(); virtual ~MPD();
Profile::Name getProfile() const; Profile getProfile() const;
void setProfile( Profile::Name profile ); void setProfile( Profile profile );
bool isLive() const; bool isLive() const;
void setLive( bool live ); void setLive( bool live );
time_t getAvailabilityStartTime() const; time_t getAvailabilityStartTime() const;
...@@ -69,7 +69,7 @@ namespace dash ...@@ -69,7 +69,7 @@ namespace dash
void setProgramInformation (ProgramInformation *progInfo); void setProgramInformation (ProgramInformation *progInfo);
private: private:
Profile::Name profile; Profile profile;
bool live; bool live;
time_t availabilityStartTime; time_t availabilityStartTime;
time_t availabilityEndTime; time_t availabilityEndTime;
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
using namespace dash::xml; using namespace dash::xml;
using namespace dash::mpd; 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::Full:
case dash::mpd::Profile::ISOOnDemand: case dash::mpd::Profile::ISOOnDemand:
......
...@@ -36,7 +36,7 @@ namespace dash ...@@ -36,7 +36,7 @@ namespace dash
class MPDFactory class MPDFactory
{ {
public: 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: private:
static MPD* createBasicCMMPD (dash::xml::Node *root, stream_t *p_stream); static MPD* createBasicCMMPD (dash::xml::Node *root, stream_t *p_stream);
......
...@@ -25,26 +25,36 @@ ...@@ -25,26 +25,36 @@
using namespace dash::mpd; using namespace dash::mpd;
Profile::Name Profile::getNameByURN(std::string urn) struct
{ {
struct const Profile::Name name;
{ const char * urn;
const Name name; }
const char * urn; const urnmap[] =
} {
urnmap[] = { Profile::Full, "urn:mpeg:dash:profile:full:2011" },
{ { Profile::ISOOnDemand, "urn:mpeg:dash:profile:isoff-on-demand:2011" },
{ Full, "urn:mpeg:dash:profile:full:2011" }, { Profile::ISOOnDemand, "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" },
{ ISOOnDemand, "urn:mpeg:dash:profile:isoff-on-demand:2011" }, { Profile::ISOOnDemand, "urn:mpeg:dash:profile:isoff-ondemand:2011" },
{ ISOOnDemand, "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" }, { Profile::ISOMain, "urn:mpeg:dash:profile:isoff-main:2011" },
{ ISOOnDemand, "urn:mpeg:dash:profile:isoff-ondemand:2011" }, { Profile::ISOLive, "urn:mpeg:dash:profile:isoff-live:2011" },
{ ISOMain, "urn:mpeg:dash:profile:isoff-main:2011" }, { Profile::MPEG2TSMain, "urn:mpeg:dash:profile:mp2t-main:2011" },
{ ISOLive, "urn:mpeg:dash:profile:isoff-live:2011" }, { Profile::MPEG2TSSimple,"urn:mpeg:dash:profile:mp2t-simple:2011" },
{ MPEG2TSMain, "urn:mpeg:dash:profile:mp2t-main:2011" }, { Profile::Unknown, "" },
{ MPEG2TSSimple,"urn:mpeg:dash:profile:mp2t-simple:2011" }, };
{ 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++ ) for( int i=0; urnmap[i].name != Unknown; i++ )
{ {
if ( urn == urnmap[i].urn ) if ( urn == urnmap[i].urn )
...@@ -52,3 +62,23 @@ Profile::Name Profile::getNameByURN(std::string urn) ...@@ -52,3 +62,23 @@ Profile::Name Profile::getNameByURN(std::string urn)
} }
return Unknown; 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;
}
...@@ -39,7 +39,15 @@ namespace dash ...@@ -39,7 +39,15 @@ namespace dash
MPEG2TSMain, MPEG2TSMain,
MPEG2TSSimple, 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;
}; };
} }
} }
......
...@@ -161,14 +161,15 @@ bool DOMParser::isDash (stream_t *stream) ...@@ -161,14 +161,15 @@ bool DOMParser::isDash (stream_t *stream)
} }
return false; return false;
} }
Profile::Name DOMParser::getProfile ()
Profile DOMParser::getProfile() const
{ {
if(this->root == NULL) if(this->root == NULL)
return dash::mpd::Profile::Unknown; return Profile(Profile::Unknown);
std::string profile = this->root->getAttributeValue("profiles"); std::string urn = this->root->getAttributeValue("profiles");
if ( profile.length() == 0 ) if ( urn.length() == 0 )
profile = this->root->getAttributeValue("profile"); //The standard spells it the both ways... urn = this->root->getAttributeValue("profile"); //The standard spells it the both ways...
return dash::mpd::Profile::getNameByURN(profile); return Profile(urn);
} }
...@@ -46,7 +46,7 @@ namespace dash ...@@ -46,7 +46,7 @@ namespace dash
Node* getRootNode (); Node* getRootNode ();
void print (); void print ();
static bool isDash (stream_t *stream); static bool isDash (stream_t *stream);
mpd::Profile::Name getProfile (); mpd::Profile getProfile () const;
private: private:
Node *root; Node *root;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment