static int h264_parse(AVCodecParserContext *s,

                      AVCodecContext *avctx,

                      uint8_t **poutbuf, int *poutbuf_size,

                      const uint8_t *buf, int buf_size)

{

    H264Context *h = s->priv_data;

    ParseContext *pc = &h->s.parse_context;

    int next;



    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){

        next= buf_size;

    }else{

        next= find_frame_end(h, buf, buf_size);



        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {

            *poutbuf = NULL;

            *poutbuf_size = 0;

            return buf_size;

        }



        if(next<0){

            find_frame_end(h, &pc->buffer[pc->last_index + next], -next); //update state

        }

    }



    *poutbuf = (uint8_t *)buf;

    *poutbuf_size = buf_size;

    return next;

}

static int h264_parse(AVCodecParserContext *s,

                      AVCodecContext *avctx,

                      uint8_t **poutbuf, int *poutbuf_size,

                      const uint8_t *buf, int buf_size)

{

    H264Context *h = s->priv_data;

    ParseContext *pc = &h->s.parse_context;

    int next;



    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){

        next= buf_size;

    }else{

        next= find_frame_end(h, buf, buf_size);



        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {

            *poutbuf = NULL;

            *poutbuf_size = 0;

            return buf_size;

        }



        if(next<0){

            find_frame_end(h, &pc->buffer[pc->last_index + next], -next); 

        }

    }



    *poutbuf = (uint8_t *)buf;

    *poutbuf_size = buf_size;

    return next;

}

static int FUNC_0(AVCodecParserContext *VAR_0,

                      AVCodecContext *VAR_1,

                      uint8_t **VAR_2, int *VAR_3,

                      const uint8_t *VAR_4, int VAR_5)

{

    H264Context *h = VAR_0->priv_data;

    ParseContext *pc = &h->VAR_0.parse_context;

    int VAR_6;



    if(VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES){

        VAR_6= VAR_5;

    }else{

        VAR_6= find_frame_end(h, VAR_4, VAR_5);



        if (ff_combine_frame(pc, VAR_6, (uint8_t **)&VAR_4, &VAR_5) < 0) {

            *VAR_2 = NULL;

            *VAR_3 = 0;

            return VAR_5;

        }



        if(VAR_6<0){

            find_frame_end(h, &pc->buffer[pc->last_index + VAR_6], -VAR_6); 

        }

    }



    *VAR_2 = (uint8_t *)VAR_4;

    *VAR_3 = VAR_5;

    return VAR_6;

}

static int FUNC_0(AVCodecParserContext *VAR_0,
AVCodecContext *VAR_1,
uint8_t **VAR_2, int *VAR_3,
const uint8_t *VAR_4, int VAR_5)
{ H264Context *h = VAR_0->priv_data; ParseContext *pc = &h->VAR_0.parse_context; int VAR_6; if(VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES){ VAR_6= VAR_5; }else{ VAR_6= find_frame_end(h, VAR_4, VAR_5); if (ff_combine_frame(pc, VAR_6, (uint8_t **)&VAR_4, &VAR_5) < 0) { *VAR_2 = NULL; *VAR_3 = 0; return VAR_5; } if(VAR_6<0){ find_frame_end(h, &pc->buffer[pc->last_index + VAR_6], -VAR_6); } } *VAR_2 = (uint8_t *)VAR_4; *VAR_3 = VAR_5; return VAR_6; }