static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,

                             AVPacket *avpkt)

{

    int ret;

    int new_extradata_size;

    uint8_t *new_extradata;

    HEVCContext *s = avctx->priv_data;



    if (!avpkt->size) {

        ret = ff_hevc_output_frame(s, data, 1);

        if (ret < 0)

            return ret;



        *got_output = ret;

        return 0;

    }



    new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,

                                            &new_extradata_size);

    if (new_extradata && new_extradata_size > 0) {

        ret = hevc_decode_extradata(s, new_extradata, new_extradata_size);

        if (ret < 0)

            return ret;

    }



    s->ref = NULL;

    ret    = decode_nal_units(s, avpkt->data, avpkt->size);

    if (ret < 0)

        return ret;



    if (avctx->hwaccel) {

        if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) {

            av_log(avctx, AV_LOG_ERROR,

                   "hardware accelerator failed to decode picture\n");

            ff_hevc_unref_frame(s, s->ref, ~0);

            return ret;

        }

    } else {

        /* verify the SEI checksum */

        if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&

            s->sei.picture_hash.is_md5) {

            ret = verify_md5(s, s->ref->frame);

            if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) {

                ff_hevc_unref_frame(s, s->ref, ~0);

                return ret;

            }

        }

    }

    s->sei.picture_hash.is_md5 = 0;



    if (s->is_decoded) {

        av_log(avctx, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc);

        s->is_decoded = 0;

    }



    if (s->output_frame->buf[0]) {

        av_frame_move_ref(data, s->output_frame);

        *got_output = 1;

    }



    return avpkt->size;

}

static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,

                             AVPacket *avpkt)

{

    int ret;

    int new_extradata_size;

    uint8_t *new_extradata;

    HEVCContext *s = avctx->priv_data;



    if (!avpkt->size) {

        ret = ff_hevc_output_frame(s, data, 1);

        if (ret < 0)

            return ret;



        *got_output = ret;

        return 0;

    }



    new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,

                                            &new_extradata_size);

    if (new_extradata && new_extradata_size > 0) {

        ret = hevc_decode_extradata(s, new_extradata, new_extradata_size);

        if (ret < 0)

            return ret;

    }



    s->ref = NULL;

    ret    = decode_nal_units(s, avpkt->data, avpkt->size);

    if (ret < 0)

        return ret;



    if (avctx->hwaccel) {

        if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) {

            av_log(avctx, AV_LOG_ERROR,

                   "hardware accelerator failed to decode picture\n");

            ff_hevc_unref_frame(s, s->ref, ~0);

            return ret;

        }

    } else {

        

        if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&

            s->sei.picture_hash.is_md5) {

            ret = verify_md5(s, s->ref->frame);

            if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) {

                ff_hevc_unref_frame(s, s->ref, ~0);

                return ret;

            }

        }

    }

    s->sei.picture_hash.is_md5 = 0;



    if (s->is_decoded) {

        av_log(avctx, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc);

        s->is_decoded = 0;

    }



    if (s->output_frame->buf[0]) {

        av_frame_move_ref(data, s->output_frame);

        *got_output = 1;

    }



    return avpkt->size;

}

        ret = hevc_decode_extradata(s, new_extradata, new_extradata_size);
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,

                             AVPacket *VAR_3)

{

    int VAR_4;

    int VAR_5;

    uint8_t *new_extradata;

    HEVCContext *s = VAR_0->priv_data;



    if (!VAR_3->size) {

        VAR_4 = ff_hevc_output_frame(s, VAR_1, 1);

        if (VAR_4 < 0)

            return VAR_4;



        *VAR_2 = VAR_4;

        return 0;

    }



    new_extradata = av_packet_get_side_data(VAR_3, AV_PKT_DATA_NEW_EXTRADATA,

                                            &VAR_5);

    if (new_extradata && VAR_5 > 0) {

        VAR_4 = hevc_decode_extradata(s, new_extradata, VAR_5);

        if (VAR_4 < 0)

            return VAR_4;

    }



    s->ref = NULL;

    VAR_4    = decode_nal_units(s, VAR_3->VAR_1, VAR_3->size);

    if (VAR_4 < 0)

        return VAR_4;



    if (VAR_0->hwaccel) {

        if (s->ref && (VAR_4 = VAR_0->hwaccel->end_frame(VAR_0)) < 0) {

            av_log(VAR_0, AV_LOG_ERROR,

                   "hardware accelerator failed to decode picture\n");

            ff_hevc_unref_frame(s, s->ref, ~0);

            return VAR_4;

        }

    } else {

        

        if (VAR_0->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&

            s->sei.picture_hash.is_md5) {

            VAR_4 = verify_md5(s, s->ref->frame);

            if (VAR_4 < 0 && VAR_0->err_recognition & AV_EF_EXPLODE) {

                ff_hevc_unref_frame(s, s->ref, ~0);

                return VAR_4;

            }

        }

    }

    s->sei.picture_hash.is_md5 = 0;



    if (s->is_decoded) {

        av_log(VAR_0, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc);

        s->is_decoded = 0;

    }



    if (s->output_frame->buf[0]) {

        av_frame_move_ref(VAR_1, s->output_frame);

        *VAR_2 = 1;

    }



    return VAR_3->size;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{ int VAR_4; int VAR_5; uint8_t *new_extradata; HEVCContext *s = VAR_0->priv_data; if (!VAR_3->size) { VAR_4 = ff_hevc_output_frame(s, VAR_1, 1); if (VAR_4 < 0)
return VAR_4; *VAR_2 = VAR_4; return 0; } new_extradata = av_packet_get_side_data(VAR_3, AV_PKT_DATA_NEW_EXTRADATA,
&VAR_5); if (new_extradata && VAR_5 > 0) { VAR_4 = hevc_decode_extradata(s, new_extradata, VAR_5); if (VAR_4 < 0)
return VAR_4; } s->ref = NULL; VAR_4    = decode_nal_units(s, VAR_3->VAR_1, VAR_3->size); if (VAR_4 < 0)
return VAR_4; if (VAR_0->hwaccel) { if (s->ref && (VAR_4 = VAR_0->hwaccel->end_frame(VAR_0)) < 0) { av_log(VAR_0, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n"); ff_hevc_unref_frame(s, s->ref, ~0); return VAR_4; } } else { if (VAR_0->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
s->sei.picture_hash.is_md5) { VAR_4 = verify_md5(s, s->ref->frame); if (VAR_4 < 0 && VAR_0->err_recognition & AV_EF_EXPLODE) { ff_hevc_unref_frame(s, s->ref, ~0); return VAR_4; } } } s->sei.picture_hash.is_md5 = 0; if (s->is_decoded) { av_log(VAR_0, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc); s->is_decoded = 0; } if (s->output_frame->buf[0]) { av_frame_move_ref(VAR_1, s->output_frame); *VAR_2 = 1; } return VAR_3->size; }