From 9906645c4669be8476c683b7dfcf321b99ac15a1 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Fri, 20 Apr 2001 18:01:30 +0000 Subject: libmpeg2 compiles again CVS patchset: 10 CVS date: 2001/04/20 18:01:30 --- src/libmpeg2/decode.c | 47 +++++++++------ src/libmpeg2/header.c | 34 +++++++++++ src/libmpeg2/mpeg2_internal.h | 1 + src/xine-engine/xine_internal.h | 127 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 189 insertions(+), 20 deletions(-) (limited to 'src') 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 +#include #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; diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index d05736330..6ed35a91b 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -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_internal.h,v 1.2 2001/04/19 09:46:57 f1rmb Exp $ + * $Id: xine_internal.h,v 1.3 2001/04/20 18:01:55 guenter Exp $ * */ @@ -77,6 +77,131 @@ typedef struct xine_s { } xine_t; +/* + * player status constants: + */ + +#define XINE_STOP 0 +#define XINE_PLAY 1 +#define XINE_PAUSE 2 +#define XINE_QUIT 3 + +/* + * read config file and init a config object + * (if it exists) + */ +config_values_t *config_file_init (char *filename); + +/* + * init xine - call once at startup + * + */ + +xine_t *xine_init (vo_instance_t *vo, + ao_functions_t *ao, + gui_status_callback_func_t gui_status_callback, + config_values_t *config, int demux_strategy, uint32_t debug_lvl) ; + +/* + * open a stream and play it + * + * name : mrl to open + * pos : start position 0..65535 + * + */ +void xine_play (xine_t *this, char *MRL, int pos); + + +/* + * toggle pause mode + */ +void xine_pause (xine_t *this); + + +/* + * stop playing + */ +void xine_stop (xine_t *this); + +/* + * tell current input plugin to eject media. + */ +int xine_eject(xine_t *this); + +/* + * return current status (XINE_PLAY/XINE_STOP...) + */ +int xine_get_status (xine_t *this); + +/* + * get current position in stream + * returns position (range : 0 - 65535) + */ +int xine_get_current_position (xine_t *this); + +/* + * return the current audio channel + */ +int xine_get_audio_channel (xine_t *this); + +/* + * set desired audio channel + */ +void xine_select_audio_channel (xine_t *this, int channel); + +/* + * return the current SPU channel + */ +int xine_get_spu_channel (xine_t *this); + +/* + * set desired SPU channel + */ +void xine_select_spu_channel (xine_t *this, int channel); + +/* + * exit xine + */ +void xine_exit (xine_t *this); + +/* + * browsing support + */ + +/* + * some input plugins are browseable + * returns a list of ids of these plugins + */ +char **xine_get_browsable_input_plugin_ids (xine_t *this) ; + +/* + * browse function + * asks input plugin named to return + * a list of available MRLs in domain/directory + * + * start_mrl may be NULL indicating the toplevel domain/dir + * returns start_mrl if start_mrl is a valid MRL, not a directory + * returns NULL if start_mrl is an invalid MRL, not even a directory + */ + +char **xine_get_browse_mrls (xine_t *this, char *plugin_id, + char *start_mrl); + +/* + * autoplay support + */ + +/* + * some input plugins can generate autoplay lists + * returns a list of ids of these plugins + */ +char **xine_get_autoplay_input_plugin_ids (xine_t *this) ; + +/* + * get autoplay MRL list for input plugin named + */ +char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id); + /* * Load input/demux/audio_out/video_out plugins * prototypes of load_plugins.c functions. -- cgit v1.2.3