From 867156407ce95ceec5d1ffc8886cc0812adfff7b Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Mon, 17 Mar 2003 15:25:10 +0000 Subject: fix decoder reset: when waiting for I and P frames, to get the necessary reference frames, we have to evaluate the frame types earlier, because on some DVDs with interlaced NTSC material, the fields of the frames are interwoven in a way that would overwrite the frame type with a new value before we evaluate it, this leads to xine endlessly waiting for I or P frames. enabling seek_mode on decoder reset also fixes some seeking artifacts CVS patchset: 4437 CVS date: 2003/03/17 15:25:10 --- src/libmpeg2/decode.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/libmpeg2/decode.c') diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index f1ee8a14c..54d9c2b72 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -249,13 +249,8 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (((picture->picture_structure == FRAME_PICTURE) || (picture->second_field)) ) { - if (mpeg2dec->drop_frame || - (picture->picture_coding_type == B_TYPE && mpeg2dec->is_wait_for_ip_frames > 0) || - (picture->picture_coding_type == P_TYPE && mpeg2dec->is_wait_for_ip_frames > 1)) { + if (mpeg2dec->drop_frame) picture->current_frame->bad_frame = 1; - } else if (picture->picture_coding_type != D_TYPE && mpeg2dec->is_wait_for_ip_frames > 0) { - mpeg2dec->is_wait_for_ip_frames--; - } if (picture->picture_coding_type == B_TYPE) { if( picture->current_frame && !picture->current_frame->drawn ) { @@ -319,6 +314,11 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture->backward_reference_frame->bad_frame); else printf ("fw ref frame not there)\n"); +#endif + mpeg2dec->drop_frame = 1; + } else if (mpeg2dec->is_wait_for_ip_frames > 0) { +#ifdef LOG + printf("libmpeg2: dropping b-frame because refs are invalid\n"); #endif mpeg2dec->drop_frame = 1; } @@ -344,7 +344,14 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, else printf ("libmpeg2: dropping p-frame because ref %d is bad\n", picture->backward_reference_frame->id); #endif - } + } else if (mpeg2dec->is_wait_for_ip_frames > 1) { +#ifdef LOG + printf("libmpeg2: dropping p-frame because ref is invalid\n"); +#endif + mpeg2dec->drop_frame = 1; + } else if (mpeg2dec->is_wait_for_ip_frames) + mpeg2dec->is_wait_for_ip_frames--; + break; case I_TYPE: @@ -356,6 +363,10 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, mpeg2dec->drop_frame = 1; } */ + + if (mpeg2dec->is_wait_for_ip_frames) + mpeg2dec->is_wait_for_ip_frames--; + break; } } @@ -620,6 +631,7 @@ void mpeg2_reset (mpeg2dec_t * mpeg2dec) { } mpeg2dec->in_slice = 0; + mpeg2dec->seek_mode = 1; } -- cgit v1.2.3