Revision e4cb187d libavcodec/h264.c

View differences:

libavcodec/h264.c
5520 5520
 * finds the end of the current frame in the bitstream.
5521 5521
 * @return the position of the first byte of the next frame, or -1
5522 5522
 */
5523
static int find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){
5524
    ParseContext *pc= &s->parse_context;
5523
static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
5525 5524
    int i;
5526 5525
    uint32_t state;
5527 5526
//printf("first %02X%02X%02X%02X\n", buf[0], buf[1],buf[2],buf[3]);
......
5544 5543
    return END_NOT_FOUND;
5545 5544
}
5546 5545

  
5546
static int h264_parse(AVCodecParserContext *s,
5547
                      AVCodecContext *avctx,
5548
                      uint8_t **poutbuf, int *poutbuf_size, 
5549
                      const uint8_t *buf, int buf_size)
5550
{
5551
    ParseContext *pc = s->priv_data;
5552
    int next;
5553
    
5554
    next= find_frame_end(pc, buf, buf_size);
5555

  
5556
    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
5557
        *poutbuf = NULL;
5558
        *poutbuf_size = 0;
5559
        return buf_size;
5560
    }
5561

  
5562
    *poutbuf = (uint8_t *)buf;
5563
    *poutbuf_size = buf_size;
5564
    return next;
5565
}
5566

  
5547 5567
static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
5548 5568
    MpegEncContext * const s = &h->s;
5549 5569
    AVCodecContext * const avctx= s->avctx;
......
5701 5721
    }
5702 5722
    
5703 5723
    if(s->flags&CODEC_FLAG_TRUNCATED){
5704
        int next= find_frame_end(s, buf, buf_size);
5724
        int next= find_frame_end(&s->parse_context, buf, buf_size);
5705 5725
        
5706
        if( ff_combine_frame(s, next, &buf, &buf_size) < 0 )
5726
        if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 )
5707 5727
            return buf_size;
5708 5728
//printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index);
5709 5729
    }
......
5970 5990
    /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED,
5971 5991
};
5972 5992

  
5993
AVCodecParser h264_parser = {
5994
    { CODEC_ID_H264 },
5995
    sizeof(ParseContext),
5996
    NULL,
5997
    h264_parse,
5998
    ff_parse_close,
5999
};
6000

  
5973 6001
#include "svq3.c"

Also available in: Unified diff