Commit 37540a61 authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: fix and add missing profiles

parent 3da7f14e
...@@ -43,6 +43,7 @@ libdash_plugin_la_SOURCES = \ ...@@ -43,6 +43,7 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/mpd/ContentDescription.cpp \ stream_filter/dash/mpd/ContentDescription.cpp \
stream_filter/dash/mpd/ContentDescription.h \ stream_filter/dash/mpd/ContentDescription.h \
stream_filter/dash/mpd/IMPDManager.h \ stream_filter/dash/mpd/IMPDManager.h \
stream_filter/dash/mpd/IMPDManager.cpp \
stream_filter/dash/mpd/IMPDParser.h \ stream_filter/dash/mpd/IMPDParser.h \
stream_filter/dash/mpd/IsoffMainParser.cpp \ stream_filter/dash/mpd/IsoffMainParser.cpp \
stream_filter/dash/mpd/IsoffMainParser.h \ stream_filter/dash/mpd/IsoffMainParser.h \
......
/*
* IMPDManager.cpp
*****************************************************************************
* Copyright (C) 2014 - VideoLAN Authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "IMPDManager.h"
using namespace dash::mpd;
Profile::Name Profile::getNameByURN(std::string urn)
{
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, "" },
};
for( int i=0; urnmap[i].name != Unknown; i++ )
{
if ( urn == urnmap[i].urn )
return urnmap[i].name;
}
return Unknown;
}
...@@ -34,14 +34,22 @@ namespace dash ...@@ -34,14 +34,22 @@ namespace dash
{ {
class MPD; class MPD;
enum Profile class Profile
{ {
UnknownProfile, public:
Full2011, enum Name
Basic, {
BasicCM, Unknown,
IsoffMain Full,
ISOOnDemand,
ISOMain,
ISOLive,
MPEG2TSMain,
MPEG2TSSimple,
}; };
static Name getNameByURN( std::string urn );
};
class IMPDManager class IMPDManager
{ {
public: public:
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
using namespace dash::mpd; using namespace dash::mpd;
MPD::MPD () : MPD::MPD () :
profile( dash::mpd::UnknownProfile ), profile( dash::mpd::Profile::Unknown ),
live( false ), live( false ),
availabilityStartTime( -1 ), availabilityStartTime( -1 ),
availabilityEndTime( -1 ), availabilityEndTime( -1 ),
...@@ -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 MPD::getProfile() const Profile::Name MPD::getProfile() const
{ {
return this->profile; return this->profile;
} }
void MPD::setProfile(Profile profile) void MPD::setProfile(Profile::Name 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 getProfile() const; Profile::Name getProfile() const;
void setProfile( Profile profile ); void setProfile( Profile::Name 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 profile; Profile::Name profile;
bool live; bool live;
time_t availabilityStartTime; time_t availabilityStartTime;
time_t availabilityEndTime; time_t availabilityEndTime;
......
...@@ -31,14 +31,15 @@ ...@@ -31,14 +31,15 @@
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 profile) MPD* MPDFactory::create (dash::xml::Node *root, stream_t *p_stream, Profile::Name profile)
{ {
switch(profile) switch(profile)
{ {
case dash::mpd::Full2011: case dash::mpd::Profile::Full:
case dash::mpd::Basic: case dash::mpd::Profile::ISOOnDemand:
case dash::mpd::BasicCM: return MPDFactory::createBasicCMMPD(root, p_stream); return MPDFactory::createBasicCMMPD(root, p_stream);
case dash::mpd::IsoffMain: return MPDFactory::createIsoffMainMPD(root, p_stream); case dash::mpd::Profile::ISOMain:
return MPDFactory::createIsoffMainMPD(root, p_stream);
default: return NULL; default: return NULL;
} }
...@@ -49,7 +50,7 @@ MPD* MPDFactory::createBasicCMMPD (dash::xml::Node *root, stream_t *p_stream) ...@@ -49,7 +50,7 @@ MPD* MPDFactory::createBasicCMMPD (dash::xml::Node *root, stream_t *p_stream)
if(mpdParser.parse() == false || mpdParser.getMPD() == NULL) if(mpdParser.parse() == false || mpdParser.getMPD() == NULL)
return NULL; return NULL;
mpdParser.getMPD()->setProfile( dash::mpd::BasicCM ); mpdParser.getMPD()->setProfile( dash::mpd::Profile::ISOOnDemand );
return mpdParser.getMPD(); return mpdParser.getMPD();
} }
MPD* MPDFactory::createIsoffMainMPD (dash::xml::Node *root, stream_t *p_stream) MPD* MPDFactory::createIsoffMainMPD (dash::xml::Node *root, stream_t *p_stream)
...@@ -58,6 +59,6 @@ MPD* MPDFactory::createIsoffMainMPD (dash::xml::Node *root, stream_t *p_stream) ...@@ -58,6 +59,6 @@ MPD* MPDFactory::createIsoffMainMPD (dash::xml::Node *root, stream_t *p_stream)
if(mpdParser.parse() == false || mpdParser.getMPD() == NULL) if(mpdParser.parse() == false || mpdParser.getMPD() == NULL)
return NULL; return NULL;
mpdParser.getMPD()->setProfile( dash::mpd::IsoffMain ); mpdParser.getMPD()->setProfile( dash::mpd::Profile::ISOMain );
return mpdParser.getMPD(); return mpdParser.getMPD();
} }
...@@ -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 profile); static MPD* create(dash::xml::Node *root, stream_t *p_stream, Profile::Name 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);
......
...@@ -33,11 +33,11 @@ IMPDManager* MPDManagerFactory::create( MPD *mpd ) ...@@ -33,11 +33,11 @@ IMPDManager* MPDManagerFactory::create( MPD *mpd )
{ {
switch( mpd->getProfile() ) switch( mpd->getProfile() )
{ {
case mpd::BasicCM: case mpd::Profile::ISOOnDemand:
case mpd::Full2011: return new BasicCMManager (mpd); case mpd::Profile::Full:
case mpd::IsoffMain: return new IsoffMainManager (mpd); return new BasicCMManager (mpd);
case mpd::Basic: case mpd::Profile::ISOMain:
case mpd::UnknownProfile: return new IsoffMainManager (mpd);
default: default:
return NULL; return NULL;
} }
......
...@@ -161,22 +161,14 @@ bool DOMParser::isDash (stream_t *stream) ...@@ -161,22 +161,14 @@ bool DOMParser::isDash (stream_t *stream)
} }
return false; return false;
} }
Profile DOMParser::getProfile () Profile::Name DOMParser::getProfile ()
{ {
if(this->root == NULL) if(this->root == NULL)
return dash::mpd::UnknownProfile; return dash::mpd::Profile::Unknown;
std::string profile = this->root->getAttributeValue("profiles"); std::string profile = this->root->getAttributeValue("profiles");
if ( profile.length() == 0 ) if ( profile.length() == 0 )
profile = this->root->getAttributeValue("profile"); //The standard spells it the both ways... 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 || return dash::mpd::Profile::getNameByURN(profile);
profile.find("urn:mpeg:dash:profile:isoff-ondemand:2011") != std::string::npos ||
profile.find("urn:mpeg:dash:profile:isoff-on-demand:2011") != std::string::npos)
return dash::mpd::BasicCM;
if(profile.find("urn:mpeg:dash:profile:isoff-main:2011") != std::string::npos)
return dash::mpd::IsoffMain;
return dash::mpd::UnknownProfile;
} }
...@@ -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 getProfile (); mpd::Profile::Name getProfile ();
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