Commit 9db9d6b9 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: BasicCMParser: Handle Representation @dependencyId

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 8f9fd197)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0af2e5c2
......@@ -99,7 +99,6 @@ void BasicCMParser::setRepresentations (Node *root, Group *group)
{
const std::map<std::string, std::string> attributes = representations.at(i)->getAttributes();
//FIXME: handle @dependencyId afterward
Representation *rep = new Representation( attributes );
if ( this->parseCommonAttributesElements( representations.at( i ), rep ) == false )
{
......@@ -130,11 +129,31 @@ void BasicCMParser::setRepresentations (Node *root, Group *group)
if ( it != attributes.end() )
rep->setQualityRanking( atoi( it->second.c_str() ) );
it = attributes.find( "dependencyId" );
if ( it != attributes.end() )
this->handleDependencyId( rep, group, it->second );
this->setSegmentInfo(representations.at(i), rep);
if ( rep->getSegmentInfo() && rep->getSegmentInfo()->getSegments().size() > 0 )
group->addRepresentation(rep);
group->addRepresentation(rep);
}
}
void BasicCMParser::handleDependencyId( Representation *rep, const Group *group, const std::string &dependencyId )
{
if ( dependencyId.empty() == true )
return ;
std::istringstream s( dependencyId );
while ( s )
{
std::string id;
s >> id;
const Representation *dep = group->getRepresentationById( id );
if ( dep )
rep->addDependency( dep );
}
}
void BasicCMParser::setSegmentInfo (Node *root, Representation *rep)
{
Node *segmentInfo = DOMHelper::getFirstChildElementByName( root, "SegmentInfo");
......
......@@ -50,6 +50,9 @@ namespace dash
bool parse ();
MPD* getMPD ();
private:
void handleDependencyId( Representation* rep, const Group* group, const std::string& dependencyId );
private:
dash::xml::Node *root;
MPD *mpd;
......
......@@ -46,15 +46,6 @@ Representation::~Representation ()
delete(this->trickModeType);
}
std::string Representation::getDependencyId () const throw(AttributeNotPresentException)
{
std::map<std::string, std::string>::const_iterator it = this->attributes.find("dependencyId");
if ( it == this->attributes.end() )
throw AttributeNotPresentException();
return it->second;
}
const std::string& Representation::getId () const
{
return this->id;
......@@ -116,3 +107,14 @@ void Representation::setQualityRanking( int qualityRanking )
if ( qualityRanking > 0 )
this->qualityRanking = qualityRanking;
}
const std::list<const Representation*>& Representation::getDependencies() const
{
return this->dependencies;
}
void Representation::addDependency(const Representation *dep)
{
if ( dep != NULL )
this->dependencies.push_back( dep );
}
......@@ -55,7 +55,8 @@ namespace dash
void setBandwidth ( int bandwidth );
int getQualityRanking () const;
void setQualityRanking ( int qualityRanking );
std::string getDependencyId () const throw(dash::exception::AttributeNotPresentException);
const std::list<const Representation*>& getDependencies() const;
void addDependency ( const Representation* dep );
SegmentInfo* getSegmentInfo () const throw(dash::exception::ElementNotPresentException);
TrickModeType* getTrickModeType () const throw(dash::exception::ElementNotPresentException);
......@@ -67,6 +68,7 @@ namespace dash
int bandwidth;
std::string id;
int qualityRanking;
std::list<const Representation*> dependencies;
std::map<std::string, std::string> attributes;
SegmentInfo *segmentInfo;
TrickModeType *trickModeType;
......
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