Mercurial > libavcodec.hg
diff mpeg12.c @ 1988:b5753525f9a8 libavcodec
remove duplicated find_frame_end() code
move codec specific code from parser.c -> <codecname>.c as far as its easily possible
| author | michael |
|---|---|
| date | Thu, 29 Apr 2004 14:21:33 +0000 |
| parents | c8e866f4515f |
| children | 11991f81afd6 |
line wrap: on
line diff
--- a/mpeg12.c Thu Apr 29 03:33:34 2004 +0000 +++ b/mpeg12.c Thu Apr 29 14:21:33 2004 +0000 @@ -2715,8 +2715,8 @@ * finds the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ -static int mpeg1_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){ - ParseContext *pc= &s->parse_context; +int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) +{ int i; uint32_t state; @@ -2735,6 +2735,9 @@ } if(pc->frame_start_found){ + /* EOF considered as end of frame */ + if (buf_size == 0) + return 0; for(; i<buf_size; i++){ state= (state<<8) | buf[i]; if((state&0xFFFFFF00) == 0x100){ @@ -2775,9 +2778,9 @@ } if(s2->flags&CODEC_FLAG_TRUNCATED){ - int next= mpeg1_find_frame_end(s2, buf, buf_size); + int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size); - if( ff_combine_frame(s2, next, &buf, &buf_size) < 0 ) + if( ff_combine_frame(&s2->parse_context, next, &buf, &buf_size) < 0 ) return buf_size; }
