From 0b83a00429a792a0f8dd39119f3849e173dc0ec5 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Wed, 7 Nov 2012 22:37:48 +0100 Subject: [PATCH] HACK: preserve mpeg2 END_OF_SEQ code to the start of the next frame to cause a implicit decoder flush --- libavcodec/mpegvideo_parser.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 2cd0348317..8df6b779bf 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -75,9 +75,15 @@ static int mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, pc->frame_start_found = 4; } if (state == SEQ_END_CODE) { + int idx = i + 1; + /* DVDs won't send the next frame start on still images */ + /* SEQ_END_CODE will have to stay at the beginning of the next frame */ + if (pc->frame_start_found && i != 3) { + idx = i - 3; + } pc->frame_start_found = 0; pc->state = -1; - return i + 1; + return idx; } if (pc->frame_start_found == 2 && state == SEQ_START_CODE) pc->frame_start_found = 0;