From a4c7a5ea27050a28625eabf1ba98cfef9ac6620d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 2 Mar 2009 14:53:18 +0000 Subject: Call ff_fetch_timestamp() for mpeg1/2 when a picture start code is found instead of calling it at the end of a frame with a large negative offset. This significantly reduces the maximal distance in container packets between the point where the first byte of the "access unit" was stored and where we call ff_fetch_timestamp() thus reducing the constraints on our parser. Also change the parser from next_frame_offset to cur, this is needed because now the reference is from container packet start instead of frame start. (i previously misinterpreted this as bug) Originally committed as revision 17731 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpegvideo_parser.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'libavcodec/mpegvideo_parser.c') diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 2ccb9fff2c..215c86c400 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -29,7 +29,6 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, { ParseContext1 *pc = s->priv_data; const uint8_t *buf_end; - const uint8_t *buf_start= buf; uint32_t start_code; int frame_rate_index, ext_type, bytes_left; int frame_rate_ext_n, frame_rate_ext_d; @@ -44,8 +43,6 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, bytes_left = buf_end - buf; switch(start_code) { case PICTURE_START_CODE: - ff_fetch_timestamp(s, buf-buf_start-4, 1); - if (bytes_left >= 2) { s->pict_type = (buf[1] >> 3) & 7; } @@ -137,7 +134,7 @@ static int mpegvideo_parse(AVCodecParserContext *s, if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ next= buf_size; }else{ - next= ff_mpeg1_find_frame_end(pc, buf, buf_size); + next= ff_mpeg1_find_frame_end(pc, buf, buf_size, s); if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; -- cgit v1.2.3