Decode_Status VaapiDecoderH264::decodeNalu(H264NalUnit * nalu)
{
    Decode_Status status;

    switch (nalu->type) {
    case H264_NAL_SLICE_IDR:
        /* fall-through. IDR specifics are handled in initPicture() */
    case H264_NAL_SLICE:
        if (!m_gotSPS || !m_gotPPS)
            return DECODE_SUCCESS;
        status = decodeSlice(nalu);
        break;
    case H264_NAL_SPS:
        status = decodeSPS(nalu);
        break;
    case H264_NAL_PPS:
        status = decodePPS(nalu);
        break;
    case H264_NAL_SEI:
        status = decodeSEI(nalu);
        break;
    case H264_NAL_SEQ_END:
        status = decodeSequenceEnd();
        break;
    case H264_NAL_AU_DELIMITER:
        /* skip all Access Unit NALs */
        status = DECODE_SUCCESS;
        break;
    case H264_NAL_FILLER_DATA:
        /* skip all Filler Data NALs */
        status = DECODE_SUCCESS;
        break;
    default:
        WARNING("unsupported NAL unit type %d", nalu->type);
        status = DECODE_PARSER_FAIL;
        break;
    }

    return status;
}
Ejemplo n.º 2
0
Decode_Status VaapiDecoderH265::decodeNalu(H265NalUnit *nalu)
{
    uint8_t type = nalu->type;
    Decode_Status status = DECODE_SUCCESS;

    if (H265_NAL_SLICE_TRAIL_N <= type && type <= H265_NAL_SLICE_CRA_NUT) {
        status = decodeSlice(nalu);
        if (status == DECODE_INVALID_DATA) {
            //ignore invalid data while decoding slice
            m_current.reset();
            status = DECODE_SUCCESS;
        }
    } else {
        status = decodeCurrent();
        if (status != DECODE_SUCCESS)
            return status;
        switch (type) {
            case H265_NAL_VPS:
            case H265_NAL_SPS:
            case H265_NAL_PPS:
                status = decodeParamSet(nalu);
                break;
            case H265_NAL_EOB:
                m_newStream = true;
                break;
            case H265_NAL_EOS:
                m_endOfSequence = true;
                break;
            case H265_NAL_AUD:
            case H265_NAL_FD:
            case H265_NAL_PREFIX_SEI:
            case H265_NAL_SUFFIX_SEI:
            default:
                break;
        }
    }

    return status;
}