static int mpeg_decode_frame(AVCodecContext *avctx, void *data,

                             int *got_output, AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    Mpeg1Context *s = avctx->priv_data;

    AVFrame *picture = data;

    MpegEncContext *s2 = &s->mpeg_enc_ctx;

    av_dlog(avctx, "fill_buffer\n");



    if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {

        /* special case for last picture */

        if (s2->low_delay == 0 && s2->next_picture_ptr) {

            int ret = av_frame_ref(picture, &s2->next_picture_ptr->f);

            if (ret < 0)

                return ret;



            s2->next_picture_ptr = NULL;



            *got_output = 1;

        }

        return buf_size;

    }



    if (s2->flags & CODEC_FLAG_TRUNCATED) {

        int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf,

                                           buf_size, NULL);



        if (ff_combine_frame(&s2->parse_context, next,

                             (const uint8_t **) &buf, &buf_size) < 0)

            return buf_size;

    }



    if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2"))

        vcr2_init_sequence(avctx);



    s->slice_count = 0;



    if (avctx->extradata && !s->extradata_decoded) {

        int ret = decode_chunks(avctx, picture, got_output,

                                avctx->extradata, avctx->extradata_size);

        s->extradata_decoded = 1;

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

            return ret;

    }



    return decode_chunks(avctx, picture, got_output, buf, buf_size);

}

static int mpeg_decode_frame(AVCodecContext *avctx, void *data,

                             int *got_output, AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    Mpeg1Context *s = avctx->priv_data;

    AVFrame *picture = data;

    MpegEncContext *s2 = &s->mpeg_enc_ctx;

    av_dlog(avctx, "fill_buffer\n");



    if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {

        

        if (s2->low_delay == 0 && s2->next_picture_ptr) {

            int ret = av_frame_ref(picture, &s2->next_picture_ptr->f);

            if (ret < 0)

                return ret;



            s2->next_picture_ptr = NULL;



            *got_output = 1;

        }

        return buf_size;

    }



    if (s2->flags & CODEC_FLAG_TRUNCATED) {

        int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf,

                                           buf_size, NULL);



        if (ff_combine_frame(&s2->parse_context, next,

                             (const uint8_t **) &buf, &buf_size) < 0)

            return buf_size;

    }



    if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2"))

        vcr2_init_sequence(avctx);



    s->slice_count = 0;



    if (avctx->extradata && !s->extradata_decoded) {

        int ret = decode_chunks(avctx, picture, got_output,

                                avctx->extradata, avctx->extradata_size);

        s->extradata_decoded = 1;

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

            return ret;

    }



    return decode_chunks(avctx, picture, got_output, buf, buf_size);

}

            int ret = av_frame_ref(picture, &s2->next_picture_ptr->f);
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,

                             int *VAR_2, AVPacket *VAR_3)

{

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5 = VAR_3->size;

    Mpeg1Context *s = VAR_0->priv_data;

    AVFrame *picture = VAR_1;

    MpegEncContext *s2 = &s->mpeg_enc_ctx;

    av_dlog(VAR_0, "fill_buffer\n");



    if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == SEQ_END_CODE)) {

        

        if (s2->low_delay == 0 && s2->next_picture_ptr) {

            int VAR_8 = av_frame_ref(picture, &s2->next_picture_ptr->f);

            if (VAR_8 < 0)

                return VAR_8;



            s2->next_picture_ptr = NULL;



            *VAR_2 = 1;

        }

        return VAR_5;

    }



    if (s2->flags & CODEC_FLAG_TRUNCATED) {

        int VAR_7 = ff_mpeg1_find_frame_end(&s2->parse_context, VAR_4,

                                           VAR_5, NULL);



        if (ff_combine_frame(&s2->parse_context, VAR_7,

                             (const uint8_t **) &VAR_4, &VAR_5) < 0)

            return VAR_5;

    }



    if (s->mpeg_enc_ctx_allocated == 0 && VAR_0->codec_tag == AV_RL32("VCR2"))

        vcr2_init_sequence(VAR_0);



    s->slice_count = 0;



    if (VAR_0->extradata && !s->extradata_decoded) {

        int VAR_8 = decode_chunks(VAR_0, picture, VAR_2,

                                VAR_0->extradata, VAR_0->extradata_size);

        s->extradata_decoded = 1;

        if (VAR_8 < 0 && (VAR_0->err_recognition & AV_EF_EXPLODE))

            return VAR_8;

    }



    return decode_chunks(VAR_0, picture, VAR_2, VAR_4, VAR_5);

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{ const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; Mpeg1Context *s = VAR_0->priv_data; AVFrame *picture = VAR_1; MpegEncContext *s2 = &s->mpeg_enc_ctx; av_dlog(VAR_0, "fill_buffer\n"); if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == SEQ_END_CODE)) { if (s2->low_delay == 0 && s2->next_picture_ptr) { int VAR_8 = av_frame_ref(picture, &s2->next_picture_ptr->f); if (VAR_8 < 0)
return VAR_8; s2->next_picture_ptr = NULL; *VAR_2 = 1; } return VAR_5; } if (s2->flags & CODEC_FLAG_TRUNCATED) { int VAR_7 = ff_mpeg1_find_frame_end(&s2->parse_context, VAR_4,
VAR_5, NULL); if (ff_combine_frame(&s2->parse_context, VAR_7,
(const uint8_t **) &VAR_4, &VAR_5) < 0)
return VAR_5; } if (s->mpeg_enc_ctx_allocated == 0 && VAR_0->codec_tag == AV_RL32("VCR2"))
vcr2_init_sequence(VAR_0); s->slice_count = 0; if (VAR_0->extradata && !s->extradata_decoded) { int VAR_8 = decode_chunks(VAR_0, picture, VAR_2,
VAR_0->extradata, VAR_0->extradata_size); s->extradata_decoded = 1; if (VAR_8 < 0 && (VAR_0->err_recognition & AV_EF_EXPLODE))
return VAR_8; } return decode_chunks(VAR_0, picture, VAR_2, VAR_4, VAR_5); }