Пример #1
0
bool V4l2Decoder::outputPulse(uint32_t &index)
{
    Decode_Status status = DECODE_SUCCESS;

    VideoFrameRawData *frame=NULL;

    ASSERT(index >= 0 && index < m_maxBufferCount[OUTPUT]);
    DEBUG("index: %d", index);

    frame = &m_outputRawFrames[index];
    if (m_memoryType == VIDEO_DATA_MEMORY_TYPE_RAW_COPY) {
        if (!m_bufferSpace[OUTPUT])
            return false;
        ASSERT(frame->handle);
        frame->fourcc = VA_FOURCC_NV12;
        frame->memoryType = VIDEO_DATA_MEMORY_TYPE_RAW_COPY;
    }
    if (m_memoryType == VIDEO_DATA_MEMORY_TYPE_DRM_NAME || m_memoryType == VIDEO_DATA_MEMORY_TYPE_DMA_BUF) {
        if (m_eglVaapiImages.empty())
            return false;
        frame->memoryType = VIDEO_DATA_MEMORY_TYPE_SURFACE_ID;
    }


    status = m_decoder->getOutput(frame);

    if (status == RENDER_NO_AVAILABLE_FRAME) {
        if (eosState() == EosStateInput) {
            setEosState(EosStateOutput);
            DEBUG("flush-debug flush done on OUTPUT thread");
        }

        if (eosState() > EosStateNormal) {
            DEBUG("seek/EOS flush, return empty buffer");
            return false;
        }
    }

    if (status != RENDER_SUCCESS)
        return false;
    if (m_memoryType == VIDEO_DATA_MEMORY_TYPE_DRM_NAME || m_memoryType == VIDEO_DATA_MEMORY_TYPE_DMA_BUF) {
        // FIXME, it introduce one GPU copy; which is not necessary in major case and should be avoided in most case
        m_eglVaapiImages[index]->blt(*frame);
        m_decoder->renderDone(frame);
        if (!m_bindEglImage)
            m_eglVaapiImages[index]->exportFrame(m_memoryType, m_outputRawFrames[index]);
    }

    DEBUG("outputPulse: index=%d, timeStamp=%ld", index, m_outputRawFrames[index].timeStamp);
    return true;
}
Пример #2
0
bool V4l2Decoder::outputPulse(uint32_t &index)
{
    SharedPtr<VideoFrame> frame;

    ASSERT(index >= 0 && index < m_maxBufferCount[OUTPUT]);
    DEBUG("index: %d", index);

    //frame = &m_outputRawFrames[index];
    if (m_memoryType == VIDEO_DATA_MEMORY_TYPE_RAW_COPY) {
        /* if (!m_bufferSpace[OUTPUT])
            return false;
        ASSERT(frame->handle);
        frame->fourcc = VA_FOURCC_NV12;
        frame->memoryType = VIDEO_DATA_MEMORY_TYPE_RAW_COPY;*/
        ASSERT("TODO: support raw copy" && 0);
        return false;
    }
    if (m_memoryType == VIDEO_DATA_MEMORY_TYPE_DRM_NAME || m_memoryType == VIDEO_DATA_MEMORY_TYPE_DMA_BUF) {
        if (m_eglVaapiImages.empty())
            return false;
    }


    frame = m_decoder->getOutput();

    if (!frame) {
        if (eosState() == EosStateInput) {
            setEosState(EosStateOutput);
            DEBUG("flush-debug flush done on OUTPUT thread");
        }

        if (eosState() > EosStateNormal) {
            DEBUG("seek/EOS flush, return empty buffer");
        }
        return false;
    }

    if (m_memoryType == VIDEO_DATA_MEMORY_TYPE_DRM_NAME || m_memoryType == VIDEO_DATA_MEMORY_TYPE_DMA_BUF) {
        // FIXME, it introduce one GPU copy; which is not necessary in major case and should be avoided in most case
        m_eglVaapiImages[index]->blt(frame);
        if (!m_bindEglImage)
            m_eglVaapiImages[index]->exportFrame(m_memoryType, m_outputRawFrames[index]);
    }

    DEBUG("outputPulse: index=%d, timeStamp=%ld", index, m_outputRawFrames[index].timeStamp);
    return true;
}
Пример #3
0
bool V4l2Decoder::outputPulse(uint32_t &index)
{
    SharedPtr<VideoFrame> output = m_decoder->getOutput();

    if(!output) {
        if (eosState() == EosStateInput) {
            setEosState(EosStateOutput);
            fprintf(stderr, "flush-debug flush done on OUTPUT thread\n");
        }
	return false;
    }

    m_vpp->process(output, m_videoFrames[index]);
    m_videoFrames[index]->timeStamp = output->timeStamp;
    m_videoFrames[index]->flags = output->flags;
    DEBUG("buffer index: %d, timeStamp: %" PRId64 "\n", index, output->timeStamp);
    return true;
}