Mercurial > libavcodec.hg
diff mpeg12.c @ 9090:cecf81f93756 libavcodec
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)
| author | michael |
|---|---|
| date | Mon, 02 Mar 2009 14:53:18 +0000 |
| parents | 0d39a5203bf0 |
| children | 54bc8a2727b0 |
line wrap: on
line diff
--- a/mpeg12.c Mon Mar 02 09:22:17 2009 +0000 +++ b/mpeg12.c Mon Mar 02 14:53:18 2009 +0000 @@ -2196,7 +2196,7 @@ * Finds the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ -int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) +int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s) { int i; uint32_t state= pc->state; @@ -2244,6 +2244,9 @@ return i-3; } } + if(s && state == PICTURE_START_CODE){ + ff_fetch_timestamp(s, i-4, 1); + } } } pc->state= state; @@ -2276,7 +2279,7 @@ } if(s2->flags&CODEC_FLAG_TRUNCATED){ - int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size); + int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL); if( ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 ) return buf_size;
