当前位置: 首页>>代码示例>>C++>>正文


C++ SegmentList::getDuration方法代码示例

本文整理汇总了C++中SegmentList::getDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ SegmentList::getDuration方法的具体用法?C++ SegmentList::getDuration怎么用?C++ SegmentList::getDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SegmentList的用法示例。


在下文中一共展示了SegmentList::getDuration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseSegmentList

size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation *info)
{
    size_t total = 0;
    mtime_t totaltime = 0;
    if(segListNode)
    {
        std::vector<Node *> segments = DOMHelper::getElementByTagName(segListNode, "SegmentURL", false);
        SegmentList *list;
        if((list = new (std::nothrow) SegmentList()))
        {
            parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list, info);

            if(segListNode->hasAttribute("duration"))
                list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration")));

            if(segListNode->hasAttribute("timescale"))
                list->timescale.Set(Integer<uint64_t>(segListNode->getAttributeValue("timescale")));

            std::vector<Node *>::const_iterator it;
            for(it = segments.begin(); it != segments.end(); ++it)
            {
                Node *segmentURL = *it;
                std::string mediaUrl = segmentURL->getAttributeValue("media");
                if(mediaUrl.empty())
                    continue;

                Segment *seg = new (std::nothrow) Segment(info);
                if(!seg)
                    continue;

                seg->setSourceUrl(segmentURL->getAttributeValue("media"));

                if(segmentURL->hasAttribute("mediaRange"))
                {
                    std::string range = segmentURL->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()));
                }

                if(totaltime || list->getDuration())
                {
                    seg->startTime.Set(totaltime);
                    totaltime += list->getDuration();
                }

                list->addSegment(seg);
                total++;
            }

            info->setSegmentList(list);
        }
    }
    return total;
}
开发者ID:deveshmittal,项目名称:vlc,代码行数:54,代码来源:IsoffMainParser.cpp

示例2: getPlaybackTimeBySegmentNumber

mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) const
{
    SegmentList *segList;
    MediaSegmentTemplate *mediaTemplate;
    uint64_t timescale = 1;
    mtime_t time = 0;
    if( (mediaTemplate = inheritSegmentTemplate()) )
    {
        timescale = mediaTemplate->inheritTimescale();
        if(mediaTemplate->segmentTimeline.Get())
        {
            time = mediaTemplate->segmentTimeline.Get()->
                    getScaledPlaybackTimeByElementNumber(number);
        }
        else
        {
            time = number * mediaTemplate->duration.Get();
        }
    }
    else if ( (segList = inheritSegmentList()) )
    {
        timescale = segList->inheritTimescale();
        time = number * segList->getDuration();
    }

    if(time)
        time = CLOCK_FREQ * time / timescale;

    return time;
}
开发者ID:Aakash-729,项目名称:vlc,代码行数:30,代码来源:SegmentInformation.cpp

示例3: getSegmentNumberByTime

bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) const
{
    SegmentList *segList;
    MediaSegmentTemplate *mediaTemplate;
    uint64_t timescale = 1;
    mtime_t duration = 0;

    if( (mediaTemplate = inheritSegmentTemplate()) )
    {
        timescale = mediaTemplate->inheritTimescale();
        duration = mediaTemplate->duration.Get();
    }
    else if ( (segList = inheritSegmentList()) )
    {
        timescale = segList->inheritTimescale();
        duration = segList->getDuration();
    }

    if(duration)
    {
        *ret = time / (CLOCK_FREQ * duration / timescale);
        return true;
    }

    return false;
}
开发者ID:Aakash-729,项目名称:vlc,代码行数:26,代码来源:SegmentInformation.cpp


注:本文中的SegmentList::getDuration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。