static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps,

                               int is_avc, void *logctx)

{

    H2645Packet pkt = { 0 };

    int i, ret = 0;



    ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264);

    if (ret < 0) {

        ret = 0;

        goto fail;

    }



    for (i = 0; i < pkt.nb_nals; i++) {

        H2645NAL *nal = &pkt.nals[i];

        switch (nal->type) {

        case H264_NAL_SPS:

            ret = ff_h264_decode_seq_parameter_set(&nal->gb, logctx, ps, 0);

            if (ret < 0)

                goto fail;

            break;

        case H264_NAL_PPS:

            ret = ff_h264_decode_picture_parameter_set(&nal->gb, logctx, ps,

                                                       nal->size_bits);

            if (ret < 0)

                goto fail;

            break;

        default:

            av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in extradata\n",

                   nal->type);

            break;

        }

    }



fail:

    ff_h2645_packet_uninit(&pkt);

    return ret;

}

static int decode_extradata_ps(const uint8_t *data, int size, H264ParamSets *ps,

                               int is_avc, void *logctx)

{

    H2645Packet pkt = { 0 };

    int i, ret = 0;



    ret = ff_h2645_packet_split(&pkt, data, size, logctx, is_avc, 2, AV_CODEC_ID_H264);

    if (ret < 0) {

        ret = 0;

        goto fail;

    }



    for (i = 0; i < pkt.nb_nals; i++) {

        H2645NAL *nal = &pkt.nals[i];

        switch (nal->type) {

        case H264_NAL_SPS:

            ret = ff_h264_decode_seq_parameter_set(&nal->gb, logctx, ps, 0);

            if (ret < 0)

                goto fail;

            break;

        case H264_NAL_PPS:

            ret = ff_h264_decode_picture_parameter_set(&nal->gb, logctx, ps,

                                                       nal->size_bits);

            if (ret < 0)

                goto fail;

            break;

        default:

            av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in extradata\n",

                   nal->type);

            break;

        }

    }



fail:

    ff_h2645_packet_uninit(&pkt);

    return ret;

}

static int FUNC_0(const uint8_t *VAR_0, int VAR_1, H264ParamSets *VAR_2,

                               int VAR_3, void *VAR_4)

{

    H2645Packet pkt = { 0 };

    int VAR_5, VAR_6 = 0;



    VAR_6 = ff_h2645_packet_split(&pkt, VAR_0, VAR_1, VAR_4, VAR_3, 2, AV_CODEC_ID_H264);

    if (VAR_6 < 0) {

        VAR_6 = 0;

        goto fail;

    }



    for (VAR_5 = 0; VAR_5 < pkt.nb_nals; VAR_5++) {

        H2645NAL *nal = &pkt.nals[VAR_5];

        switch (nal->type) {

        case H264_NAL_SPS:

            VAR_6 = ff_h264_decode_seq_parameter_set(&nal->gb, VAR_4, VAR_2, 0);

            if (VAR_6 < 0)

                goto fail;

            break;

        case H264_NAL_PPS:

            VAR_6 = ff_h264_decode_picture_parameter_set(&nal->gb, VAR_4, VAR_2,

                                                       nal->size_bits);

            if (VAR_6 < 0)

                goto fail;

            break;

        default:

            av_log(VAR_4, AV_LOG_VERBOSE, "Ignoring NAL type %d in extradata\n",

                   nal->type);

            break;

        }

    }



fail:

    ff_h2645_packet_uninit(&pkt);

    return VAR_6;

}

static int FUNC_0(const uint8_t *VAR_0, int VAR_1, H264ParamSets *VAR_2,
int VAR_3, void *VAR_4)
{ H2645Packet pkt = { 0 }; int VAR_5, VAR_6 = 0; VAR_6 = ff_h2645_packet_split(&pkt, VAR_0, VAR_1, VAR_4, VAR_3, 2, AV_CODEC_ID_H264); if (VAR_6 < 0) { VAR_6 = 0; goto fail; } for (VAR_5 = 0; VAR_5 < pkt.nb_nals; VAR_5++) { H2645NAL *nal = &pkt.nals[VAR_5]; switch (nal->type) { case H264_NAL_SPS:
VAR_6 = ff_h264_decode_seq_parameter_set(&nal->gb, VAR_4, VAR_2, 0); if (VAR_6 < 0)
goto fail; break; case H264_NAL_PPS:
VAR_6 = ff_h264_decode_picture_parameter_set(&nal->gb, VAR_4, VAR_2,
nal->size_bits); if (VAR_6 < 0)
goto fail; break; default:
av_log(VAR_4, AV_LOG_VERBOSE, "Ignoring NAL type %d in extradata\n",
nal->type); break; } } fail:
ff_h2645_packet_uninit(&pkt); return VAR_6; }