From 9bb1534ad8e6e3becfe01407e71da3f14421bc69 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Wed, 11 Jul 2001 22:42:47 +0000 Subject: fixed segfault for field picture based streams CVS patchset: 272 CVS date: 2001/07/11 22:42:47 --- src/libmpeg2/decode.c | 19 ++++++++++++------- src/libmpeg2/xine_decoder.c | 4 +++- src/xine-engine/video_decoder.c | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index ebb6b95e1..92a9d6033 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -76,7 +76,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture_t * picture; int is_frame_done; - /* printf ("libmpeg2: parse_chunk 0x%02x\n", code); */ + /* printf ("libmpeg2: parse_chunk 0x%02x\n", code); */ /* wait for sequence_header_code */ if (mpeg2dec->is_sequence_needed) { @@ -99,7 +99,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (is_frame_done) { mpeg2dec->in_slice = 0; - if (((picture->picture_structure == FRAME_PICTURE) || + if ( picture->current_frame && ((picture->picture_structure == FRAME_PICTURE) || (picture->second_field)) ) { picture->current_frame->bFrameBad |= mpeg2dec->drop_frame; @@ -232,10 +232,13 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (!(mpeg2dec->in_slice)) { mpeg2dec->in_slice = 1; - if (picture->second_field) - picture->current_frame->field(picture->current_frame, - picture->picture_structure); - else { + if (picture->second_field) { + if (picture->current_frame) + picture->current_frame->field(picture->current_frame, + picture->picture_structure); + else + mpeg2dec->drop_frame = 1; + } else { if (picture->picture_coding_type == B_TYPE) picture->throwaway_frame = picture->current_frame = mpeg2dec->output->get_frame (mpeg2dec->output, @@ -266,6 +269,8 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, } if (!(mpeg2dec->drop_frame)) { + /* printf ("slice_process\n"); */ + slice_process (picture, code, buffer); #ifdef ARCH_X86 @@ -275,7 +280,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, } } - /* printf ("parse_chunk %d completed\n", code); */ + /* printf ("parse_chunk %d completed\n", code); */ return is_frame_done; } diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 7490e9e56..3f9d8ef4d 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.9 2001/06/16 14:34:49 guenter Exp $ + * $Id: xine_decoder.c,v 1.10 2001/07/11 22:42:47 guenter Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -58,8 +58,10 @@ static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) if (buf->decoder_info[0] == 0) { mpeg2_find_sequence_header (&this->mpeg2, buf->content, buf->content + buf->size); } else { + mpeg2_decode_data (&this->mpeg2, buf->content, buf->content + buf->size, buf->PTS); + } } diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 77cc12e54..d17defff0 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.28 2001/06/24 22:20:26 guenter Exp $ + * $Id: video_decoder.c,v 1.29 2001/07/11 22:42:47 guenter Exp $ * */ @@ -85,7 +85,7 @@ void *video_decoder_loop (void *this_gen) { } - decoder->decode_data (this->cur_video_decoder_plugin, buf); + decoder->decode_data (this->cur_video_decoder_plugin, buf); } break; -- cgit v1.2.3