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

dash: Try to fetch mimeType attribute from the parent element.

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 699b4b50
...@@ -150,7 +150,7 @@ void BasicCMParser::setGroups (Node *root, Period *period) ...@@ -150,7 +150,7 @@ void BasicCMParser::setGroups (Node *root, Period *period)
for(size_t i = 0; i < groups.size(); i++) for(size_t i = 0; i < groups.size(); i++)
{ {
Group *group = new Group(groups.at(i)->getAttributes()); Group *group = new Group(groups.at(i)->getAttributes());
if ( this->parseCommonAttributesElements( groups.at( i ), group ) == false ) if ( this->parseCommonAttributesElements( groups.at( i ), group, NULL ) == false )
{ {
delete group; delete group;
continue ; continue ;
...@@ -169,7 +169,7 @@ void BasicCMParser::setRepresentations (Node *root, Group *group) ...@@ -169,7 +169,7 @@ 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();
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, group ) == false )
{ {
delete rep; delete rep;
continue ; continue ;
...@@ -351,7 +351,7 @@ void BasicCMParser::parseContentDescriptor(Node *node, const std::string &name, ...@@ -351,7 +351,7 @@ void BasicCMParser::parseContentDescriptor(Node *node, const std::string &name,
} }
} }
bool BasicCMParser::parseCommonAttributesElements( Node *node, CommonAttributesElements *common) const bool BasicCMParser::parseCommonAttributesElements( Node *node, CommonAttributesElements *common, CommonAttributesElements *parent ) const
{ {
const std::map<std::string, std::string> &attr = node->getAttributes(); const std::map<std::string, std::string> &attr = node->getAttributes();
std::map<std::string, std::string>::const_iterator it; std::map<std::string, std::string>::const_iterator it;
...@@ -359,8 +359,13 @@ bool BasicCMParser::parseCommonAttributesElements( Node *node, CommonAttribut ...@@ -359,8 +359,13 @@ bool BasicCMParser::parseCommonAttributesElements( Node *node, CommonAttribut
it = attr.find( "mimeType" ); it = attr.find( "mimeType" );
if ( it == attr.end() ) if ( it == attr.end() )
{ {
std::cerr << "Missing mandatory attribute: @mimeType" << std::endl; if ( parent && parent->getMimeType().empty() == false )
return false; common->setMimeType( parent->getMimeType() );
else
{
std::cerr << "Missing mandatory attribute: @mimeType" << std::endl;
return false;
}
} }
common->setMimeType( it->second ); common->setMimeType( it->second );
//Everything else is optionnal. //Everything else is optionnal.
......
...@@ -67,7 +67,9 @@ namespace dash ...@@ -67,7 +67,9 @@ namespace dash
void parseContentDescriptor( xml::Node *node, const std::string &name, void parseContentDescriptor( xml::Node *node, const std::string &name,
void (CommonAttributesElements::*addPtr)(ContentDescription*), void (CommonAttributesElements::*addPtr)(ContentDescription*),
CommonAttributesElements *self ) const; CommonAttributesElements *self ) const;
bool parseCommonAttributesElements( dash::xml::Node *node, CommonAttributesElements *common ) const; bool parseCommonAttributesElements( dash::xml::Node *node,
CommonAttributesElements *common,
CommonAttributesElements *parent ) const;
bool parseSegment( Segment *seg, const std::map<std::string, std::string> &attr ); bool parseSegment( Segment *seg, const std::map<std::string, std::string> &attr );
ProgramInformation* parseProgramInformation(); ProgramInformation* parseProgramInformation();
}; };
......
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