diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-04-20 18:01:30 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-04-20 18:01:30 +0000 |
commit | 9906645c4669be8476c683b7dfcf321b99ac15a1 (patch) | |
tree | b14c4c012b200f1cbe9f6dfbb2c39b5d1120b296 /src/libmpeg2 | |
parent | 427f43f1cb7c7c68aeab0dc0a06dbded6bb3a8e3 (diff) | |
download | xine-lib-9906645c4669be8476c683b7dfcf321b99ac15a1.tar.gz xine-lib-9906645c4669be8476c683b7dfcf321b99ac15a1.tar.bz2 |
libmpeg2 compiles again
CVS patchset: 10
CVS date: 2001/04/20 18:01:30
Diffstat (limited to 'src/libmpeg2')
-rw-r--r-- | src/libmpeg2/decode.c | 47 | ||||
-rw-r--r-- | src/libmpeg2/header.c | 34 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2_internal.h | 1 |
3 files changed, 63 insertions, 19 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 77e198fbf..e8c22551b 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -101,9 +101,10 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (((picture->picture_structure == FRAME_PICTURE) || (picture->second_field)) && (!(mpeg2dec->drop_frame))) { - vo_draw ((picture->picture_coding_type == B_TYPE) ? - picture->current_frame : - picture->forward_reference_frame); + if (picture->picture_coding_type == B_TYPE) + picture->current_frame->draw (picture->current_frame); + else + picture->forward_reference_frame->draw (picture->forward_reference_frame); #ifdef ARCH_X86 if (config.flags & MM_ACCEL_X86_MMX) emms (); @@ -134,19 +135,18 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, } if (mpeg2dec->is_sequence_needed) { mpeg2dec->is_sequence_needed = 0; - if (vo_setup (mpeg2dec->output, picture->coded_picture_width, - picture->coded_picture_height)) { - fprintf (stderr, "display setup failed\n"); - exit (1); - } + picture->forward_reference_frame = - vo_get_frame (mpeg2dec->output, - VO_PREDICTION_FLAG | VO_BOTH_FIELDS); + mpeg2dec->output->get_frame (mpeg2dec->output,picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, IMGFMT_YV12, + picture->frame_duration); picture->backward_reference_frame = - vo_get_frame (mpeg2dec->output, - VO_PREDICTION_FLAG | VO_BOTH_FIELDS); + mpeg2dec->output->get_frame (mpeg2dec->output,picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, IMGFMT_YV12, + picture->frame_duration); } - mpeg2dec->frame_rate_code = picture->frame_rate_code; /* FIXME */ break; case 0xb5: /* extension_start_code */ @@ -167,23 +167,32 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, mpeg2dec->in_slice = 1; if (picture->second_field) - vo_field (picture->current_frame, picture->picture_structure); - /* + 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); + mpeg2dec->output->get_frame (mpeg2dec->output,picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, IMGFMT_YV12, + picture->frame_duration); + /* vo_get_frame (mpeg2dec->output, + picture->picture_structure); */ else { picture->current_frame = + mpeg2dec->output->get_frame (mpeg2dec->output,picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, IMGFMT_YV12, + picture->frame_duration); + /* 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)) { @@ -264,7 +273,7 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec) mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4, mpeg2dec->pts); if (! (mpeg2dec->is_sequence_needed)) - vo_draw (mpeg2dec->picture->backward_reference_frame); + mpeg2dec->picture->backward_reference_frame->draw (mpeg2dec->picture->backward_reference_frame); free (mpeg2dec->chunk_buffer); free (mpeg2dec->picture); diff --git a/src/libmpeg2/header.c b/src/libmpeg2/header.c index e021b2f8e..013393da4 100644 --- a/src/libmpeg2/header.c +++ b/src/libmpeg2/header.c @@ -22,6 +22,7 @@ #include "config.h" #include <inttypes.h> +#include <stdio.h> #include "mpeg2_internal.h" #include "attributes.h" @@ -94,6 +95,39 @@ int header_process_sequence_header (picture_t * picture, uint8_t * buffer) /* this is not used by the decoder */ picture->aspect_ratio_information = buffer[3] >> 4; picture->frame_rate_code = buffer[3] & 15; + + switch (picture->frame_rate_code) { + case 1: /* 23.976 fps */ + picture->frame_duration = 3913; + break; + case 2: /* 24 fps */ + picture->frame_duration = 3750; + break; + case 3: /* 25 fps */ + picture->frame_duration = 3600; + break; + case 4: /* 29.97 fps */ + picture->frame_duration = 3003; + break; + case 5: /* 30 fps */ + picture->frame_duration = 3000; + break; + case 6: /* 50 fps */ + picture->frame_duration = 1800; + break; + case 7: /* 59.94 fps */ + picture->frame_duration = 1525; + break; + case 8: /* 60 fps */ + picture->frame_duration = 1509; + break; + default: + printf ("invalid/unknown frame rate code : %d \n", + picture->frame_rate_code); + picture->frame_duration = 3000; + } + + picture->bitrate = (buffer[4]<<10)|(buffer[5]<<2)|(buffer[6]>>6); if (buffer[7] & 2) { diff --git a/src/libmpeg2/mpeg2_internal.h b/src/libmpeg2/mpeg2_internal.h index d3a92eb74..e2f2111d5 100644 --- a/src/libmpeg2/mpeg2_internal.h +++ b/src/libmpeg2/mpeg2_internal.h @@ -127,6 +127,7 @@ typedef struct picture_s { /* this is a temporary interface, we will build a better one later. */ int aspect_ratio_information; int frame_rate_code; + int frame_duration; int progressive_sequence; int repeat_first_field; int progressive_frame; |