From 6fa85d5188519997e3b8f19386a82f370610d39d Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Tue, 1 May 2001 02:28:59 +0000 Subject: libmpeg2 fixes CVS patchset: 52 CVS date: 2001/05/01 02:28:59 --- src/libmpeg2/decode.c | 70 ++++++++++++++++++++------------------------ src/video_out/video_out_xv.c | 4 ++- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 072622075..ce1bb7290 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -111,7 +111,21 @@ static void decode_reorder_frames (mpeg2dec_t * mpeg2dec) IMGFMT_YV12, picture->frame_duration);; picture->backward_reference_frame->PTS = 0; - picture->backward_reference_frame->bFrameBad = 1; + /*picture->backward_reference_frame->bFrameBad = 1; */ + + + if (!picture->forward_reference_frame) { + + picture->forward_reference_frame = mpeg2dec->output->get_frame (mpeg2dec->output, + picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, + IMGFMT_YV12, + picture->frame_duration);; + picture->forward_reference_frame->PTS = 0; + /*picture->forward_reference_frame->bFrameBad = 1; */ + } + /* * make it the current frame @@ -126,13 +140,13 @@ static void decode_reorder_frames (mpeg2dec_t * mpeg2dec) */ picture->throwaway_frame = mpeg2dec->output->get_frame (mpeg2dec->output, - picture->coded_picture_width, - picture->coded_picture_height, - picture->aspect_ratio_information, - IMGFMT_YV12, - picture->frame_duration);; + picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, + IMGFMT_YV12, + picture->frame_duration);; picture->throwaway_frame->PTS = 0; - picture->throwaway_frame->bFrameBad = 1; + /*picture->throwaway_frame->bFrameBad = 1; */ /* * make it the current frame @@ -160,14 +174,17 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 is_frame_done = mpeg2dec->in_slice && ((!code) || (code >= 0xb0)); if (is_frame_done) { + mpeg2dec->in_slice = 0; if ((picture->picture_structure == FRAME_PICTURE) || (picture->second_field)) { if (picture->picture_coding_type == B_TYPE) { + picture->throwaway_frame->bFrameBad = !mpeg2dec->drop_frame; picture->throwaway_frame->draw (picture->throwaway_frame); picture->throwaway_frame->free (picture->throwaway_frame); } else { + picture->forward_reference_frame->bFrameBad = !mpeg2dec->drop_frame; picture->forward_reference_frame->draw (picture->forward_reference_frame); } bFlipPage = 1; @@ -199,14 +216,13 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 switch (picture->picture_coding_type) { case B_TYPE: - if (mpeg2dec->frames_to_drop) { + if (mpeg2dec->frames_to_drop>0) { mpeg2dec->drop_frame = 1; mpeg2dec->frames_to_drop--; - } - if (!picture->forward_reference_frame - || !picture->backward_reference_frame - || picture->forward_reference_frame->bFrameBad - || picture->backward_reference_frame->bFrameBad) { + } else if (!picture->forward_reference_frame + || !picture->backward_reference_frame + || picture->forward_reference_frame->bFrameBad + || picture->backward_reference_frame->bFrameBad) { mpeg2dec->drop_frame = 1; mpeg2dec->frames_to_drop--; } @@ -217,10 +233,8 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 if (mpeg2dec->frames_to_drop>2) { mpeg2dec->drop_frame = 1; mpeg2dec->frames_to_drop--; - } - - if (!picture->forward_reference_frame - || picture->forward_reference_frame->bFrameBad) { + } else if (!picture->forward_reference_frame + || picture->forward_reference_frame->bFrameBad) { mpeg2dec->drop_frame = 1; mpeg2dec->frames_to_drop--; } @@ -268,26 +282,9 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 if (picture->second_field) picture->current_frame->field (picture->current_frame, picture->picture_structure); - /* - else { - if (picture->picture_coding_type == B_TYPE) - picture->current_frame = - vo_get_frame (mpeg2dec->output, - picture->picture_structure); - else { - picture->current_frame = - vo_get_frame (mpeg2dec->output, - (VO_PREDICTION_FLAG | - picture->picture_structure)); - picture->forward_reference_frame = - picture->backward_reference_frame; - picture->backward_reference_frame = picture->current_frame; - } - } - */ } - if (!(mpeg2dec->drop_frame)) { + if (!mpeg2dec->drop_frame) { slice_process (picture, code, buffer); } } @@ -307,8 +304,6 @@ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, chunk_ptr = mpeg2dec->chunk_ptr; mpeg2dec->pts = pts; - printf ("mpeg2_decode_data\n"); - while (current != end) { while (1) { byte = *current++; @@ -331,7 +326,6 @@ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, /* found start_code following chunk */ - printf ("mpeg2: parse_chunk\n"); ret += parse_chunk (mpeg2dec, mpeg2dec->code, mpeg2dec->chunk_buffer, pts); /* done with header or slice, prepare for next one */ diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 17a94d1dd..6b3675e6d 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.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_out_xv.c,v 1.8 2001/04/28 22:29:36 guenter Exp $ + * $Id: video_out_xv.c,v 1.9 2001/05/01 02:29:00 guenter Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -153,6 +153,8 @@ static void xv_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { + printf ("video_out_xv: updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); + XLockDisplay (this->display); /* -- cgit v1.2.3