static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx,

                               const uint8_t *buf, int buf_size)

{

    struct Mp4vParseContext *pc = s1->priv_data;

    Mpeg4DecContext *dec_ctx = &pc->dec_ctx;

    MpegEncContext *s = &dec_ctx->m;

    GetBitContext gb1, *gb = &gb1;

    int ret;



    s->avctx               = avctx;

    s->current_picture_ptr = &s->current_picture;



    if (avctx->extradata_size && pc->first_picture) {

        init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8);

        ret = ff_mpeg4_decode_picture_header(dec_ctx, gb);



    }



    init_get_bits(gb, buf, 8 * buf_size);

    ret = ff_mpeg4_decode_picture_header(dec_ctx, gb);

    if (s->width && (!avctx->width || !avctx->height ||

                     !avctx->coded_width || !avctx->coded_height)) {

        ret = ff_set_dimensions(avctx, s->width, s->height);


            return ret;

    }

    if((s1->flags & PARSER_FLAG_USE_CODEC_TS) && s->avctx->time_base.den>0 && ret>=0){

        av_assert1(s1->pts == AV_NOPTS_VALUE);

        av_assert1(s1->dts == AV_NOPTS_VALUE);



        s1->pts = av_rescale_q(s->time, (AVRational){1, s->avctx->time_base.den}, (AVRational){1, 1200000});

    }



    s1->pict_type     = s->pict_type;

    pc->first_picture = 0;

    return ret;

}
static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx,

                               const uint8_t *buf, int buf_size)

{

    struct Mp4vParseContext *pc = s1->priv_data;

    Mpeg4DecContext *dec_ctx = &pc->dec_ctx;

    MpegEncContext *s = &dec_ctx->m;

    GetBitContext gb1, *gb = &gb1;

    int ret;



    s->avctx               = avctx;

    s->current_picture_ptr = &s->current_picture;



    if (avctx->extradata_size && pc->first_picture) {

        init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8);

        ret = ff_mpeg4_decode_picture_header(dec_ctx, gb);



    }



    init_get_bits(gb, buf, 8 * buf_size);

    ret = ff_mpeg4_decode_picture_header(dec_ctx, gb);

    if (s->width && (!avctx->width || !avctx->height ||

                     !avctx->coded_width || !avctx->coded_height)) {

        ret = ff_set_dimensions(avctx, s->width, s->height);


            return ret;

    }

    if((s1->flags & PARSER_FLAG_USE_CODEC_TS) && s->avctx->time_base.den>0 && ret>=0){

        av_assert1(s1->pts == AV_NOPTS_VALUE);

        av_assert1(s1->dts == AV_NOPTS_VALUE);



        s1->pts = av_rescale_q(s->time, (AVRational){1, s->avctx->time_base.den}, (AVRational){1, 1200000});

    }



    s1->pict_type     = s->pict_type;

    pc->first_picture = 0;

    return ret;

}
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1,

                               const uint8_t *VAR_2, int VAR_3)

{

    struct Mp4vParseContext *VAR_4 = VAR_0->priv_data;

    Mpeg4DecContext *dec_ctx = &VAR_4->dec_ctx;

    MpegEncContext *s = &dec_ctx->m;

    GetBitContext gb1, *gb = &gb1;

    int VAR_5;



    s->VAR_1               = VAR_1;

    s->current_picture_ptr = &s->current_picture;



    if (VAR_1->extradata_size && VAR_4->first_picture) {

        init_get_bits(gb, VAR_1->extradata, VAR_1->extradata_size * 8);

        VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb);



    }



    init_get_bits(gb, VAR_2, 8 * VAR_3);

    VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb);

    if (s->width && (!VAR_1->width || !VAR_1->height ||

                     !VAR_1->coded_width || !VAR_1->coded_height)) {

        VAR_5 = ff_set_dimensions(VAR_1, s->width, s->height);


            return VAR_5;

    }

    if((VAR_0->flags & PARSER_FLAG_USE_CODEC_TS) && s->VAR_1->time_base.den>0 && VAR_5>=0){

        av_assert1(VAR_0->pts == AV_NOPTS_VALUE);

        av_assert1(VAR_0->dts == AV_NOPTS_VALUE);



        VAR_0->pts = av_rescale_q(s->time, (AVRational){1, s->VAR_1->time_base.den}, (AVRational){1, 1200000});

    }



    VAR_0->pict_type     = s->pict_type;

    VAR_4->first_picture = 0;

    return VAR_5;

}
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1,
const uint8_t *VAR_2, int VAR_3)
{ struct Mp4vParseContext *VAR_4 = VAR_0->priv_data; Mpeg4DecContext *dec_ctx = &VAR_4->dec_ctx; MpegEncContext *s = &dec_ctx->m; GetBitContext gb1, *gb = &gb1; int VAR_5; s->VAR_1               = VAR_1; s->current_picture_ptr = &s->current_picture; if (VAR_1->extradata_size && VAR_4->first_picture) { init_get_bits(gb, VAR_1->extradata, VAR_1->extradata_size * 8); VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb); } init_get_bits(gb, VAR_2, 8 * VAR_3); VAR_5 = ff_mpeg4_decode_picture_header(dec_ctx, gb); if (s->width && (!VAR_1->width || !VAR_1->height ||
!VAR_1->coded_width || !VAR_1->coded_height)) { VAR_5 = ff_set_dimensions(VAR_1, s->width, s->height); return VAR_5; } if((VAR_0->flags & PARSER_FLAG_USE_CODEC_TS) && s->VAR_1->time_base.den>0 && VAR_5>=0){ av_assert1(VAR_0->pts == AV_NOPTS_VALUE); av_assert1(VAR_0->dts == AV_NOPTS_VALUE); VAR_0->pts = av_rescale_q(s->time, (AVRational){1, s->VAR_1->time_base.den}, (AVRational){1, 1200000}); } VAR_0->pict_type     = s->pict_type; VAR_4->first_picture = 0; return VAR_5; }