void IsoffMainParser::setRepresentations (Node *adaptationSetNode, AdaptationSet *adaptationSet) { std::vector<Node *> representations = DOMHelper::getElementByTagName(adaptationSetNode, "Representation", false); for(size_t i = 0; i < representations.size(); i++) { Representation *currentRepresentation = new Representation(adaptationSet, getMPD()); Node *repNode = representations.at(i); std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL"); if(!baseUrls.empty()) currentRepresentation->baseUrl.Set(new Url(baseUrls.front()->getText())); if(repNode->hasAttribute("id")) currentRepresentation->setId(repNode->getAttributeValue("id")); if(repNode->hasAttribute("width")) currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str())); if(repNode->hasAttribute("height")) currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str())); if(repNode->hasAttribute("bandwidth")) currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str())); if(repNode->hasAttribute("mimeType")) currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType")); parseSegmentInformation(repNode, currentRepresentation); adaptationSet->addRepresentation(currentRepresentation); } }
void IsoffMainParser::setRepresentations (Node *adaptationSetNode, AdaptationSet *adaptationSet) { std::vector<Node *> representations = DOMHelper::getElementByTagName(adaptationSetNode, "Representation", false); for(size_t i = 0; i < representations.size(); i++) { Representation *currentRepresentation = new Representation(adaptationSet); Node *repNode = representations.at(i); std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL"); if(!baseUrls.empty()) currentRepresentation->baseUrl.Set(new Url(baseUrls.front()->getText())); if(repNode->hasAttribute("id")) currentRepresentation->setId(repNode->getAttributeValue("id")); if(repNode->hasAttribute("width")) currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str())); if(repNode->hasAttribute("height")) currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str())); if(repNode->hasAttribute("bandwidth")) currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str())); if(repNode->hasAttribute("mimeType")) currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType")); if(repNode->hasAttribute("codecs")) { std::list<std::string> list = Helper::tokenize(repNode->getAttributeValue("codecs"), ','); std::list<std::string>::const_iterator it; for(it=list.begin(); it!=list.end(); ++it) { std::size_t pos = (*it).find_first_of('.', 0); if(pos != std::string::npos) currentRepresentation->addCodec((*it).substr(0, pos)); else currentRepresentation->addCodec(*it); } } parseSegmentInformation(repNode, currentRepresentation); adaptationSet->addRepresentation(currentRepresentation); } }