using namespace dash::mpd;
using namespace dash::exception;
-DASHManager::DASHManager (HTTPConnectionManager *conManager, Node *node, IAdaptationLogic::LogicType type, Profile profile)
+DASHManager::DASHManager ( HTTPConnectionManager *conManager, Node *node, IAdaptationLogic::LogicType type )
{
this->conManager = conManager;
this->node = node;
this->logicType = type;
- this->profile = profile;
- this->mpdManager = mpd::MPDManagerFactory::create(this->profile, this->node);
+ this->mpdManager = mpd::MPDManagerFactory::create(this->node);
this->adaptationLogic = AdaptationLogicFactory::create( this->logicType, this->mpdManager );
this->currentChunk = NULL;
class DASHManager
{
public:
- DASHManager (http::HTTPConnectionManager *conManager, xml::Node *node, logic::IAdaptationLogic::LogicType type, mpd::Profile profile);
+ DASHManager (http::HTTPConnectionManager *conManager, xml::Node *node, logic::IAdaptationLogic::LogicType type);
virtual ~DASHManager ();
int read (void *p_buffer, size_t len);
http::Chunk *currentChunk;
logic::IAdaptationLogic *adaptationLogic;
logic::IAdaptationLogic::LogicType logicType;
- mpd::Profile profile;
xml::Node *node;
mpd::IMPDManager *mpdManager;
};
new dash::http::HTTPConnectionManager(p_stream);
dash::xml::Node *p_node = parser.getRootNode();
dash::DASHManager*p_dashManager =
- new dash::DASHManager(p_conManager, p_node,
- dash::logic::IAdaptationLogic::RateBased,
- parser.getProfile(p_node));
+ new dash::DASHManager( p_conManager, p_node,
+ dash::logic::IAdaptationLogic::RateBased );
p_sys->p_dashManager = p_dashManager;
p_sys->p_node = p_node;
}
void BasicCMParser::setMPD ()
{
- this->mpd = new MPD(this->root->getAttributes());
+ const std::map<std::string, std::string> attr = this->root->getAttributes();
+ this->mpd = new MPD( attr );
+
+ std::map<std::string, std::string>::const_iterator it;
+ it = attr.find( "profile" );
+ if ( it != attr.end() )
+ this->mpd->setProfile( it->second );
this->setMPDBaseUrl(this->root);
this->setPeriods(this->root);
}
using namespace dash::mpd;
using namespace dash::exception;
-MPD::MPD (const AttributesMap& attributes) : attributes( attributes ),
+MPD::MPD (const AttributesMap& attributes) :
+ profile( dash::mpd::NotValid ),
+ attributes( attributes ),
programInfo( NULL )
{
}
*/
return ( it != this->attributes.end() && it->second == "Live" );
}
+
+Profile MPD::getProfile() const
+{
+ return this->profile;
+}
+
+void MPD::setProfile(Profile profile)
+{
+ this->profile = profile;
+}
+
+void MPD::setProfile( const std::string &strProfile )
+{
+ if( strProfile == "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" )
+ this->profile = dash::mpd::BasicCM;
+ else
+ this->profile = dash::mpd::NotValid;
+}
#include "mpd/ProgramInformation.h"
#include "exceptions/AttributeNotPresentException.h"
#include "exceptions/ElementNotPresentException.h"
+#include "mpd/IMPDManager.h"
namespace dash
{
MPD (const AttributesMap& attributes);
virtual ~MPD();
+ Profile getProfile() const;
+ void setProfile( const std::string &strProfile );
+ void setProfile( Profile profile );
bool isLive() const;
const std::string& getDuration () const throw(dash::exception::AttributeNotPresentException);
const std::string& getMinBufferTime () const throw(dash::exception::AttributeNotPresentException);
void setProgramInformation (ProgramInformation *progInfo);
private:
+ Profile profile;
AttributesMap attributes;
std::vector<Period *> periods;
std::vector<BaseUrl *> baseUrls;
using namespace dash::mpd;
using namespace dash::xml;
-IMPDManager* MPDManagerFactory::create (Profile profile, Node *root)
+IMPDManager* MPDManagerFactory::create( Node *root )
{
- switch(profile)
+ BasicCMParser parser(root);
+
+ if ( parser.parse() == false )
+ return new NullManager();
+
+ Profile profile = parser.getMPD()->getProfile();
+ switch( profile )
{
case mpd::Basic: return new NullManager();
- case mpd::BasicCM: return createBasicCMManager(root);
+ case mpd::BasicCM: return new BasicCMManager( parser.getMPD() );
case mpd::Full2011: return new NullManager();
case mpd::NotValid: return new NullManager();
default: return new NullManager();
}
}
-
-IMPDManager* MPDManagerFactory::createBasicCMManager (Node *root)
-{
- BasicCMParser parser(root);
-
- if(!parser.parse())
- return new NullManager();
-
- BasicCMManager *manager = new BasicCMManager(parser.getMPD());
-
- return manager;
-}
class MPDManagerFactory
{
public:
- static IMPDManager* create(Profile profile, dash::xml::Node *root);
-
- private:
- static IMPDManager* createBasicCMManager(dash::xml::Node *root);
+ static IMPDManager* create( xml::Node *root );
};
}
}
{
this->print(this->root, 0);
}
-Profile DOMParser::getProfile (dash::xml::Node *node)
-{
- std::string profile = node->getAttributeValue("profiles");
-
- if(!profile.compare("urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm"))
- return dash::mpd::BasicCM;
- return dash::mpd::NotValid;
-}
bool DOMParser::isDash (stream_t *stream)
{
const char* psz_namespace = "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011";
bool parse ();
Node* getRootNode ();
void print ();
- dash::mpd::Profile getProfile (dash::xml::Node *node);
static bool isDash (stream_t *stream);
private: