diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-03-17 15:25:10 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-03-17 15:25:10 +0000 |
commit | 867156407ce95ceec5d1ffc8886cc0812adfff7b (patch) | |
tree | a525c3c9b2c92e3153e0e9f819005d861092b67c | |
parent | 5efa8b81efc0116c9b982aca9429f3c217bab317 (diff) | |
download | xine-lib-867156407ce95ceec5d1ffc8886cc0812adfff7b.tar.gz xine-lib-867156407ce95ceec5d1ffc8886cc0812adfff7b.tar.bz2 |
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
-rw-r--r-- | src/libmpeg2/decode.c | 26 |
1 files changed, 19 insertions, 7 deletions
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 ) { @@ -321,6 +316,11 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, 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; } break; @@ -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; } |