Commit 8f9fd197 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>
parent 05890451
...@@ -99,7 +99,6 @@ void BasicCMParser::setRepresentations (Node *root, Group *group) ...@@ -99,7 +99,6 @@ void BasicCMParser::setRepresentations (Node *root, Group *group)
{ {
const std::map<std::string, std::string> attributes = representations.at(i)->getAttributes(); const std::map<std::string, std::string> attributes = representations.at(i)->getAttributes();
//FIXME: handle @dependencyId afterward
Representation *rep = new Representation( attributes ); Representation *rep = new Representation( attributes );
if ( this->parseCommonAttributesElements( representations.at( i ), rep ) == false ) if ( this->parseCommonAttributesElements( representations.at( i ), rep ) == false )
{ {
...@@ -130,11 +129,31 @@ void BasicCMParser::setRepresentations (Node *root, Group *group) ...@@ -130,11 +129,31 @@ void BasicCMParser::setRepresentations (Node *root, Group *group)
if ( it != attributes.end() ) if ( it != attributes.end() )
rep->setQualityRanking( atoi( it->second.c_str() ) ); 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); this->setSegmentInfo(representations.at(i), rep);
if ( rep->getSegmentInfo() && rep->getSegmentInfo()->getSegments().size() > 0 ) 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) void BasicCMParser::setSegmentInfo (Node *root, Representation *rep)
{ {
Node *segmentInfo = DOMHelper::getFirstChildElementByName( root, "SegmentInfo"); Node *segmentInfo = DOMHelper::getFirstChildElementByName( root, "SegmentInfo");
......
...@@ -50,6 +50,9 @@ namespace dash ...@@ -50,6 +50,9 @@ namespace dash
bool parse (); bool parse ();
MPD* getMPD (); MPD* getMPD ();
private:
void handleDependencyId( Representation* rep, const Group* group, const std::string& dependencyId );
private: private:
dash::xml::Node *root; dash::xml::Node *root;
MPD *mpd; MPD *mpd;
......
...@@ -46,15 +46,6 @@ Representation::~Representation () ...@@ -46,15 +46,6 @@ Representation::~Representation ()
delete(this->trickModeType); 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 const std::string& Representation::getId () const
{ {
return this->id; return this->id;
...@@ -116,3 +107,14 @@ void Representation::setQualityRanking( int qualityRanking ) ...@@ -116,3 +107,14 @@ void Representation::setQualityRanking( int qualityRanking )
if ( qualityRanking > 0 ) if ( qualityRanking > 0 )
this->qualityRanking = qualityRanking; 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 ...@@ -55,7 +55,8 @@ namespace dash
void setBandwidth ( int bandwidth ); void setBandwidth ( int bandwidth );
int getQualityRanking () const; int getQualityRanking () const;
void setQualityRanking ( int qualityRanking ); 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); SegmentInfo* getSegmentInfo () const throw(dash::exception::ElementNotPresentException);
TrickModeType* getTrickModeType () const throw(dash::exception::ElementNotPresentException); TrickModeType* getTrickModeType () const throw(dash::exception::ElementNotPresentException);
...@@ -67,6 +68,7 @@ namespace dash ...@@ -67,6 +68,7 @@ namespace dash
int bandwidth; int bandwidth;
std::string id; std::string id;
int qualityRanking; int qualityRanking;
std::list<const Representation*> dependencies;
std::map<std::string, std::string> attributes; std::map<std::string, std::string> attributes;
SegmentInfo *segmentInfo; SegmentInfo *segmentInfo;
TrickModeType *trickModeType; 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