Пример #1
0
bool VideoDecoderThread::work() 
{
    ScopeTimer timer(DecoderProfilingZone);
    if (m_bProcessingLastFrames) {
        // EOF received, but last frames still need to be decoded.
        handleEOF();
    } else {
        // Standard decoding.
        VideoMsgPtr pMsg;
        {
            ScopeTimer timer(PacketWaitProfilingZone);
            pMsg = m_PacketQ.pop(true);
        }
        switch (pMsg->getType()) {
            case VideoMsg::PACKET:
                decodePacket(pMsg->getPacket());
                break;
            case VideoMsg::END_OF_FILE:
                handleEOF();
                m_bProcessingLastFrames = true;
                break;
            case VideoMsg::SEEK_DONE:
                handleSeekDone(pMsg);
                break;
            case VideoMsg::CLOSED:
                close();
                break;
            default:
                pMsg->dump();
                AVG_ASSERT(false);
        }
    }
    ThreadProfiler::get()->reset();
    return true;
}
Пример #2
0
void VideoDemuxerThread::clearQueue(VideoMsgQueuePtr pPacketQ)
{
    VideoMsgPtr pMsg;
    do {
        pMsg = pPacketQ->pop(false);
        if (pMsg) {
            pMsg->freePacket();
        }
    } while (pMsg);
}
Пример #3
0
void VideoDecoderThread::returnFrame(VideoMsgPtr pMsg)
{
    m_pBmpQ->push(pMsg->getFrameBitmap(0));
    if (pixelFormatIsPlanar(m_PF)) {
        m_pHalfBmpQ->push(pMsg->getFrameBitmap(1));
        m_pHalfBmpQ->push(pMsg->getFrameBitmap(2));
        if (m_PF == YCbCrA420p) {
            m_pBmpQ->push(pMsg->getFrameBitmap(3));
        }
    }
}
Пример #4
0
bool AudioDecoderThread::work() 
{
    ScopeTimer timer(DecoderProfilingZone);
    VideoMsgPtr pMsg;
    {
        ScopeTimer timer(PacketWaitProfilingZone);
        pMsg = m_PacketQ.pop(true);
    }
    switch (pMsg->getType()) {
        case VideoMsg::PACKET: {
            AVPacket* pPacket = pMsg->getPacket();
            switch(m_State) {
                case DECODING:
                    decodePacket(pPacket);
                    break;
                case SEEK_DONE:
                    handleSeekDone(pPacket);
                    break;
                case DISCARDING:
                    discardPacket(pPacket);
                    break;
                default:
                    AVG_ASSERT(false);
            }
            av_free_packet(pPacket);
            delete pPacket;
            break;
        }
        case VideoMsg::SEEK_DONE:
            m_State = SEEK_DONE;
            m_SeekSeqNum = pMsg->getSeekSeqNum();
            m_SeekTime = pMsg->getSeekTime();
            break;
        case VideoMsg::END_OF_FILE:
            pushEOF();
            break;
        case VideoMsg::CLOSED:
            m_MsgQ.clear();
            stop();
            break;
        default:
            pMsg->dump();
            AVG_ASSERT(false);
    }
    ThreadProfiler::get()->reset();
    return true;
}