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

stream_filter: dash: update profiles

parent 4f091cf0
......@@ -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());
......
......@@ -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;
}
......@@ -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;
......
......@@ -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:
......
......@@ -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);
......
......@@ -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;
}
......@@ -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;
};
}
}
......
......@@ -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);
}
......@@ -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;
......
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