Example #1
0
void    IsoffMainParser::setInitSegment     (dash::xml::Node *segBaseNode, SegmentBase *base)
{
    std::vector<Node *> initSeg = DOMHelper::getElementByTagName(segBaseNode, "Initialisation", false);

    if(initSeg.size() == 0)
        initSeg = DOMHelper::getElementByTagName(segBaseNode, "Initialization", false);

    if(initSeg.size() > 0)
    {
        Segment *seg = new Segment( this->currentRepresentation );
        seg->setSourceUrl(initSeg.at(0)->getAttributeValue("sourceURL"));

        if(initSeg.at(0)->hasAttribute("range"))
        {
            std::string range = initSeg.at(0)->getAttributeValue("range");
            size_t pos = range.find("-");
            seg->setByteRange(atoi(range.substr(0, pos).c_str()), atoi(range.substr(pos + 1, range.size()).c_str()));
        }

        for(size_t i = 0; i < this->mpd->getBaseUrls().size(); i++)
            seg->addBaseUrl(this->mpd->getBaseUrls().at(i));

        base->addInitSegment(seg);
    }
}
Example #2
0
void    IsoffMainParser::setSegments        (dash::xml::Node *segListNode, SegmentList *list)
{
    std::vector<Node *> segments = DOMHelper::getElementByTagName(segListNode, "SegmentURL", false);

    for(size_t i = 0; i < segments.size(); i++)
    {
        Segment *seg = new Segment( this->currentRepresentation );
        seg->setSourceUrl(segments.at(i)->getAttributeValue("media"));

        if(segments.at(i)->hasAttribute("mediaRange"))
        {
            std::string range = segments.at(i)->getAttributeValue("mediaRange");
            size_t pos = range.find("-");
            seg->setByteRange(atoi(range.substr(0, pos).c_str()), atoi(range.substr(pos + 1, range.size()).c_str()));
        }

        for(size_t j = 0; j < this->mpd->getBaseUrls().size(); j++)
            seg->addBaseUrl(this->mpd->getBaseUrls().at(j));

        list->addSegment(seg);
    }
}