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


C++ ISegment::toChunk方法代码示例

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


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

示例1: getNextChunk

Chunk * SegmentTracker::getNextChunk(StreamType type, bool switch_allowed)
{
    BaseRepresentation *rep;
    ISegment *segment;

    if(!currentPeriod)
        return NULL;

    if( !switch_allowed ||
       (prevRepresentation && prevRepresentation->getSwitchPolicy() == SegmentInformation::SWITCH_UNAVAILABLE) )
        rep = prevRepresentation;
    else
        rep = logic->getCurrentRepresentation(type, currentPeriod);

    if ( rep == NULL )
            return NULL;

    if(rep != prevRepresentation)
    {
        prevRepresentation = rep;
        initializing = true;
    }

    if(initializing)
    {
        initializing = false;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INIT);
        if(segment)
            return segment->toChunk(count, rep);
    }

    if(!indexed)
    {
        indexed = true;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INDEX);
        if(segment)
            return segment->toChunk(count, rep);
    }

    segment = rep->getSegment(BaseRepresentation::INFOTYPE_MEDIA, count);
    if(!segment)
    {
        currentPeriod = playlist->getNextPeriod(currentPeriod);
        resetCounter();
        return getNextChunk(type, switch_allowed);
    }

    Chunk *chunk = segment->toChunk(count, rep);
    if(chunk)
        count++;

    return chunk;
}
开发者ID:Adatan,项目名称:vlc,代码行数:53,代码来源:SegmentTracker.cpp

示例2: if

SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionManager *connManager)
{
    BaseRepresentation *rep = NULL, *prevRep = NULL;
    ISegment *segment;

    if(!adaptationSet)
        return NULL;

    /* Ensure we don't keep chaining init/index without data */
    if( initializing )
    {
        if( curRepresentation )
            switch_allowed = false;
        else
            switch_allowed = true;
    }

    if( !switch_allowed ||
       (curRepresentation && curRepresentation->getSwitchPolicy() == SegmentInformation::SWITCH_UNAVAILABLE) )
        rep = curRepresentation;
    else
        rep = logic->getNextRepresentation(adaptationSet, curRepresentation);

    if ( rep == NULL )
            return NULL;


    if(rep != curRepresentation)
    {
        notify(SegmentTrackerEvent(curRepresentation, rep));
        prevRep = curRepresentation;
        curRepresentation = rep;
        init_sent = false;
        index_sent = false;
        initializing = true;
    }

    bool b_updated = false;
    /* Ensure ephemere content is updated/loaded */
    if(rep->needsUpdate())
        b_updated = rep->runLocalUpdates(getPlaybackTime(), curNumber, false);

    if(prevRep && !rep->consistentSegmentNumber())
    {
        /* Convert our segment number */
        next = rep->translateSegmentNumber(next, prevRep);
    }
    else if(first && rep->getPlaylist()->isLive())
    {
        next = rep->getLiveStartSegmentNumber(next);
        first = false;
    }

    if(b_updated)
    {
        if(!rep->consistentSegmentNumber())
            curRepresentation->pruneBySegmentNumber(curNumber);
        curRepresentation->scheduleNextUpdate(next);
    }

    if(!init_sent)
    {
        init_sent = true;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INIT);
        if(segment)
            return segment->toChunk(next, rep, connManager);
    }

    if(!index_sent)
    {
        index_sent = true;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INDEX);
        if(segment)
            return segment->toChunk(next, rep, connManager);
    }

    bool b_gap = false;
    segment = rep->getNextSegment(BaseRepresentation::INFOTYPE_MEDIA, next, &next, &b_gap);
    if(!segment)
    {
        reset();
        return NULL;
    }

    if(initializing)
    {
        b_gap = false;
        /* stop initializing after 1st chunk */
        initializing = false;
    }

    SegmentChunk *chunk = segment->toChunk(next, rep, connManager);

    /* We need to check segment/chunk format changes, as we can't rely on representation's (HLS)*/
    if(chunk && format != chunk->getStreamFormat())
    {
        format = chunk->getStreamFormat();
        notify(SegmentTrackerEvent(&format));
    }

//.........这里部分代码省略.........
开发者ID:0xheart0,项目名称:vlc,代码行数:101,代码来源:SegmentTracker.cpp

示例3: notify

SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionManager *connManager)
{
    BaseRepresentation *rep = NULL;
    ISegment *segment;

    if(!adaptationSet)
        return NULL;

    /* Ensure we don't keep chaining init/index without data */
    if( initializing )
    {
        if( prevRepresentation )
            switch_allowed = false;
        else
            switch_allowed = true;
    }

    if( !switch_allowed ||
       (prevRepresentation && prevRepresentation->getSwitchPolicy() == SegmentInformation::SWITCH_UNAVAILABLE) )
        rep = prevRepresentation;
    else
        rep = logic->getNextRepresentation(adaptationSet, prevRepresentation);

    if ( rep == NULL )
            return NULL;


    if(rep != prevRepresentation)
    {
        notify(SegmentTrackerEvent(prevRepresentation, rep));
        prevRepresentation = rep;
        init_sent = false;
        index_sent = false;
        initializing = true;
    }

    /* Ensure ephemere content is updated/loaded */
    if(rep->needsUpdate())
        updateSelected();

    if(!init_sent)
    {
        init_sent = true;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INIT);
        if(segment)
            return segment->toChunk(count, rep, connManager);
    }

    if(!index_sent)
    {
        index_sent = true;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INDEX);
        if(segment)
            return segment->toChunk(count, rep, connManager);
    }

    bool b_gap = false;
    segment = rep->getNextSegment(BaseRepresentation::INFOTYPE_MEDIA, count, &count, &b_gap);
    if(!segment)
    {
        reset();
        return NULL;
    }

    /* stop initializing after 1st chunk */
    initializing = false;

    SegmentChunk *chunk = segment->toChunk(count, rep, connManager);
    if(chunk)
        count++;

    /* We need to check segment/chunk format changes, as we can't rely on representation's (HLS)*/
    if(format != chunk->getStreamFormat())
    {
        format = chunk->getStreamFormat();
        notify(SegmentTrackerEvent(&format));
    }

    /* Handle both implicit and explicit discontinuities */
    if( (b_gap && count) || (chunk && chunk->discontinuity) )
    {
        notify(SegmentTrackerEvent(chunk));
    }

    return chunk;
}
开发者ID:NDOBJC,项目名称:vlc,代码行数:86,代码来源:SegmentTracker.cpp

示例4: if


//.........这里部分代码省略.........
        curRepresentation->scheduleNextUpdate(next);
    }

    if(rep->getStreamFormat() != format)
    {
        /* Initial format ? */
        if(format == StreamFormat(StreamFormat::UNSUPPORTED))
        {
            format = rep->getStreamFormat();
        }
        else
        {
            format = rep->getStreamFormat();
            notify(SegmentTrackerEvent(&format)); /* Notify new demux format */
            return NULL; /* Force current demux to end */
        }
    }

    if(format == StreamFormat(StreamFormat::UNSUPPORTED))
    {
        return NULL; /* Can't return chunk because no demux will be created */
    }

    if(!init_sent)
    {
        init_sent = true;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INIT);
        if(segment) {
            /* LVP added, TFE DEBUG */
            std::cerr << "TFE DEBUG SegmentTracker getNextChunk no init sent but segment, " << mdate() << std::endl;
            //msg_Info(NULL, "TFE DEBUG SegmentTracker getNextChunk no init sent but segment, %" PRId64, mdate());
            //std::cerr << "TFE DEBUG SegmentTracker getNextChunk no init sent but segment, " << mdate() << std::endl;

            return segment->toChunk(next, rep, connManager);
        }
    }

    if(!index_sent)
    {
        index_sent = true;
        segment = rep->getSegment(BaseRepresentation::INFOTYPE_INDEX);
        if(segment) {
            /* LVP added, TFE DEBUG */
            // happens after no init sent
            //msg_Info(NULL, "TFE DEBUG SegmentTracker getNextChunk no index sent but segment, %" PRId64, mdate());
            //std::cerr << "TFE DEBUG SegmentTracker getNextChunk no index sent but segment, " << mdate() << std::endl;

            return segment->toChunk(next, rep, connManager);
        }

    }

    bool b_gap = false;
    segment = rep->getNextSegment(BaseRepresentation::INFOTYPE_MEDIA, next, &next, &b_gap);
    if(!segment)
    {
        reset();

        /* LVP added, TFE DEBUG */
        // once at the end
        //msg_Info(NULL, "TFE DEBUG SegmentTracker getNextChunk no segment and reset, %" PRId64, mdate());
        //std::cerr << "TFE DEBUG SegmentTracker getNextChunk no segment and reset, " << mdate() << std::endl;

        return NULL;
    }
开发者ID:lvpeschke,项目名称:vlc,代码行数:66,代码来源:SegmentTracker.cpp


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