From bb463d81020a2f3c5cf3403e18f980171773f48a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 Apr 2003 01:11:26 +0000 Subject: 10l (returning negative number of consumed bytes if the first startcode of a frame was split between 2 buffers) Originally committed as revision 1824 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpeg12.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libavcodec/mpeg12.c') diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index d16eaa1..d3cef31 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2190,7 +2190,7 @@ static int mpeg1_find_frame_end(MpegEncContext *s, uint8_t *buf, int buf_size){ } } pc->state= state; - return -1; + return END_NOT_FOUND; } /* handle buffering and image synchronisation */ @@ -2218,9 +2218,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, } if(s2->flags&CODEC_FLAG_TRUNCATED){ - int next; - - next= mpeg1_find_frame_end(s2, buf, buf_size); + int next= mpeg1_find_frame_end(s2, buf, buf_size); if( ff_combine_frame(s2, next, &buf, &buf_size) < 0 ) return buf_size; @@ -2288,7 +2286,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, if (ret == DECODE_SLICE_EOP) { if(s2->last_picture_ptr) //FIXME merge with the stuff in mpeg_decode_slice *data_size = sizeof(AVPicture); - return FFMAX(1, buf_ptr - buf - s2->parse_context.last_index); + return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); }else if(ret < 0){ if(ret == DECODE_SLICE_ERROR) ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR); -- cgit v1.1