Ejemplo n.º 1
0
Decode_Status VaapiDecoderH265::start(VideoConfigBuffer * buffer)
{
    DEBUG("H265: start()");
    Decode_Status status;
    bool gotConfig = false;

    if (buffer->data == NULL || buffer->size == 0) {
        gotConfig = false;
        if ((buffer->flag & HAS_SURFACE_NUMBER)
            && (buffer->flag & HAS_VA_PROFILE)) {
            gotConfig = true;
        }
    } else {
        if (!decodeCodecData((uint8_t *) buffer->data, buffer->size)) {
            ERROR("codec data has some error");
            return DECODE_FAIL;
        }
    }

    if (gotConfig) {
        status = VaapiDecoderBase::start(buffer);
        if (status != DECODE_SUCCESS)
            return status;
    }

    return DECODE_SUCCESS;
}
Decode_Status VaapiDecoderH264::start(VideoConfigBuffer * buffer)
{
    DEBUG("H264: start()");
    Decode_Status status;
    bool gotConfig = false;

    if (buffer->data == NULL || buffer->size == 0) {
        gotConfig = false;
        if ((buffer->flag & HAS_SURFACE_NUMBER)
            && (buffer->flag & HAS_VA_PROFILE)) {
            gotConfig = true;
        }
    } else {
        if (decodeCodecData((uint8_t *) buffer->data, buffer->size)) {
            H264SPS *sps = &(m_parser.sps[0]);
            uint32_t maxSize = getMaxDecFrameBuffering(sps, 1);
            buffer->profile = VAProfileH264Baseline;
            buffer->surfaceNumber = maxSize + H264_EXTRA_SURFACE_NUMBER;
            gotConfig = true;
        } else {
            ERROR("codec data has some error");
            return DECODE_FAIL;
        }
    }

    if (gotConfig) {
        status = VaapiDecoderBase::start(buffer);
        if (status != DECODE_SUCCESS)
            return status;

        m_hasContext = true;
    }

    return DECODE_SUCCESS;
}