diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-08-04 03:47:09 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-08-04 03:47:09 +0000 |
commit | ed3497a1e20f74c28afc2124480c60fbdbf37fab (patch) | |
tree | 6ae75337cac3aa191151001085ed21d12e11385c | |
parent | b0f659b58e295ab3c4b1bac9ed59e9cb3f29f308 (diff) | |
download | xine-lib-ed3497a1e20f74c28afc2124480c60fbdbf37fab.tar.gz xine-lib-ed3497a1e20f74c28afc2124480c60fbdbf37fab.tar.bz2 |
support for arbitrary aspect ratios
patch by Philip Jgenstedt
CVS patchset: 5243
CVS date: 2003/08/04 03:47:09
66 files changed, 536 insertions, 599 deletions
diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c index f50374a34..2f5a918ad 100644 --- a/src/dxr3/dxr3_decode_video.c +++ b/src/dxr3/dxr3_decode_video.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: dxr3_decode_video.c,v 1.36 2003/06/18 13:03:45 mroi Exp $ + * $Id: dxr3_decode_video.c,v 1.37 2003/08/04 03:47:09 miguelfreitas Exp $ */ /* dxr3 video decoder plugin. @@ -115,6 +115,7 @@ typedef struct dxr3_decoder_s { int sequence_open; int width; int height; + double ratio; int aspect; int frame_rate_code; int repeat_first_field; /* mpeg stream header data */ @@ -379,7 +380,7 @@ static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf) /* pretend like we have decoded a frame */ img = this->stream->video_out->get_frame(this->stream->video_out, - this->width, this->height, this->aspect, + this->width, this->height, this->ratio, XINE_IMGFMT_DXR3, VO_BOTH_FIELDS); img->pts = buf->pts; img->bad_frame = 0; @@ -659,6 +660,7 @@ static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer) buffer[HEADER_OFFSET+2]; this->width = ((this->height >> 12) + 15) & ~15; this->height = ((this->height & 0xfff) + 15) & ~15; + this->ratio = (double)this->width/(double)this->height; this->aspect = buffer[HEADER_OFFSET+3] >> 4; this->have_header_info = 1; diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index ee9a795d1..ec8e8ac2e 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.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_dxr3.c,v 1.82 2003/05/31 18:33:28 miguelfreitas Exp $ + * $Id: video_out_dxr3.c,v 1.83 2003/08/04 03:47:09 miguelfreitas Exp $ */ /* mpeg1 encoding video out plugin for the dxr3. @@ -109,7 +109,7 @@ static void dxr3_frame_field(vo_frame_t *vo_img, int which_field); static void dxr3_frame_dispose(vo_frame_t *frame_gen); static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags); + double ratio, int format, int flags); static void dxr3_overlay_begin(vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed); static void dxr3_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay); @@ -356,7 +356,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v "video_out_dxr3: driver. See the README.dxr3 for details on configuring an encoder.\n"); /* init aspect */ - dxr3_set_property(&this->vo_driver, VO_PROP_ASPECT_RATIO, ASPECT_FULL); + dxr3_set_property(&this->vo_driver, VO_PROP_ASPECT_RATIO, XINE_VO_ASPECT_4_3); /* init brightness/contrast/saturation */ dxr3_set_property(&this->vo_driver, VO_PROP_BRIGHTNESS, 500); @@ -536,7 +536,7 @@ static void dxr3_frame_dispose(vo_frame_t *frame_gen) } static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, - uint32_t width, uint32_t height, int ratio_code, int format, int flags) + uint32_t width, uint32_t height, double ratio, int format, int flags) { dxr3_driver_t *this = (dxr3_driver_t *)this_gen; dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; @@ -557,11 +557,11 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge this->video_iheight = height; this->video_oheight = height; this->top_bar = 0; - this->video_ratio = ratio_code; + this->video_ratio = ratio; frame->vo_frame.width = width; frame->vo_frame.height = height; - frame->vo_frame.ratio = ratio_code; + frame->vo_frame.ratio = ratio; frame->oheight = height; frame->aspect = 0; @@ -577,7 +577,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* the following is for the mpeg encoding part only */ - frame->vo_frame.ratio = ratio_code; + frame->vo_frame.ratio = ratio; frame->pan_scan = 0; frame->aspect = this->aspect; oheight = this->video_oheight; @@ -589,36 +589,19 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge if (this->add_bars == 0) { /* don't add black bars; assume source is in 4:3 */ - ratio_code = XINE_VO_ASPECT_4_3; + ratio = 4.0/3.0; } if ((this->video_width != width) || (this->video_iheight != height) || - (this->video_ratio != ratio_code)) { - double video_aspect; - - /* check aspect ratio, see if we need to add black borders */ - switch (ratio_code) { - case XINE_VO_ASPECT_4_3: - video_aspect = 4.0 / 3.0; - break; - case XINE_VO_ASPECT_ANAMORPHIC: - case XINE_VO_ASPECT_PAN_SCAN: - video_aspect = 16.0 / 9.0; - break; - case XINE_VO_ASPECT_DVB: - video_aspect = 2.11; - break; - default: /* assume square pixel */ - video_aspect = (double)width / (double)height; - } + (this->video_ratio != ratio)) { /* try anamorphic */ - frame->aspect = ASPECT_ANAMORPHIC; - oheight = height * (video_aspect / (16.0 / 9.0)); + frame->aspect = XINE_VO_ASPECT_ANAMORPHIC; + oheight = height * (ratio / (16.0 / 9.0)); if (oheight < height) { /* frame too high, try 4:3 */ - frame->aspect = ASPECT_FULL; - oheight = height * (video_aspect / (4.0 / 3.0)); + frame->aspect = XINE_VO_ASPECT_4_3; + oheight = height * (ratio / (4.0 / 3.0)); } if (oheight < height) { /* still too high, use full height */ @@ -631,12 +614,12 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* Tell the viewers about the aspect ratio stuff. */ if (oheight - height > 0) printf("video_out_dxr3: adding %d black lines to get %s aspect ratio.\n", - oheight - height, frame->aspect == ASPECT_FULL ? "4:3" : "16:9"); + oheight - height, frame->aspect == XINE_VO_ASPECT_4_3 ? "4:3" : "16:9"); this->video_width = width; this->video_iheight = height; this->video_oheight = oheight; - this->video_ratio = ratio_code; + this->video_ratio = ratio; this->scale.force_redraw = 1; this->need_update = 1; @@ -853,46 +836,33 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) /* aspect not determined yet, set it now */ frame->aspect = this->aspect; frame->pan_scan = 0; - switch (frame->vo_frame.ratio) { - case XINE_VO_ASPECT_SQUARE: - case XINE_VO_ASPECT_4_3: - frame->aspect = ASPECT_FULL; - break; - case XINE_VO_ASPECT_PAN_SCAN: - if (!this->overlay_enabled) frame->pan_scan = 1; - case XINE_VO_ASPECT_ANAMORPHIC: - case XINE_VO_ASPECT_DVB: - frame->aspect = ASPECT_ANAMORPHIC; - } + + if (frame->vo_frame.ratio < 1.4) + frame->aspect = XINE_VO_ASPECT_4_3; + else + frame->aspect = XINE_VO_ASPECT_ANAMORPHIC; } - if ((this->widescreen_enabled ? ASPECT_FULL : frame->aspect) != this->aspect) + + if ((this->widescreen_enabled ? XINE_VO_ASPECT_4_3 : frame->aspect) != this->aspect) dxr3_set_property(this_gen, VO_PROP_ASPECT_RATIO, - (this->widescreen_enabled ? ASPECT_FULL : frame->aspect)); - if (frame->pan_scan && !this->pan_scan) { - dxr3_set_property(this_gen, VO_PROP_ZOOM_X, 1); - this->pan_scan = 1; - } - if (!frame->pan_scan && this->pan_scan) { - this->pan_scan = 0; - dxr3_set_property(this_gen, VO_PROP_ZOOM_X, -1); - } + (this->widescreen_enabled ? XINE_VO_ASPECT_4_3 : frame->aspect)); #ifdef HAVE_X11 if (this->overlay_enabled) { - if (this->scale.force_redraw || - this->scale.delivered_width != frame_gen->width || - this->scale.delivered_height != frame->oheight || - this->scale.delivered_ratio_code != frame_gen->ratio || - this->scale.user_ratio != (this->widescreen_enabled ? frame->aspect : ASPECT_FULL)) { - - this->scale.delivered_width = frame_gen->width; - this->scale.delivered_height = frame->oheight; - this->scale.delivered_ratio_code = frame_gen->ratio; - this->scale.user_ratio = (this->widescreen_enabled ? frame->aspect : ASPECT_FULL); - this->scale.force_redraw = 1; - + if (this->scale.force_redraw || + this->scale.delivered_width != frame_gen->width || + this->scale.delivered_height != frame->oheight || + this->scale.delivered_ratio != frame_gen->ratio || + this->scale.user_ratio != (this->widescreen_enabled ? frame->aspect : XINE_VO_ASPECT_4_3)) { + + this->scale.delivered_width = frame_gen->width; + this->scale.delivered_height = frame->oheight; + this->scale.delivered_ratio = frame_gen->ratio; + this->scale.user_ratio = (this->widescreen_enabled ? frame->aspect : XINE_VO_ASPECT_4_3); + this->scale.force_redraw = 1; + vo_scale_compute_ideal_size(&this->scale); - + /* prepare the overlay window */ dxr3_overlay_update(this); } @@ -986,7 +956,10 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) case VO_PROP_ASPECT_RATIO: /* xitk-ui increments the value, so we make * just a two value "loop" */ - if (value > ASPECT_FULL) value = ASPECT_ANAMORPHIC; + /* + if (value != ASPECT_FULL && value != ASPECT_AUTO) + value = ASPECT_ANAMORPHIC; + */ this->aspect = value; if (this->pan_scan) break; if (this->widescreen_enabled) { @@ -995,7 +968,7 @@ static int dxr3_set_property(vo_driver_t *this_gen, int property, int value) break; } - if (value == ASPECT_ANAMORPHIC) { + if (value == XINE_VO_ASPECT_ANAMORPHIC) { #if LOG_VID printf("video_out_dxr3: setting aspect ratio to anamorphic\n"); #endif diff --git a/src/dxr3/video_out_dxr3.h b/src/dxr3/video_out_dxr3.h index 64ea4a22c..3c6c40359 100644 --- a/src/dxr3/video_out_dxr3.h +++ b/src/dxr3/video_out_dxr3.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: video_out_dxr3.h,v 1.16 2003/05/25 18:36:51 mroi Exp $ + * $Id: video_out_dxr3.h,v 1.17 2003/08/04 03:47:09 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -110,7 +110,7 @@ typedef struct dxr3_driver_s { int video_iheight; /* input height (before adding black bars) */ int video_oheight; /* output height (after adding black bars) */ int video_width; - int video_ratio; + double video_ratio; int top_bar; /* the height of the upper black bar */ vo_scale_t scale; diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c index 34191dafa..c70e7753e 100644 --- a/src/libdivx4/xine_decoder.c +++ b/src/libdivx4/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.44 2002/12/06 01:44:06 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.45 2003/08/04 03:47:09 miguelfreitas Exp $ * * xine decoder plugin using divx4 * @@ -90,6 +90,7 @@ typedef struct divx4_decoder_s { unsigned char *buf; int size; int bufsize; + double ratio; decoreFunc decore; /* ptr to decore function in libdivxdecore */ @@ -255,6 +256,8 @@ static int divx4_init_decoder(divx4_decoder_t *this, buf_element_t *buf) { buf->type & 0xFFFF0000); } + this->ratio = (double)this->bih.biWidth/(double)this->bih.biWidth; + /* setup decoder; inspired by avifile's plugin */ param.x_dim=this->bih.biWidth; param.y_dim=this->bih.biHeight; @@ -421,7 +424,7 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* need to decode a frame */ /* allocate image (taken from ffmpeg plugin) */ img = this->video_out->get_frame (this->video_out, this->bih.biWidth, - this->bih.biHeight, XINE_VO_ASPECT_DONT_TOUCH, + this->bih.biHeight, this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index c400cfb7a..9f22df6c4 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/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.128 2003/06/21 22:32:08 tmmm Exp $ + * $Id: xine_decoder.c,v 1.129 2003/08/04 03:47:09 miguelfreitas Exp $ * * xine decoder plugin using ffmpeg * @@ -100,7 +100,6 @@ struct ff_video_decoder_s { int is_continous; float aspect_ratio; - int xine_aspect_ratio; int frame_flags; int output_format; @@ -166,7 +165,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ img = this->stream->video_out->get_frame (this->stream->video_out, width, height, - this->xine_aspect_ratio, + (double)this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); @@ -944,42 +943,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { printf ("ffmpeg: got a picture\n"); #endif - if(this->context->aspect_ratio != this->aspect_ratio) { - float diff; - - this->xine_aspect_ratio = XINE_VO_ASPECT_DONT_TOUCH; - - diff = abs_float( this->context->aspect_ratio - - (float)this->context->width/(float)this->context->height); - if ( abs_float (this->context->aspect_ratio) < 0.1 ) - diff = 0.0; - - if( diff > abs_float( this->context->aspect_ratio - 1.0 ) ) { - this->xine_aspect_ratio = XINE_VO_ASPECT_SQUARE; - diff = abs_float( this->context->aspect_ratio - 1.0 ); - } - - if( diff > abs_float( this->context->aspect_ratio - 4.0/3.0 ) ) { - this->xine_aspect_ratio = XINE_VO_ASPECT_4_3; - diff = abs_float( this->context->aspect_ratio - 4.0/3.0 ); - } - - if( diff > abs_float( this->context->aspect_ratio - 16.0/9.0 ) ) { - this->xine_aspect_ratio = XINE_VO_ASPECT_ANAMORPHIC; - diff = abs_float( this->context->aspect_ratio - 16.0/9.0 ); - } - - if( diff > abs_float( this->context->aspect_ratio - 1.0/2.0 ) ) { - this->xine_aspect_ratio = XINE_VO_ASPECT_DVB; - diff = abs_float( this->context->aspect_ratio - 1.0/2.0 ); - } - - this->aspect_ratio = this->context->aspect_ratio; - if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("ffmpeg: aspect ratio code %d selected for %.2f\n", - this->xine_aspect_ratio, this->aspect_ratio); - } - + this->aspect_ratio = this->context->aspect_ratio; if(this->av_frame->type == FF_BUFFER_TYPE_USER){ img = (vo_frame_t*)this->av_frame->opaque; @@ -988,7 +952,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, this->context->width, this->context->height, - this->xine_aspect_ratio, + (double)this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; @@ -1013,7 +977,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, img->width, img->height, - this->xine_aspect_ratio, + (double)this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; @@ -1211,7 +1175,6 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->is_continous = 0; this->aspect_ratio = 0; - this->xine_aspect_ratio = XINE_VO_ASPECT_DONT_TOUCH; this->pp_quality = 0; this->pp_context = NULL; @@ -1601,8 +1564,8 @@ static decoder_info_t dec_info_ffmpeg_audio = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 14, "ffmpegvideo", XINE_VERSION_CODE, &dec_info_ffmpeg_video, init_video_plugin }, - { PLUGIN_VIDEO_DECODER, 14, "ffmpeg-wmv8", XINE_VERSION_CODE, &dec_info_ffmpeg_experimental_video, init_video_plugin }, + { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 15, "ffmpegvideo", XINE_VERSION_CODE, &dec_info_ffmpeg_video, init_video_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "ffmpeg-wmv8", XINE_VERSION_CODE, &dec_info_ffmpeg_experimental_video, init_video_plugin }, { PLUGIN_AUDIO_DECODER, 13, "ffmpegaudio", XINE_VERSION_CODE, &dec_info_ffmpeg_audio, init_audio_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 783ae944c..372afd403 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -160,18 +160,19 @@ static void remember_metainfo (mpeg2dec_t *mpeg2dec) { mpeg2dec->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = picture->frame_height; switch (picture->aspect_ratio_information) { - case XINE_VO_ASPECT_PAN_SCAN: - case XINE_VO_ASPECT_ANAMORPHIC: + case 2: + mpeg2dec->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = 10000 * 4.0 / 3.0; + break; + case 3: mpeg2dec->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = 10000 * 16.0 /9.0; break; - case XINE_VO_ASPECT_DVB: /* 2.11:1 */ + case 4: /* 2.11:1 */ mpeg2dec->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = 10000 * 2.11/1.0; break; - case XINE_VO_ASPECT_SQUARE: /* square pels */ - mpeg2dec->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = 10000; - break; + case 1: /* square pels */ default: - mpeg2dec->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = 10000 * 4.0 / 3.0; + mpeg2dec->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = 10000 * + picture->frame_width/picture->frame_height; break; } @@ -215,6 +216,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, { picture_t * picture; int is_frame_done; + double ratio; /* wait for sequence_header_code */ if (mpeg2dec->is_sequence_needed) { @@ -456,13 +458,29 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, picture->current_frame != picture->forward_reference_frame ) { picture->current_frame->free (picture->current_frame); } - + /* these hardcoded values are defined on mpeg2 standard for + * aspect ratio. other values are reserved or forbidden. */ + switch(picture->aspect_ratio_information) { + case 2: + ratio = 4.0/3.0; + break; + case 3: + ratio = 16.0/9.0; + break; + case 4: + ratio = 2.11/1.0; + break; + case 1: + default: + ratio = (double)picture->coded_picture_width/(double)picture->coded_picture_height; + break; + } if (picture->picture_coding_type == B_TYPE) picture->current_frame = mpeg2dec->stream->video_out->get_frame (mpeg2dec->stream->video_out, picture->coded_picture_width, picture->coded_picture_height, - picture->aspect_ratio_information, + ratio, XINE_IMGFMT_YV12, VO_INTERLACED_FLAG | picture->picture_structure); else { @@ -470,7 +488,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, mpeg2dec->stream->video_out->get_frame (mpeg2dec->stream->video_out, picture->coded_picture_width, picture->coded_picture_height, - picture->aspect_ratio_information, + ratio, XINE_IMGFMT_YV12, (VO_INTERLACED_FLAG | VO_PREDICTION_FLAG | picture->picture_structure)); if (picture->forward_reference_frame && diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 7232dd66b..073ed47e7 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.47 2002/12/26 21:53:42 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.48 2003/08/04 03:47:09 miguelfreitas Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -184,6 +184,6 @@ static decoder_info_t dec_info_mpeg2 = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "mpeg2", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "mpeg2", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libmpeg2new/xine_decoder.c b/src/libmpeg2new/xine_decoder.c index 05fb57b1f..c24721ae6 100644 --- a/src/libmpeg2new/xine_decoder.c +++ b/src/libmpeg2new/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 2003/06/19 01:58:25 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.10 2003/08/04 03:47:09 miguelfreitas Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -56,8 +56,7 @@ typedef struct mpeg2_video_decoder_s { mpeg2_class_t *class; xine_stream_t *stream; int32_t force_aspect; - int32_t aspect_ratio; - int32_t aspect_ratio_float; + double ratio; uint32_t img_state[30]; uint32_t frame_number; uint32_t rff_pattern; @@ -136,36 +135,26 @@ static void mpeg2_video_decode_data (video_decoder_t *this_gen, buf_element_t *b this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = info->sequence->picture_height; this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] = info->sequence->frame_period / 300; if (this->force_aspect > 0) { - this->aspect_ratio = this->force_aspect; switch (info->sequence->pixel_width) { - case XINE_VO_ASPECT_PAN_SCAN: - case XINE_VO_ASPECT_ANAMORPHIC: - this->aspect_ratio_float = 10000 * 16.0 /9.0; - break; - case XINE_VO_ASPECT_DVB: /* 2.11:1 */ - this->aspect_ratio_float = 10000 * 2.11/1.0; - break; - case XINE_VO_ASPECT_SQUARE: /* square pels */ - this->aspect_ratio_float = 10000; - break; - default: - this->aspect_ratio_float = 10000 * 4.0 / 3.0; - break; + case XINE_VO_ASPECT_PAN_SCAN: + case XINE_VO_ASPECT_ANAMORPHIC: + this->ratio = 16.0 /9.0; + break; + case XINE_VO_ASPECT_DVB: + this->ratio = 2.11; + break; + case XINE_VO_ASPECT_4_3: + this->ratio = 4.0 / 3.0; + break; + case XINE_VO_ASPECT_SQUARE: + default: + this->ratio = (double)info->sequence->picture_width/(double)info->sequence->picture_height; + break; } } else { - this->aspect_ratio_float = (10000 * info->sequence->pixel_width) / info->sequence->pixel_height; - if (this->aspect_ratio_float > 20000) { - this->aspect_ratio = XINE_VO_ASPECT_DVB; - } else if (this->aspect_ratio_float > 15000) { - this->aspect_ratio = XINE_VO_ASPECT_ANAMORPHIC; - } else if (this->aspect_ratio_float > 12000) { - this->aspect_ratio = XINE_VO_ASPECT_4_3; - } else { - this->aspect_ratio = XINE_VO_ASPECT_SQUARE; - } + this->ratio = (double)info->sequence->pixel_width/(double)info->sequence->pixel_height; } - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = this->aspect_ratio_float; - + this->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] = (int)(10000*this->ratio); if (info->sequence->flags & SEQ_FLAG_MPEG2) { this->stream->meta_info[XINE_META_INFO_VIDEOCODEC] = strdup ("MPEG 2 (libmpeg2new)"); @@ -186,7 +175,7 @@ static void mpeg2_video_decode_data (video_decoder_t *this_gen, buf_element_t *b img = this->stream->video_out->get_frame (this->stream->video_out, info->sequence->picture_width, info->sequence->picture_height, - this->aspect_ratio, /* Aspect ratio */ + this->ratio, XINE_IMGFMT_YV12, picture_structure); this->frame_number++; @@ -502,6 +491,6 @@ static decoder_info_t dec_info_mpeg2 = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "mpeg2new", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "mpeg2new", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 4e9d1251d..403a97bd4 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/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.47 2003/07/19 16:40:43 jstembridge Exp $ + * $Id: xine_decoder.c,v 1.48 2003/08/04 03:47:09 miguelfreitas Exp $ * * thin layer to use real binary-only codecs in xine * @@ -71,6 +71,7 @@ typedef struct realdec_decoder_s { void *context; uint32_t width, height; + double ratio; uint8_t *chunk_buffer; int chunk_buffer_size; @@ -186,6 +187,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { this->width = (init_data.w + 1) & (~1); this->height = (init_data.h + 1) & (~1); + this->ratio = (double)this->width/(double)this->height; #ifdef LOG printf ("libreal: init_data.w=%d(0x%x), init_data.h=%d(0x%x)," @@ -377,7 +379,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) /* this->av_picture.linesize[0], */ this->width, this->height, - 42, + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); @@ -653,6 +655,6 @@ static decoder_info_t dec_info_real = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 14, "real", XINE_VERSION_CODE, &dec_info_real, init_class }, + { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 15, "real", XINE_VERSION_CODE, &dec_info_real, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libtheora/xine_decoder.c b/src/libtheora/xine_decoder.c index 7f00fc7a2..c3e57a08a 100644 --- a/src/libtheora/xine_decoder.c +++ b/src/libtheora/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.12 2003/07/13 18:36:34 heinchen Exp $ + * $Id: xine_decoder.c,v 1.13 2003/08/04 03:47:10 miguelfreitas Exp $ * * xine decoder plugin using libtheora * @@ -63,6 +63,7 @@ typedef struct theora_decoder_s { char* packet; int done; int width, height; + double ratio; int offset_x, offset_y; int frame_duration; int skipframes; @@ -183,19 +184,26 @@ static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (this->hp_read==3) { /*headers are now decoded. initialize the decoder*/ theora_decode_init (&this->t_state, &this->t_info); - this->frame_duration=((int64_t)90000*this->t_info.fps_denominator)/this->t_info.fps_numerator; #ifdef LOG printf("libtheora: theora stream is Theora %dx%d %.02f fps video.\n" " frame content is %dx%d with offset (%d,%d).\n" - " aspect ratio is %d:%d.\n", + " pixel aspect is %d:%d.\n", this->t_info.width,this->t_info.height, (double)this->t_info.fps_numerator/this->t_info.fps_denominator, this->t_info.frame_width, this->t_info.frame_height, this->t_info.offset_x, this->t_info.offset_y, this->t_info.aspect_numerator, this->t_info.aspect_denominator); -#endif +#endif + this->frame_duration=((int64_t)90000*this->t_info.fps_denominator)/this->t_info.fps_numerator; this->width=this->t_info.frame_width; this->height=this->t_info.frame_height; + if (this->t_info.aspect_numerator==0 || this->t_info.aspect_denominator==0) + /* 0-values are undefined, so don't do any scaling. */ + this->ratio=(double)this->width/(double)this->height; + else + /* Yes, this video needs to be scaled. */ + this->ratio=(double)(this->width*this->t_info.aspect_numerator) / + (double)(this->height*this->t_info.aspect_denominator); this->offset_x=this->t_info.offset_x; this->offset_y=this->t_info.offset_y; this->initialized=1; @@ -227,7 +235,7 @@ static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /*fixme - aspectratio from theora is not considered*/ frame = this->stream->video_out->get_frame( this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_SQUARE, + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); yuv2frame(&yuv, frame, this->offset_x, this->offset_y); @@ -384,6 +392,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "theora", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "theora", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index 38c014cc0..fadcdae6d 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_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: qt_decoder.c,v 1.20 2003/05/10 04:26:18 tmmm Exp $ + * $Id: qt_decoder.c,v 1.21 2003/08/04 03:47:10 miguelfreitas Exp $ * * quicktime video/audio decoder plugin, using win32 dlls * most of this code comes directly from MPlayer @@ -688,6 +688,7 @@ typedef struct qtv_decoder_s { HINSTANCE qtml_dll; xine_bmiheader bih; + double ratio; int codec_initialized; @@ -1024,6 +1025,7 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { #endif memcpy (&this->bih, buf->content, sizeof (xine_bmiheader)); + this->ratio = (double)this->bih.biWidth / (double)this->bih.biHeight; /* video decoder only handles SVQ3 at this point */ this->stream->meta_info[XINE_META_INFO_VIDEOCODEC] = @@ -1086,7 +1088,7 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, this->bih.biWidth, this->bih.biHeight, - 42, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); @@ -1232,7 +1234,7 @@ static decoder_info_t qtv_dec_info = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 14, "qtv", XINE_VERSION_CODE, &qtv_dec_info, qtv_init_class }, + { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 15, "qtv", XINE_VERSION_CODE, &qtv_dec_info, qtv_init_class }, { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 13, "qta", XINE_VERSION_CODE, &qta_dec_info, qta_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 442ccf1b2..5742846a1 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.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: w32codec.c,v 1.124 2003/07/16 00:25:38 tmattern Exp $ + * $Id: w32codec.c,v 1.125 2003/08/04 03:47:10 miguelfreitas Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -141,6 +141,7 @@ typedef struct w32v_decoder_s { int decoder_ok; BITMAPINFOHEADER *bih, o_bih; + double ratio; char scratch1[16]; /* some codecs overflow o_bih */ HIC hic; int yuv_supported ; @@ -709,6 +710,8 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { memcpy ( this->bih, buf->content, buf->size ); this->video_step = buf->decoder_info[1]; + this->ratio = (double)this->bih->biWidth/(double)this->bih->biHeight; + this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->bih->biWidth; this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->bih->biHeight; this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] = this->video_step; @@ -783,7 +786,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, this->bih->biWidth, this->bih->biHeight, - 42, + this->ratio, IMGFMT_YUY2, VO_BOTH_FIELDS); @@ -1621,7 +1624,7 @@ static decoder_info_t dec_info_audio = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 14, "win32v", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_class }, + { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 15, "win32v", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_class }, { PLUGIN_AUDIO_DECODER | PLUGIN_MUST_PRELOAD, 13, "win32a", XINE_VERSION_CODE, &dec_info_audio, init_audio_decoder_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/cinepak.c b/src/libxinevdec/cinepak.c index ad22a7d89..f11f9e46c 100644 --- a/src/libxinevdec/cinepak.c +++ b/src/libxinevdec/cinepak.c @@ -22,7 +22,7 @@ * based on overview of Cinepak algorithm and example decoder * by Tim Ferguson: http://www.csse.monash.edu.au/~timf/ * - * $Id: cinepak.c,v 1.29 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: cinepak.c,v 1.30 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdlib.h> @@ -79,6 +79,7 @@ typedef struct cvid_decoder_s { unsigned int width; unsigned int height; + double ratio; } cvid_decoder_t; static unsigned char yuv_palette[256 * 4]; @@ -396,6 +397,7 @@ static void cvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { this->width = (bih->biWidth + 1) & ~0x1; this->height = (bih->biHeight + 1) & ~0x1; + this->ratio = (double)this->width/(double)this->height; this->coded_width = (this->width + 3) & ~0x3; this->coded_height = (this->height + 3) & ~0x3; this->luma_pitch = this->coded_width; @@ -444,7 +446,7 @@ static void cvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_SQUARE, + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); img->duration = this->video_step; @@ -558,6 +560,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "cinepak", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "cinepak", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/cyuv.c b/src/libxinevdec/cyuv.c index 22871cd82..570a94787 100644 --- a/src/libxinevdec/cyuv.c +++ b/src/libxinevdec/cyuv.c @@ -18,7 +18,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: cyuv.c,v 1.16 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: cyuv.c,v 1.17 2003/08/04 03:47:10 miguelfreitas Exp $ */ /* And this is the header that came with the CYUV decoder: */ @@ -74,6 +74,7 @@ typedef struct cyuv_decoder_s { int size; int width; int height; + double ratio; } cyuv_decoder_t; /* ------------------------------------------------------------------------ @@ -159,6 +160,7 @@ static void cyuv_decode_data (video_decoder_t *this_gen, this->size = 0; this->width = *(unsigned int *)&buf->content[4]; this->height = *(unsigned int *)&buf->content[8]; + this->ratio = (double)this->width/(double)this->height; this->skipframes = 0; this->video_step = buf->decoder_info[1]; @@ -182,7 +184,7 @@ static void cyuv_decode_data (video_decoder_t *this_gen, if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* time to decode a frame */ img = this->stream->video_out->get_frame (this->stream->video_out, - this->width, this->height, XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2, + this->width, this->height, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->pts = buf->pts; @@ -281,6 +283,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "cyuv", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "cyuv", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/fli.c b/src/libxinevdec/fli.c index 12045a760..5684aa93f 100644 --- a/src/libxinevdec/fli.c +++ b/src/libxinevdec/fli.c @@ -23,7 +23,7 @@ * avoid when implementing a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: fli.c,v 1.18 2003/02/08 15:39:07 tmmm Exp $ + * $Id: fli.c,v 1.19 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -76,6 +76,7 @@ typedef struct fli_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ /* FLI decoding parameters */ unsigned char yuv_palette[PALETTE_SIZE]; @@ -436,6 +437,7 @@ static void fli_decode_data (video_decoder_t *this_gen, /* RGB -> YUV converter requires even width */ this->width = (LE_16(&buf->content[8]) + 1) & ~0x1; this->height = LE_16(&buf->content[10]); + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; this->magic_number = LE_16(&buf->content[4]); @@ -473,7 +475,7 @@ static void fli_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -596,7 +598,7 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "fli", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "fli", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/foovideo.c b/src/libxinevdec/foovideo.c index 57c603f84..842158a07 100644 --- a/src/libxinevdec/foovideo.c +++ b/src/libxinevdec/foovideo.c @@ -23,7 +23,7 @@ * value from the last frame. This creates a slowly rotating solid color * frame when the frames are played in succession. * - * $Id: foovideo.c,v 1.14 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: foovideo.c,v 1.15 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -61,6 +61,7 @@ typedef struct foovideo_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ /* these are variables exclusive to the foo video decoder */ unsigned char current_yuv_byte; @@ -100,6 +101,7 @@ static void foovideo_decode_data (video_decoder_t *this_gen, bih = (xine_bmiheader *) buf->content; this->width = bih->biWidth; this->height = bih->biHeight; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; if (this->buf) @@ -135,7 +137,7 @@ static void foovideo_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; @@ -295,6 +297,6 @@ static decoder_info_t dec_info_video = { */ plugin_info_t xine_plugin_info[] = { /* { type, API, "name", version, special_info, init_function } */ - { PLUGIN_VIDEO_DECODER, 14, "foovideo", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "foovideo", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/idcinvideo.c b/src/libxinevdec/idcinvideo.c index 27fbc8931..97dd8cb93 100644 --- a/src/libxinevdec/idcinvideo.c +++ b/src/libxinevdec/idcinvideo.c @@ -21,7 +21,7 @@ * the Id CIN format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: idcinvideo.c,v 1.12 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: idcinvideo.c,v 1.13 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -59,6 +59,7 @@ typedef struct idcinvideo_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ unsigned char yuv_palette[256 * 4]; yuv_planes_t yuv_planes; @@ -253,6 +254,7 @@ static void idcinvideo_decode_data (video_decoder_t *this_gen, this->width = (buf->content[0] << 8) | buf->content[1]; this->height = (buf->content[2] << 8) | buf->content[3]; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; if (this->buf) @@ -288,7 +290,7 @@ static void idcinvideo_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -402,6 +404,6 @@ static decoder_info_t video_decoder_info = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "idcinvideo", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "idcinvideo", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index 8595493ad..c67d09fa4 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.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: image.c,v 1.4 2003/05/11 22:00:09 holstsn Exp $ + * $Id: image.c,v 1.5 2003/08/04 03:47:10 miguelfreitas Exp $ * * a image video decoder */ @@ -226,7 +226,7 @@ void end_callback(png_structp png_ptr, png_infop info) { if (this->rows_valid) { img = this->stream->video_out->get_frame (this->stream->video_out, this->width, - this->height, XINE_VO_ASPECT_DONT_TOUCH, + this->height, (double)this->width/(double)this->height, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); @@ -439,6 +439,6 @@ static decoder_info_t dec_info_image = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "image", XINE_VERSION_CODE, &dec_info_image, init_class }, + { PLUGIN_VIDEO_DECODER, 15, "image", XINE_VERSION_CODE, &dec_info_image, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/interplayvideo.c b/src/libxinevdec/interplayvideo.c index 23680a147..df770c10a 100644 --- a/src/libxinevdec/interplayvideo.c +++ b/src/libxinevdec/interplayvideo.c @@ -21,7 +21,7 @@ * For more information regarding the Interplay MVE format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: interplayvideo.c,v 1.2 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: interplayvideo.c,v 1.3 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -67,6 +67,7 @@ typedef struct interplay_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ unsigned char yuv_palette[256 * 4]; @@ -1157,6 +1158,7 @@ static void interplay_decode_data (video_decoder_t *this_gen, this->width = (buf->content[0] << 8) | buf->content[1]; this->height = (buf->content[2] << 8) | buf->content[3]; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; if (this->buf) @@ -1206,7 +1208,7 @@ static void interplay_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; @@ -1379,6 +1381,6 @@ static decoder_info_t dec_info_video = { */ plugin_info_t xine_plugin_info[] = { /* { type, API, "name", version, special_info, init_function } */ - { PLUGIN_VIDEO_DECODER, 14, "interplay", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "interplay", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/msrle.c b/src/libxinevdec/msrle.c index fbc327ead..aae46dba8 100644 --- a/src/libxinevdec/msrle.c +++ b/src/libxinevdec/msrle.c @@ -21,7 +21,7 @@ * For more information on the MS RLE format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: msrle.c,v 1.16 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: msrle.c,v 1.17 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -59,6 +59,7 @@ typedef struct msrle_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ unsigned char yuv_palette[256 * 4]; yuv_planes_t yuv_planes; @@ -211,6 +212,7 @@ static void msrle_decode_data (video_decoder_t *this_gen, bih = (xine_bmiheader *) buf->content; this->width = (bih->biWidth + 3) & ~0x03; this->height = (bih->biHeight + 3) & ~0x03; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; if (this->buf) @@ -246,7 +248,7 @@ static void msrle_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -365,6 +367,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "msrle", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "msrle", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/msvc.c b/src/libxinevdec/msvc.c index ba8e06acc..2a1d60bf7 100644 --- a/src/libxinevdec/msvc.c +++ b/src/libxinevdec/msvc.c @@ -22,7 +22,7 @@ * based on overview of Microsoft Video-1 algorithm * by Mike Melanson: http://www.pcisys.net/~melanson/codecs/video1.txt * - * $Id: msvc.c,v 1.22 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: msvc.c,v 1.23 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdlib.h> @@ -67,6 +67,7 @@ typedef struct msvc_decoder_s { unsigned int width; unsigned int height; + double ratio; } msvc_decoder_t; /* taken from libw32dll */ @@ -231,6 +232,7 @@ static void msvc_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { this->width = (bih->biWidth + 1) & ~0x1; this->height = bih->biHeight; + this->ratio = (double)this->width/(double)this->height; this->coded_width = (this->width + 3) & ~0x3; this->coded_height = (this->height + 3) & ~0x3; this->pitch = 2*this->coded_width; @@ -279,7 +281,7 @@ static void msvc_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; @@ -407,6 +409,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "msvc", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "msvc", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/qtrle.c b/src/libxinevdec/qtrle.c index f609183df..96b8150df 100644 --- a/src/libxinevdec/qtrle.c +++ b/src/libxinevdec/qtrle.c @@ -21,7 +21,7 @@ * For more information on the QT RLE format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: qtrle.c,v 1.12 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: qtrle.c,v 1.13 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -59,6 +59,7 @@ typedef struct qtrle_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ int depth; /* color depth (bits/pixel) */ unsigned char yuv_palette[256 * 4]; @@ -845,6 +846,7 @@ static void qtrle_decode_data (video_decoder_t *this_gen, bih = (xine_bmiheader *) buf->content; this->width = bih->biWidth; this->height = bih->biHeight; + this->ratio = (double)this->width/(double)this->height; this->depth = bih->biBitCount; this->video_step = buf->decoder_info[1]; @@ -881,7 +883,7 @@ static void qtrle_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); switch (this->depth & 0x1F) { @@ -1032,6 +1034,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "qtrle", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "qtrle", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/qtrpza.c b/src/libxinevdec/qtrpza.c index ee80bb33a..429b04dd5 100644 --- a/src/libxinevdec/qtrpza.c +++ b/src/libxinevdec/qtrpza.c @@ -21,7 +21,7 @@ * For more information about the RPZA format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: qtrpza.c,v 1.14 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: qtrpza.c,v 1.15 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -59,6 +59,7 @@ typedef struct qtrpza_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ yuv_planes_t yuv_planes; @@ -305,6 +306,7 @@ static void qtrpza_decode_data (video_decoder_t *this_gen, bih = (xine_bmiheader *) buf->content; this->width = (bih->biWidth + 3) & ~0x03; this->height = (bih->biHeight + 3) & ~0x03; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; if (this->buf) @@ -340,7 +342,8 @@ static void qtrpza_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YUY2, + VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -454,6 +457,6 @@ static decoder_info_t video_decoder_info = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "rpza", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "rpza", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/qtsmc.c b/src/libxinevdec/qtsmc.c index 1df557d33..f658bf2a9 100644 --- a/src/libxinevdec/qtsmc.c +++ b/src/libxinevdec/qtsmc.c @@ -23,7 +23,7 @@ * For more information on the SMC format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: qtsmc.c,v 1.14 2003/01/08 01:02:31 miguelfreitas Exp $ + * $Id: qtsmc.c,v 1.15 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -68,6 +68,7 @@ typedef struct qtsmc_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ /* SMC color tables */ unsigned char color_pairs[COLORS_PER_TABLE * BYTES_PER_COLOR * CPAIR]; @@ -537,6 +538,7 @@ static void qtsmc_decode_data (video_decoder_t *this_gen, bih = (xine_bmiheader *) buf->content; this->width = (bih->biWidth + 3) & ~0x03; this->height = (bih->biHeight + 3) & ~0x03; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; if (this->buf) @@ -572,7 +574,8 @@ static void qtsmc_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YUY2, + VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -686,7 +689,7 @@ static decoder_info_t video_decoder_info = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "smc", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "smc", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/rgb.c b/src/libxinevdec/rgb.c index 6b040ffd8..a45ba574a 100644 --- a/src/libxinevdec/rgb.c +++ b/src/libxinevdec/rgb.c @@ -21,7 +21,7 @@ * Actually, this decoder just converts a raw RGB image to a YUY2 map * suitable for display under xine. * - * $Id: rgb.c,v 1.18 2003/01/08 01:02:32 miguelfreitas Exp $ + * $Id: rgb.c,v 1.19 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -59,6 +59,7 @@ typedef struct rgb_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ int bytes_per_pixel; unsigned char yuv_palette[256 * 4]; @@ -107,6 +108,7 @@ static void rgb_decode_data (video_decoder_t *this_gen, bih = (xine_bmiheader *) buf->content; this->width = (bih->biWidth + 3) & ~0x03; this->height = (bih->biHeight + 3) & ~0x03; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; /* round this number up in case of 15 */ this->bytes_per_pixel = (bih->biBitCount + 1) / 8; @@ -144,7 +146,8 @@ static void rgb_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YUY2, + VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -311,6 +314,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "rgb", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "rgb", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/roqvideo.c b/src/libxinevdec/roqvideo.c index 2f2fb6bd6..104828058 100644 --- a/src/libxinevdec/roqvideo.c +++ b/src/libxinevdec/roqvideo.c @@ -18,7 +18,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: roqvideo.c,v 1.18 2003/01/08 01:02:32 miguelfreitas Exp $ + * $Id: roqvideo.c,v 1.19 2003/08/04 03:47:10 miguelfreitas Exp $ */ /* And this is the header that came with the RoQ video decoder: */ @@ -100,6 +100,7 @@ typedef struct roq_decoder_s { int size; int width; int height; + double ratio; roq_cell cells[256]; roq_qcell qcells[256]; @@ -401,6 +402,7 @@ static void roqvideo_decode_data (video_decoder_t *this_gen, this->size = 0; this->width = (buf->content[0] << 8) | buf->content[1]; this->height = (buf->content[2] << 8) | buf->content[3]; + this->ratio = (double)this->width/(double)this->height; this->skipframes = 0; this->video_step = buf->decoder_info[1]; this->current_planes = 0; @@ -444,7 +446,7 @@ static void roqvideo_decode_data (video_decoder_t *this_gen, if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* time to decode a frame */ img = this->stream->video_out->get_frame (this->stream->video_out, - this->width, this->height, XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YV12, + this->width, this->height, this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); img->pts = buf->pts; @@ -569,6 +571,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "roq", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "roq", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/svq1.c b/src/libxinevdec/svq1.c index c92795b6a..959efa283 100644 --- a/src/libxinevdec/svq1.c +++ b/src/libxinevdec/svq1.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: svq1.c,v 1.24 2003/01/31 18:29:47 miguelfreitas Exp $ + * $Id: svq1.c,v 1.25 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -84,6 +84,7 @@ typedef struct svq1_s { uint8_t *base[3]; int width; int height; + double ratio; } svq1_t; typedef struct { @@ -1230,6 +1231,7 @@ static int svq1_decode_frame (svq1_t *svq1, uint8_t *buffer, int length) { svq1->width = (svq1->frame_width + 3) & ~0x3; svq1->height = (svq1->frame_height + 3) & ~0x3; + svq1->ratio = (double)svq1->width/(double)svq1->height; svq1->luma_width = (svq1->width + 15) & ~0xF; svq1->luma_height = (svq1->height + 15) & ~0xF; svq1->chroma_width = ((svq1->width / 4) + 15) & ~0xF; @@ -1366,7 +1368,7 @@ static void svq1dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) img = this->stream->video_out->get_frame (this->stream->video_out, this->svq1->width, this->svq1->height, - XINE_VO_ASPECT_DONT_TOUCH, + this->svq1->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); @@ -1500,6 +1502,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "svq1", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "svq1", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/wc3video.c b/src/libxinevdec/wc3video.c index 57286f02f..e0dd4b539 100644 --- a/src/libxinevdec/wc3video.c +++ b/src/libxinevdec/wc3video.c @@ -22,7 +22,7 @@ * For more information on the WC3 Movie format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: wc3video.c,v 1.13 2003/01/08 01:02:32 miguelfreitas Exp $ + * $Id: wc3video.c,v 1.14 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -73,6 +73,8 @@ typedef struct wc3video_decoder_s { * structure 1 or 2 */ int current_planes; + double ratio; + } wc3video_decoder_t; /************************************************************************** @@ -406,7 +408,7 @@ static void wc3video_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, WC3_WIDTH, WC3_HEIGHT, - 42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->duration = this->video_step; img->pts = buf->pts; @@ -491,6 +493,8 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre this->decoder_ok = 0; this->buf = NULL; + this->ratio = (double)WC3_WIDTH/(double)WC3_HEIGHT; + return &this->video_decoder; } @@ -530,6 +534,6 @@ static decoder_info_t video_decoder_info = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "wc3video", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "wc3video", XINE_VERSION_CODE, &video_decoder_info, &init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c index 257df022b..b2e655030 100644 --- a/src/libxinevdec/yuv.c +++ b/src/libxinevdec/yuv.c @@ -21,7 +21,7 @@ * Actually, this decoder just reorganizes chunks of raw YUV data in such * a way that xine can display them. * - * $Id: yuv.c,v 1.19 2003/05/28 13:16:43 jstembridge Exp $ + * $Id: yuv.c,v 1.20 2003/08/04 03:47:10 miguelfreitas Exp $ */ #include <stdio.h> @@ -59,6 +59,7 @@ typedef struct yuv_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ + double ratio; /* the width to height ratio */ } yuv_decoder_t; @@ -91,6 +92,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, bih = (xine_bmiheader *) buf->content; this->width = (bih->biWidth + 3) & ~0x03; this->height = (bih->biHeight + 3) & ~0x03; + this->ratio = (double)this->width/(double)this->height; this->video_step = buf->decoder_info[1]; if (this->buf) @@ -142,7 +144,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - 42, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); xine_fast_memcpy(img->base[0], this->buf, this->width * this->height); xine_fast_memcpy(img->base[1], @@ -156,7 +158,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - 42, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); xine_fast_memcpy(img->base[0], this->buf, this->width * this->height); xine_fast_memcpy(img->base[1], this->buf + this->width * this->height, @@ -170,7 +172,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); yuv9_to_yv12( @@ -198,7 +200,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - 42, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); xine_fast_memcpy(img->base[0], this->buf, this->width * this->height); memset( img->base[1], 0x80, this->width * this->height / 4 ); @@ -209,7 +211,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, /* just allocate something to avoid compiler warnings */ img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, - XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); } @@ -330,6 +332,6 @@ static decoder_info_t dec_info_video = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "yuv", XINE_VERSION_CODE, &dec_info_video, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "yuv", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/yuv_frames.c b/src/libxinevdec/yuv_frames.c index 7f4ab6c2c..2b55928db 100644 --- a/src/libxinevdec/yuv_frames.c +++ b/src/libxinevdec/yuv_frames.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: yuv_frames.c,v 1.4 2003/06/11 23:08:55 miguelfreitas Exp $ + * $Id: yuv_frames.c,v 1.5 2003/08/04 03:47:10 miguelfreitas Exp $ * * dummy video decoder for uncompressed video frames as delivered by v4l */ @@ -61,7 +61,7 @@ static void yuv_frames_decode_data (video_decoder_t *this_gen, buf_element_t *bu img = this->stream->video_out->get_frame (this->stream->video_out, buf->decoder_info[0], buf->decoder_info[1], - ASPECT_FULL, + (double)buf->decoder_info[0]/(double)buf->decoder_info[1], XINE_IMGFMT_YV12, VO_BOTH_FIELDS | VO_INTERLACED_FLAG); @@ -172,6 +172,6 @@ static decoder_info_t dec_info_yuv_frames = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 14, "yuv_frames", XINE_VERSION_CODE, &dec_info_yuv_frames, init_plugin }, + { PLUGIN_VIDEO_DECODER, 15, "yuv_frames", XINE_VERSION_CODE, &dec_info_yuv_frames, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxvid/xine_decoder.c b/src/libxvid/xine_decoder.c index cebd7bcff..611c07ad0 100644 --- a/src/libxvid/xine_decoder.c +++ b/src/libxvid/xine_decoder.c @@ -58,6 +58,7 @@ typedef struct xvid_decoder_s { int frame_width; int frame_height; + double ratio; /* frame_duration a.k.a. video_step. It is one second metronom */ /* ticks (90,000) divided by fps (provided by demuxer from system */ @@ -94,6 +95,7 @@ static void xvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { this->frame_duration = buf->decoder_info[1]; this->frame_width = bih->biWidth; this->frame_height = bih->biHeight; + this->ratio = (double)bih->biWidth/(double)bih->biHeight; /* initialize decoder */ if (this->xvid_handle) { @@ -147,7 +149,7 @@ static void xvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { image = this->video_out->get_frame (this->video_out, this->frame_width, this->frame_height, - XINE_VO_ASPECT_DONT_TOUCH, + this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); image->pts = buf->pts; image->duration = this->frame_duration; diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index e23bed952..a8c503501 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.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_plugin.c,v 1.10 2003/07/12 02:26:13 miguelfreitas Exp $ + * $Id: xine_plugin.c,v 1.11 2003/08/04 03:47:10 miguelfreitas Exp $ * * advanced video deinterlacer plugin * Jun/2003 by Miguel Freitas @@ -44,7 +44,7 @@ post_info_t deinterlace_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 3, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, + { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 4, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -219,7 +219,7 @@ static int deinterlace_set_property(xine_video_port_t *port_gen, int static void deinterlace_flush(xine_video_port_t *port_gen); static void deinterlace_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *deinterlace_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void deinterlace_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -487,7 +487,7 @@ static void deinterlace_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *deinterlace_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; @@ -495,7 +495,7 @@ static vo_frame_t *deinterlace_get_frame(xine_video_port_t *port_gen, uint32_t w vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); pthread_mutex_lock (&this->lock); diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index 43fbe3aa1..137aa3323 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.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_goom.c,v 1.33 2003/07/26 23:31:55 tmattern Exp $ + * $Id: xine_goom.c,v 1.34 2003/08/04 03:47:10 miguelfreitas Exp $ * * GOOM post plugin. * @@ -89,6 +89,7 @@ struct post_plugin_goom_s { int samples_per_frame; int width, height; int width_back, height_back; + double ratio; int fps; int use_asm; int csc_method; @@ -116,7 +117,7 @@ post_info_t goom_special_info = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 3, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin }, + { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 4, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -303,6 +304,8 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, this->height_back = this->height; goom_init (this->width_back, this->height_back, 0); + this->ratio = (double)this->width_back/(double)this->height_back; + this->sample_counter = 0; this->stream = NULL; this->vo_port = video_target[0]; @@ -549,7 +552,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, this->width_back, this->height_back, - XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; @@ -649,6 +652,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen, goom_init (this->width, this->height, 0); this->width_back = width; this->height_back = height; + this->ratio = (double)width/(double)height; } } } while( this->sample_counter >= this->samples_per_frame ); diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c index 2794f0058..60d9d7217 100644 --- a/src/post/mosaico/mosaico.c +++ b/src/post/mosaico/mosaico.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: mosaico.c,v 1.11 2003/05/31 18:33:29 miguelfreitas Exp $ + * $Id: mosaico.c,v 1.12 2003/08/04 03:47:10 miguelfreitas Exp $ */ /* @@ -47,7 +47,7 @@ post_info_t mosaico_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "mosaico", MOVERSION, &mosaico_special_info, &mosaico_init_plugin }, + { PLUGIN_POST, 4, "mosaico", MOVERSION, &mosaico_special_info, &mosaico_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -94,11 +94,11 @@ static int mosaico_rewire(xine_post_out_t *output, void *data); /* replaced video_port functions */ static void mosaico_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *mosaico_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void mosaico_close(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *mosaico_get_frame_2(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); /* replaced vo_frame functions */ @@ -344,14 +344,14 @@ static void mosaico_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *mosaico_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ frame->draw = mosaico_draw; @@ -361,14 +361,14 @@ static vo_frame_t *mosaico_get_frame(xine_video_port_t *port_gen, uint32_t width } static vo_frame_t *mosaico_get_frame_2(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ frame->draw = mosaico_draw_2; diff --git a/src/post/mosaico/switch.c b/src/post/mosaico/switch.c index 4b60c948c..40f76a56d 100644 --- a/src/post/mosaico/switch.c +++ b/src/post/mosaico/switch.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: switch.c,v 1.3 2003/05/31 18:33:29 miguelfreitas Exp $ + * $Id: switch.c,v 1.4 2003/08/04 03:47:10 miguelfreitas Exp $ */ /* @@ -41,7 +41,7 @@ post_info_t switch_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "switch", SWVERSION, &switch_special_info, &switch_init_plugin }, + { PLUGIN_POST, 4, "switch", SWVERSION, &switch_special_info, &switch_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -80,10 +80,10 @@ static int switch_rewire(xine_post_out_t *output, void *data); /* replaced video_port functions */ static void switch_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *switch_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static vo_frame_t *switch_get_frame_2(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void switch_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -282,7 +282,7 @@ static void switch_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *switch_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; @@ -291,7 +291,7 @@ static vo_frame_t *switch_get_frame(xine_video_port_t *port_gen, uint32_t width, pthread_mutex_lock(&output->mut1); frame = port->original_port->get_frame(port->original_port, - width, height , ratio_code, format, flags); + width, height , ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ @@ -303,7 +303,7 @@ static vo_frame_t *switch_get_frame(xine_video_port_t *port_gen, uint32_t width, } static vo_frame_t *switch_get_frame_2(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; @@ -313,7 +313,7 @@ static vo_frame_t *switch_get_frame_2(xine_video_port_t *port_gen, uint32_t widt pthread_mutex_lock(&output->mut1); frame = port->original_port->get_frame(port->original_port, - width, height , ratio_code, format, flags); + width, height , ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ diff --git a/src/post/planar/boxblur.c b/src/post/planar/boxblur.c index 52fe67279..8729da5c5 100644 --- a/src/post/planar/boxblur.c +++ b/src/post/planar/boxblur.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: boxblur.c,v 1.3 2003/07/12 03:15:23 miguelfreitas Exp $ + * $Id: boxblur.c,v 1.4 2003/08/04 03:47:10 miguelfreitas Exp $ * * mplayer's boxblur * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> @@ -37,7 +37,7 @@ post_info_t boxblur_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, + { PLUGIN_POST, 4, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; #endif @@ -142,7 +142,7 @@ static int boxblur_rewire(xine_post_out_t *output, void *data); /* replaced video_port functions */ static void boxblur_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *boxblur_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void boxblur_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -294,14 +294,14 @@ static void boxblur_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *boxblur_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ diff --git a/src/post/planar/denoise3d.c b/src/post/planar/denoise3d.c index 595fbce73..2cc394596 100644 --- a/src/post/planar/denoise3d.c +++ b/src/post/planar/denoise3d.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: denoise3d.c,v 1.3 2003/07/12 03:15:23 miguelfreitas Exp $ + * $Id: denoise3d.c,v 1.4 2003/08/04 03:47:10 miguelfreitas Exp $ * * mplayer's denoise3d * Copyright (C) 2003 Daniel Moreno <comac@comac.darktech.org> @@ -45,7 +45,7 @@ post_info_t denoise3d_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, + { PLUGIN_POST, 4, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; #endif @@ -176,7 +176,7 @@ static int denoise3d_rewire(xine_post_out_t *output, void *data); /* replaced video_port functions */ static void denoise3d_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *denoise3d_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void denoise3d_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -330,14 +330,14 @@ static void denoise3d_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *denoise3d_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c index f79482a8f..c0af88d78 100644 --- a/src/post/planar/eq.c +++ b/src/post/planar/eq.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: eq.c,v 1.2 2003/07/12 03:15:23 miguelfreitas Exp $ + * $Id: eq.c,v 1.3 2003/08/04 03:47:11 miguelfreitas Exp $ * * mplayer's eq (soft video equalizer) * Copyright (C) Richard Felker @@ -125,7 +125,7 @@ post_info_t eq_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, + { PLUGIN_POST, 4, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; #endif @@ -226,7 +226,7 @@ static int eq_get_property(xine_video_port_t *port_gen, int property) static int eq_set_property(xine_video_port_t *port_gen, int property, int value); static void eq_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *eq_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void eq_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -412,14 +412,14 @@ static void eq_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *eq_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index 91f926d54..680035625 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.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: eq2.c,v 1.3 2003/07/12 03:15:23 miguelfreitas Exp $ + * $Id: eq2.c,v 1.4 2003/08/04 03:47:11 miguelfreitas Exp $ * * mplayer's eq2 (soft video equalizer) * Software equalizer (brightness, contrast, gamma, saturation) @@ -270,7 +270,7 @@ post_info_t eq2_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, + { PLUGIN_POST, 4, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; #endif @@ -399,7 +399,7 @@ static int eq2_get_property(xine_video_port_t *port_gen, int property static int eq2_set_property(xine_video_port_t *port_gen, int property, int value); static void eq2_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *eq2_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void eq2_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -607,14 +607,14 @@ static void eq2_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *eq2_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c index 01284b3e7..f585a22ce 100644 --- a/src/post/planar/expand.c +++ b/src/post/planar/expand.c @@ -39,7 +39,7 @@ post_info_t expand_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, + { PLUGIN_POST, 4, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; #endif @@ -69,7 +69,7 @@ static int expand_rewire(xine_post_out_t *output, void *data); /* replaced video_port functions */ static void expand_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void expand_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -204,14 +204,14 @@ static void expand_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ frame->draw = expand_draw; @@ -234,33 +234,9 @@ static int expand_draw(vo_frame_t *frame, xine_stream_t *stream) post_video_port_t *port = (post_video_port_t *) frame->port; vo_frame_t *expanded_frame; int size, i, skip, new_height, border_height; - double pixel_aspect; - - /* Find pixel aspect of video frame */ - switch(frame->ratio) { - case XINE_VO_ASPECT_ANAMORPHIC: /* anamorphic */ - case XINE_VO_ASPECT_PAN_SCAN: /* we display pan&scan as widescreen */ - pixel_aspect = 16.0 /9.0; - break; - case XINE_VO_ASPECT_DVB: /* 2.11:1 */ - pixel_aspect = 2.11/1.0; - break; - case XINE_VO_ASPECT_SQUARE: /* square pels */ - case XINE_VO_ASPECT_DONT_TOUCH: /* don't touch aspect ratio */ - pixel_aspect = 1.0; - break; - case 0: /* forbidden -> 4:3 */ - printf("expand: invalid ratio, using 4:3\n"); - default: - printf("expand: unknown aspect ratio (%d) in stream => using 4:3\n", - frame->ratio); - case XINE_VO_ASPECT_4_3: /* 4:3 */ - pixel_aspect = 4.0 / 3.0; - break; - } - + /* Calculate height of expanded frame */ - new_height = (double) frame->width * pixel_aspect * 3.0 / 4.0; + new_height = (double) frame->width * frame->ratio * 3.0 / 4.0; new_height = (new_height + 1) & ~1; if(new_height > frame->height) { diff --git a/src/post/planar/invert.c b/src/post/planar/invert.c index 968539de9..76f13de34 100644 --- a/src/post/planar/invert.c +++ b/src/post/planar/invert.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: invert.c,v 1.10 2003/06/29 18:56:24 miguelfreitas Exp $ + * $Id: invert.c,v 1.11 2003/08/04 03:47:11 miguelfreitas Exp $ */ /* @@ -38,7 +38,7 @@ post_info_t invert_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, + { PLUGIN_POST, 4, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -69,7 +69,7 @@ static int invert_rewire(xine_post_out_t *output, void *data); /* replaced video_port functions */ static void invert_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *invert_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void invert_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -204,14 +204,14 @@ static void invert_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *invert_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ frame->draw = invert_draw; diff --git a/src/post/planar/planar.c b/src/post/planar/planar.c index 96e04da08..7ab3ad521 100644 --- a/src/post/planar/planar.c +++ b/src/post/planar/planar.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: planar.c,v 1.1 2003/06/29 18:56:24 miguelfreitas Exp $ + * $Id: planar.c,v 1.2 2003/08/04 03:47:11 miguelfreitas Exp $ * * catalog for planar post plugins */ @@ -49,13 +49,13 @@ post_info_t unsharp_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "expand", XINE_VERSION_CODE+1, &expand_special_info, &expand_init_plugin }, - { PLUGIN_POST, 3, "invert", XINE_VERSION_CODE+1, &invert_special_info, &invert_init_plugin }, - { PLUGIN_POST, 3, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, - { PLUGIN_POST, 3, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, - { PLUGIN_POST, 3, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, - { PLUGIN_POST, 3, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, - { PLUGIN_POST, 3, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, + { PLUGIN_POST, 4, "expand", XINE_VERSION_CODE+1, &expand_special_info, &expand_init_plugin }, + { PLUGIN_POST, 4, "invert", XINE_VERSION_CODE+1, &invert_special_info, &invert_init_plugin }, + { PLUGIN_POST, 4, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, + { PLUGIN_POST, 4, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, + { PLUGIN_POST, 4, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, + { PLUGIN_POST, 4, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, + { PLUGIN_POST, 4, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/planar/unsharp.c b/src/post/planar/unsharp.c index 97fef8acc..4564bbcc6 100644 --- a/src/post/planar/unsharp.c +++ b/src/post/planar/unsharp.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: unsharp.c,v 1.3 2003/07/12 03:15:23 miguelfreitas Exp $ + * $Id: unsharp.c,v 1.4 2003/08/04 03:47:11 miguelfreitas Exp $ * * mplayer's unsharp * Copyright (C) 2002 Rémi Guyomarch <rguyom@pobox.com> @@ -136,7 +136,7 @@ post_info_t unsharp_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, + { PLUGIN_POST, 4, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; #endif @@ -263,7 +263,7 @@ static int unsharp_rewire(xine_post_out_t *output, void *data); /* replaced video_port functions */ static void unsharp_open(xine_video_port_t *port_gen, xine_stream_t *stream); static vo_frame_t *unsharp_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); static void unsharp_close(xine_video_port_t *port_gen, xine_stream_t *stream); @@ -420,14 +420,14 @@ static void unsharp_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *unsharp_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; vo_frame_t *frame; frame = port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); post_intercept_video_frame(frame, port); /* replace with our own draw function */ diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c index c595e21be..5132ba0a6 100644 --- a/src/post/visualizations/fftscope.c +++ b/src/post/visualizations/fftscope.c @@ -22,7 +22,7 @@ * * FFT code by Steve Haehnichen, originally licensed under GPL v1 * - * $Id: fftscope.c,v 1.14 2003/07/26 17:44:30 tmattern Exp $ + * $Id: fftscope.c,v 1.15 2003/08/04 03:47:11 miguelfreitas Exp $ * */ @@ -58,6 +58,8 @@ struct post_plugin_fftscope_s { xine_video_port_t *vo_port; xine_stream_t *stream; + double ratio; + int data_idx; complex wave[MAXCHANNELS][NUMSAMPLES]; int amp_max[MAXCHANNELS][NUMSAMPLES / 2]; @@ -492,6 +494,8 @@ static int fftscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream post_plugin_fftscope_t *this = (post_plugin_fftscope_t *)port->post; int c, i; + this->ratio = (double)FFT_WIDTH/(double)FFT_HEIGHT; + this->bits = bits; this->mode = mode; this->channels = mode_channels(mode); @@ -599,7 +603,7 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen, samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, FFT_WIDTH, FFT_HEIGHT, - XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; frame->bad_frame = 0; diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c index c1aecb329..505a10bc6 100644 --- a/src/post/visualizations/fooviz.c +++ b/src/post/visualizations/fooviz.c @@ -23,7 +23,7 @@ * process. It simply paints the screen a solid color and rotates through * colors on each iteration. * - * $Id: fooviz.c,v 1.8 2003/07/26 17:44:30 tmattern Exp $ + * $Id: fooviz.c,v 1.9 2003/08/04 03:47:11 miguelfreitas Exp $ * */ @@ -49,10 +49,12 @@ struct post_plugin_fooviz_s { xine_video_port_t *vo_port; xine_stream_t *stream; + double ratio; + int data_idx; short data [2][NUMSAMPLES]; audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */ - + int bits; int mode; int channels; @@ -139,6 +141,7 @@ static int fooviz_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)port->post; + this->ratio = (double)FOO_WIDTH/(double)FOO_HEIGHT; this->bits = bits; this->mode = mode; this->channels = mode_channels(mode); @@ -231,7 +234,7 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen, samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, FOO_WIDTH, FOO_HEIGHT, - XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; frame->bad_frame = 0; @@ -370,6 +373,6 @@ post_info_t fooviz_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZATION }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, + { PLUGIN_POST, 4, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c index e143b8f27..3e2908d54 100644 --- a/src/post/visualizations/oscope.c +++ b/src/post/visualizations/oscope.c @@ -20,7 +20,7 @@ * Basic Oscilloscope Visualization Post Plugin For xine * by Mike Melanson (melanson@pcisys.net) * - * $Id: oscope.c,v 1.8 2003/07/26 17:44:30 tmattern Exp $ + * $Id: oscope.c,v 1.9 2003/08/04 03:47:11 miguelfreitas Exp $ * */ @@ -47,6 +47,8 @@ struct post_plugin_oscope_s { xine_video_port_t *vo_port; xine_stream_t *stream; + double ratio; + int data_idx; short data [MAXCHANNELS][NUMSAMPLES]; audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */ @@ -209,6 +211,8 @@ static int oscope_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, post_audio_port_t *port = (post_audio_port_t *)port_gen; post_plugin_oscope_t *this = (post_plugin_oscope_t *)port->post; + this->ratio = (double)OSCOPE_WIDTH/(double)OSCOPE_HEIGHT; + this->bits = bits; this->mode = mode; this->channels = mode_channels(mode); @@ -298,7 +302,7 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen, samples_used += this->samples_per_frame; frame = this->vo_port->get_frame (this->vo_port, OSCOPE_WIDTH, OSCOPE_HEIGHT, - XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2, + this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); frame->extra_info->invalid = 1; frame->bad_frame = 0; diff --git a/src/post/visualizations/visualizations.c b/src/post/visualizations/visualizations.c index 2241aeea4..97d6d51db 100644 --- a/src/post/visualizations/visualizations.c +++ b/src/post/visualizations/visualizations.c @@ -19,7 +19,7 @@ * * This file contains plugin entries for several visualization post plugins. * - * $Id: visualizations.c,v 1.3 2003/05/31 18:33:30 miguelfreitas Exp $ + * $Id: visualizations.c,v 1.4 2003/08/04 03:47:11 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -43,7 +43,7 @@ post_info_t fftscope_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZATION }; plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 3, "oscope", XINE_VERSION_CODE, &oscope_special_info, &oscope_init_plugin }, - { PLUGIN_POST, 3, "fftscope", XINE_VERSION_CODE, &fftscope_special_info, &fftscope_init_plugin }, + { PLUGIN_POST, 4, "oscope", XINE_VERSION_CODE, &oscope_special_info, &oscope_init_plugin }, + { PLUGIN_POST, 4, "fftscope", XINE_VERSION_CODE, &fftscope_special_info, &fftscope_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 363793abc..77a28ce72 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.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_aa.c,v 1.35 2003/05/31 18:33:30 miguelfreitas Exp $ + * $Id: video_out_aa.c,v 1.36 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_aa.c, ascii-art output plugin for xine * @@ -56,7 +56,7 @@ typedef struct aa_frame_s { int width, height; uint8_t *mem[3]; - int ratio_code; + double ratio; int format; @@ -119,7 +119,7 @@ static vo_frame_t *aa_alloc_frame(vo_driver_t *this) { static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { aa_frame_t *frame = (aa_frame_t *) img; @@ -165,7 +165,7 @@ static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, abort(); } - frame->ratio_code = ratio_code; + frame->ratio = ratio; } @@ -231,7 +231,7 @@ static int aa_get_property (vo_driver_t *this_gen, int property) { if ( property == VO_PROP_ASPECT_RATIO) { return this->user_ratio ; } else { - printf ("video_out_xshm: tried to get unsupported property %d\n", property); + printf ("video_out_aa: tried to get unsupported property %d\n", property); } return 0; @@ -242,12 +242,12 @@ static int aa_set_property (vo_driver_t *this_gen, aa_driver_t *this = (aa_driver_t*) this_gen; if ( property == VO_PROP_ASPECT_RATIO) { - if (value>=NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if (value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; this->user_ratio = value; } else { - printf ("video_out_xshm: tried to set unsupported property %d\n", property); + printf ("video_out_aa: tried to set unsupported property %d\n", property); } return value; @@ -328,6 +328,6 @@ static vo_info_t vo_info_aa = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class }, + { PLUGIN_VIDEO_OUT, 16, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 92ff0b1a4..81e450ab6 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.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_directfb.c,v 1.17 2003/05/31 18:33:30 miguelfreitas Exp $ + * $Id: video_out_directfb.c,v 1.18 2003/08/04 03:47:11 miguelfreitas Exp $ * * DirectFB based output plugin. * Rich Wareham <richwareham@users.sourceforge.net> @@ -71,7 +71,7 @@ typedef struct directfb_frame_s { vo_frame_t vo_frame; int width, height; - int ratio_code; + double ratio; int format; int locked; @@ -98,7 +98,7 @@ typedef struct directfb_driver_s { /* last displayed frame */ int last_frame_width; /* original size */ int last_frame_height; /* original size */ - int last_frame_ratio_code; + double last_frame_ratio; /* display anatomy */ double display_ratio; /* given by visual parameter from init function */ @@ -212,7 +212,7 @@ static void directfb_adapt_to_output_area (directfb_driver_t *this, static void directfb_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = (directfb_frame_t *) frame_gen; @@ -301,7 +301,7 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, break; } - frame->ratio_code = ratio_code; + frame->ratio = ratio; directfb_frame_field ((vo_frame_t *)frame, flags); } @@ -390,9 +390,9 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen if ( (frame->width != this->last_frame_width) || (frame->height != this->last_frame_height)) { - this->last_frame_width = frame->width; - this->last_frame_height = frame->height; - this->last_frame_ratio_code = frame->ratio_code; + this->last_frame_width = frame->width; + this->last_frame_height = frame->height; + this->last_frame_ratio = frame->ratio; fprintf (stderr, "video_out_directfb: frame size %d x %d\n", this->frame_width, this->frame_height); @@ -422,15 +422,15 @@ static int directfb_get_property (vo_driver_t *this_gen, int property) { static char *aspect_ratio_name(int a) { switch (a) { - case ASPECT_AUTO: + case XINE_VO_ASPECT_AUTO: return "auto"; - case ASPECT_SQUARE: + case XINE_VO_ASPECT_SQUARE: return "square"; - case ASPECT_FULL: + case XINE_VO_ASPECT_4_3: return "4:3"; - case ASPECT_ANAMORPHIC: + case XINE_VO_ASPECT_ANAMORPHIC: return "16:9"; - case ASPECT_DVB: + case XINE_VO_ASPECT_DVB: return "2:1"; default: return "unknown"; @@ -443,8 +443,8 @@ static int directfb_set_property (vo_driver_t *this_gen, /* directfb_driver_t *this = (directfb_driver_t *) this_gen; */ if ( property == VO_PROP_ASPECT_RATIO) { - if (value>=NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if (value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; /* this->user_ratio = value; */ printf("video_out_directfb: aspect ratio changed to %s\n", aspect_ratio_name(value)); diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 9d7e44a94..0f8e78c71 100755 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -60,7 +60,7 @@ typedef struct win32_frame_s int width; int height; int size; - int rcode; + double ratio; }win32_frame_t; @@ -863,7 +863,7 @@ static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, - uint32_t height, int ratio_code, int format, int flags ) + uint32_t height, double ratio, int format, int flags ) { win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; @@ -918,7 +918,7 @@ static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_ win32_frame->format = format; win32_frame->width = width; win32_frame->height = height; - win32_frame->rcode = ratio_code; + win32_frame->ratio = ratio; } } @@ -941,24 +941,7 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame // determine desired ratio - switch( win32_frame->rcode ) - { - case ASPECT_ANAMORPHIC: - win32_driver->ratio = 16.0 / 9.0; - break; - - case ASPECT_DVB: - win32_driver->ratio = 2.0 / 1.0; - break; - - case ASPECT_SQUARE: - win32_driver->ratio = win32_frame->width / win32_frame->height; - break; - - case ASPECT_FULL: - default: - win32_driver->ratio = 4.0 / 3.0; - } + win32_driver->ratio = win32_frame->ratio; // lock our surface to update its contents @@ -1279,6 +1262,6 @@ static vo_info_t vo_info_win32 = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "vo_directx", XINE_VERSION_CODE, &vo_info_win32, init_class }, + { PLUGIN_VIDEO_OUT, 16, "vo_directx", XINE_VERSION_CODE, &vo_info_win32, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index aa63a3381..a9d4f364e 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.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_fb.c,v 1.26 2003/05/31 18:33:30 miguelfreitas Exp $ + * $Id: video_out_fb.c,v 1.27 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -417,7 +417,7 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, static void fb_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) + double ratio, int format, int flags) { fb_driver_t *this = (fb_driver_t *)this_gen; fb_frame_t *frame = (fb_frame_t *)frame_gen; @@ -425,11 +425,11 @@ static void fb_update_frame_format(vo_driver_t *this_gen, flags &= VO_BOTH_FIELDS; /* Find out if we need to adapt this frame. */ - if (width != frame->sc.delivered_width || - height != frame->sc.delivered_height || - ratio_code != frame->sc.delivered_ratio_code || - flags != frame->flags || - format != frame->format || + if (width != frame->sc.delivered_width || + height != frame->sc.delivered_height || + ratio != frame->sc.delivered_ratio || + flags != frame->flags || + format != frame->format || this->sc.user_ratio != frame->sc.user_ratio) { #ifdef LOG @@ -437,12 +437,12 @@ static void fb_update_frame_format(vo_driver_t *this_gen, "has changed => adapt\n"); #endif - frame->sc.delivered_width = width; - frame->sc.delivered_height = height; - frame->sc.delivered_ratio_code = ratio_code; - frame->flags = flags; - frame->format = format; - frame->sc.user_ratio = this->sc.user_ratio; + frame->sc.delivered_width = width; + frame->sc.delivered_height = height; + frame->sc.delivered_ratio = ratio; + frame->flags = flags; + frame->format = format; + frame->sc.user_ratio = this->sc.user_ratio; fb_compute_ideal_size(this, frame); fb_compute_rgb_size(this, frame); @@ -636,8 +636,8 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value) switch(property) { case VO_PROP_ASPECT_RATIO: - if(value>=NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if(value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; printf("video_out_fb: aspect ratio changed to %s\n", vo_scale_aspect_ratio_name(value)); @@ -968,7 +968,7 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, vo_scale_init(&this->sc, 0, 0, config); this->sc.gui_width = this->fb_var.xres; this->sc.gui_height = this->fb_var.yres; - this->sc.user_ratio = ASPECT_AUTO; + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; if (visual) { this->sc.frame_output_cb = visual->frame_output_cb; @@ -1053,7 +1053,7 @@ plugin_info_t xine_plugin_info[] = /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, - 15, + 16, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c index 2cb01977b..14dfdde57 100644 --- a/src/video_out/video_out_none.c +++ b/src/video_out/video_out_none.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_none.c,v 1.14 2003/05/31 18:33:31 miguelfreitas Exp $ + * $Id: video_out_none.c,v 1.15 2003/08/04 03:47:11 miguelfreitas Exp $ * * Was originally part of toxine frontend. * ...but has now been adapted to xine coding style standards ;) @@ -45,7 +45,7 @@ typedef struct { vo_frame_t vo_frame; int width; int height; - int ratio_code; + double ratio; int format; } none_frame_t; @@ -109,7 +109,7 @@ static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_frame, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { none_frame_t *frame = (none_frame_t *)vo_frame; if((frame->width != width) || (frame->height != height) || (frame->format != format)) { @@ -162,7 +162,7 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram } } - frame->ratio_code = ratio_code; + frame->ratio = ratio; } static void none_display_frame(vo_driver_t *vo_driver, vo_frame_t *vo_frame) { @@ -194,8 +194,8 @@ static int none_set_property(vo_driver_t *vo_driver, int property, int value) { switch(property) { case VO_PROP_ASPECT_RATIO: - if(value >= NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if(value >= XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; driver->ratio = value; break; @@ -244,7 +244,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void * driver = (none_driver_t *) malloc(sizeof(none_driver_t)); driver->config = class->config; - driver->ratio = ASPECT_AUTO; + driver->ratio = XINE_VO_ASPECT_AUTO; driver->vo_driver.get_capabilities = none_get_capabilities; driver->vo_driver.alloc_frame = none_alloc_frame ; @@ -302,6 +302,6 @@ static vo_info_t vo_info_none = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "none", XINE_VERSION_CODE, &vo_info_none, init_class }, + { PLUGIN_VIDEO_OUT, 16, "none", XINE_VERSION_CODE, &vo_info_none, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index 8ec4447f7..3d1ba2095 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.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_opengl.c,v 1.26 2003/05/31 18:33:31 miguelfreitas Exp $ + * $Id: video_out_opengl.c,v 1.27 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_glut.c, glut based OpenGL rendering interface for xine * Matthias Hopf <mat@mshopf.de> @@ -116,7 +116,8 @@ typedef struct opengl_frame_s { /* frame properties as delivered by the decoder: */ int width, height; - int ratio_code, format, flags; + double ratio; + int format, flags; /* opengl only data */ uint8_t *rgb_dst; @@ -151,7 +152,7 @@ typedef struct opengl_driver_s { /* last frame delivered from the decoder for frame change detection */ int last_width; int last_height; - int last_ratio_code; + double last_ratio; #if 0 /* ideal size */ @@ -207,7 +208,7 @@ static void opengl_frame_copy (vo_frame_t *vo_img, uint8_t **src) { * happen with corrupt MPEG streams * FIXME: Is there a way to ensure frame->rgb_dst validity? */ - DEBUGF ((stderr, "video_out_xshm: corrupt value of frame->rgb_dst -- skipping\n")); + DEBUGF ((stderr, "video_out_opengl: corrupt value of frame->rgb_dst -- skipping\n")); return; } if (frame->format == XINE_IMGFMT_YV12) { @@ -307,7 +308,7 @@ static void opengl_compute_ideal_size (opengl_driver_t *this) { static void opengl_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { opengl_driver_t *this = (opengl_driver_t *) this_gen; opengl_frame_t *frame = (opengl_frame_t *) frame_gen; @@ -322,8 +323,8 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, int image_size = width * height; - DEBUGF ((stderr, "video_out_opengl: updating frame to %dx%d (ratio=%d, format=%c%c%c%c)\n", - width, height, ratio_code, format&0xff, (format>>8)&0xff, + DEBUGF ((stderr, "video_out_opengl: updating frame to %dx%d (ratio=%f, format=%c%c%c%c)\n", + width, height, ratio, format&0xff, (format>>8)&0xff, (format>>16)&0xff, (format>>24)&0xff)); /* update frame allocated data */ @@ -381,7 +382,7 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, XUnlockDisplay (this->display); } - frame->ratio_code = ratio_code; + frame->ratio = ratio; opengl_frame_field ((vo_frame_t *)frame, flags); } @@ -508,13 +509,13 @@ static void opengl_render_image (opengl_driver_t *this, opengl_frame_t *frame, /* * check for size changes */ - if (frame->width != this->last_width || - frame->height != this->last_height || - frame->ratio_code != this->last_ratio_code) { + if (frame->width != this->last_width || + frame->height != this->last_height || + frame->ratio != this->last_ratio) { - this->last_width = frame->width; - this->last_height = frame->height; - this->last_ratio_code = frame->ratio_code; + this->last_width = frame->width; + this->last_height = frame->height; + this->last_ratio = frame->ratio; DEBUGF ((stderr, "video_out_opengl: display format changed\n")); opengl_compute_ideal_size (this); @@ -717,7 +718,7 @@ static void opengl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) opengl_frame_t *frame = (opengl_frame_t *) frame_gen; DEBUGF ((stderr, "*** display_frame ***\n")); - DEBUGF ((stderr, "video_out_xshm: about to draw frame %d x %d...\n", frame->width, frame->height)); + DEBUGF ((stderr, "video_out_opengl: about to draw frame %d x %d...\n", frame->width, frame->height)); XLockDisplay (this->display); opengl_render_image (this, frame, NULL); XUnlockDisplay (this->display); @@ -764,8 +765,8 @@ static int opengl_set_property (vo_driver_t *this_gen, DEBUGF ((stderr, "*** set_property\n")); switch (property) { case VO_PROP_ASPECT_RATIO: - if (value >= NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if (value >= XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; fprintf (stderr, "video_out_opengl: aspect ratio changed to %s\n", vo_scale_aspect_ratio_name (value)); @@ -924,7 +925,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, this->sc.frame_output_cb = visual->frame_output_cb; this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; - this->sc.user_ratio = ASPECT_AUTO; + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; this->sc.scaling_disabled = 0; /* We will not be able to use the current drawable... */ @@ -999,7 +1000,7 @@ static vo_info_t vo_info_opengl = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "opengl", XINE_VERSION_CODE, + { PLUGIN_VIDEO_OUT, 16, "opengl", XINE_VERSION_CODE, &vo_info_opengl, opengl_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c index efc44b961..1d6e6f575 100644 --- a/src/video_out/video_out_pgx64.c +++ b/src/video_out/video_out_pgx64.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_pgx64.c,v 1.30 2003/06/15 20:04:35 komadori Exp $ + * $Id: video_out_pgx64.c,v 1.31 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_pgx64.c, Sun PGX64/PGX24 output plugin for xine * @@ -103,7 +103,8 @@ typedef struct { int lengths[3]; uint32_t buf_y, buf_u, buf_v; - int width, height, pitch, ratio_code, format; + int width, height, pitch, format; + double ratio; } pgx64_frame_t; typedef struct { @@ -254,17 +255,17 @@ static pgx64_frame_t* pgx64_alloc_frame(pgx64_driver_t *this) return frame; } -static void pgx64_update_frame_format(pgx64_driver_t *this, pgx64_frame_t *frame, uint32_t width, uint32_t height, int ratio_code, int format, int flags) +static void pgx64_update_frame_format(pgx64_driver_t *this, pgx64_frame_t *frame, uint32_t width, uint32_t height, double ratio, int format, int flags) { if ((width != frame->width) || (height != frame->height) || - (ratio_code != frame->ratio_code) || + (ratio != frame->ratio) || (format != frame->format)) { dispose_frame_internals(frame); frame->width = width; frame->height = height; - frame->ratio_code = ratio_code; + frame->ratio = ratio; frame->format = format; frame->pitch = ((width + 7) / 8) * 8; @@ -298,12 +299,12 @@ static void pgx64_display_frame(pgx64_driver_t *this, pgx64_frame_t *frame) { if ((frame->width != this->vo_scale.delivered_width) || (frame->height != this->vo_scale.delivered_height) || - (frame->ratio_code != this->vo_scale.delivered_ratio_code)) { + (frame->ratio != this->vo_scale.delivered_ratio)) { - this->vo_scale.delivered_width = frame->width; - this->vo_scale.delivered_height = frame->height; - this->vo_scale.delivered_ratio_code = frame->ratio_code; - this->vo_scale.force_redraw = 1; + this->vo_scale.delivered_width = frame->width; + this->vo_scale.delivered_height = frame->height; + this->vo_scale.delivered_ratio = frame->ratio; + this->vo_scale.force_redraw = 1; vo_scale_compute_ideal_size(&this->vo_scale); } @@ -450,8 +451,8 @@ static int pgx64_set_property(pgx64_driver_t *this, int property, int value) break; case VO_PROP_ASPECT_RATIO: { - if (value >= NUM_ASPECT_RATIOS) { - value = ASPECT_AUTO; + if (value >= XINE_VO_ASPECT_NUM_RATIOS) { + value = XINE_VO_ASPECT_AUTO; } this->vo_scale.user_ratio = value; this->vo_scale.force_redraw = 1; @@ -669,7 +670,7 @@ static pgx64_driver_t* init_driver(pgx64_driver_class_t *class) this->depth_mask = 0xffffffff >> (32 - attr.fbtype.fb_depth); vo_scale_init(&this->vo_scale, 0, 0, this->class->config); - this->vo_scale.user_ratio = ASPECT_AUTO; + this->vo_scale.user_ratio = XINE_VO_ASPECT_AUTO; return this; } @@ -799,8 +800,8 @@ static pgx64_driver_class_t* pgx64fb_init_class(xine_t *xine, void *visual_gen) plugin_info_t xine_plugin_info[] = { #ifdef HAVE_X11 - {PLUGIN_VIDEO_OUT, 15, "pgx64", XINE_VERSION_CODE, &vo_info_pgx64, (void*)pgx64_init_class}, + {PLUGIN_VIDEO_OUT, 16, "pgx64", XINE_VERSION_CODE, &vo_info_pgx64, (void*)pgx64_init_class}, #endif - {PLUGIN_VIDEO_OUT, 15, "pgx64fb", XINE_VERSION_CODE, &vo_info_pgx64fb, (void*)pgx64fb_init_class}, + {PLUGIN_VIDEO_OUT, 16, "pgx64fb", XINE_VERSION_CODE, &vo_info_pgx64fb, (void*)pgx64fb_init_class}, {PLUGIN_NONE, 0, "", 0, NULL, NULL} }; diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index b83a18dec..8d6a3e6f5 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.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_sdl.c,v 1.25 2003/05/31 18:33:31 miguelfreitas Exp $ + * $Id: video_out_sdl.c,v 1.26 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_sdl.c, Simple DirectMedia Layer * @@ -72,7 +72,8 @@ typedef struct sdl_driver_s sdl_driver_t; typedef struct sdl_frame_s { vo_frame_t vo_frame; - int width, height, ratio_code, format; + int width, height, format; + double ratio; SDL_Overlay * overlay; } sdl_frame_t; @@ -172,7 +173,7 @@ static void sdl_compute_output_size (sdl_driver_t *this) { static void sdl_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { sdl_driver_t *this = (sdl_driver_t *) this_gen; sdl_frame_t *frame = (sdl_frame_t *) frame_gen; @@ -230,7 +231,7 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, SDL_LockYUVOverlay (frame->overlay); } - frame->ratio_code = ratio_code; + frame->ratio = ratio; } @@ -318,12 +319,12 @@ static void sdl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) - || (frame->ratio_code != this->sc.delivered_ratio_code) ) { + || (frame->ratio != this->sc.delivered_ratio) ) { printf("video_out_sdl: change frame format\n"); - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio_code = frame->ratio_code; + this->sc.delivered_width = frame->width; + this->sc.delivered_height = frame->height; + this->sc.delivered_ratio = frame->ratio; sdl_compute_ideal_size( this ); @@ -365,8 +366,8 @@ static int sdl_set_property (vo_driver_t *this_gen, sdl_driver_t *this = (sdl_driver_t *) this_gen; if ( property == VO_PROP_ASPECT_RATIO) { - if (value>=NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if (value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; printf("video_out_sdl: aspect ratio changed to %s\n", vo_scale_aspect_ratio_name(value)); @@ -595,6 +596,6 @@ static vo_info_t vo_info_sdl = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "sdl", XINE_VERSION_CODE, &vo_info_sdl, init_class }, + { PLUGIN_VIDEO_OUT, 16, "sdl", XINE_VERSION_CODE, &vo_info_sdl, init_class }, { PLUGIN_NONE, 0, "" , 0 , NULL, NULL} }; diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 73bae6fd8..8b7b609bb 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.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_syncfb.c,v 1.86 2003/08/04 02:14:12 miguelfreitas Exp $ + * $Id: video_out_syncfb.c,v 1.87 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine * @@ -72,7 +72,8 @@ typedef struct { typedef struct { vo_frame_t vo_frame; /* uint8_t* data_mem[3];*/ - int width, height, ratio_code, format; + int width, height, format; + double ratio; } syncfb_frame_t; struct syncfb_driver_s { @@ -498,7 +499,7 @@ static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) static void syncfb_update_frame_format(vo_driver_t* this_gen, vo_frame_t* frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) + double ratio, int format, int flags) { syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; /* uint32_t frame_size = width*height; */ @@ -549,7 +550,7 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, } } - frame->ratio_code = ratio_code; + frame->ratio = ratio; } static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, vo_overlay_t* overlay) @@ -578,14 +579,14 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) */ if((frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) - || (frame->ratio_code != this->sc.delivered_ratio_code)) { + || (frame->ratio != this->sc.delivered_ratio)) { #ifdef DEBUG_OUTPUT printf("video_out_syncfb: debug. (frame format changed)\n"); #endif - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio_code = frame->ratio_code; + this->sc.delivered_width = frame->width; + this->sc.delivered_height = frame->height; + this->sc.delivered_ratio = frame->ratio; syncfb_compute_ideal_size(this); @@ -664,8 +665,8 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) break; case VO_PROP_ASPECT_RATIO: - if(value >= NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if(value >= XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; this->sc.user_ratio = value; @@ -876,7 +877,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } this->props[VO_PROP_INTERLACED].value = 0; - this->sc.user_ratio = this->props[VO_PROP_ASPECT_RATIO].value = ASPECT_AUTO; + this->sc.user_ratio = this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; this->props[VO_PROP_ZOOM_X].value = 100; this->props[VO_PROP_ZOOM_Y].value = 100; @@ -1056,7 +1057,7 @@ static vo_info_t vo_info_syncfb = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "SyncFB", XINE_VERSION_CODE, &vo_info_syncfb, init_class }, + { PLUGIN_VIDEO_OUT, 16, "SyncFB", XINE_VERSION_CODE, &vo_info_syncfb, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 551451aef..af37144f1 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.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_vidix.c,v 1.44 2003/05/31 18:33:31 miguelfreitas Exp $ + * $Id: video_out_vidix.c,v 1.45 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_vidix.c * @@ -81,7 +81,8 @@ typedef struct vidix_property_s { typedef struct vidix_frame_s { vo_frame_t vo_frame; - int width, height, ratio_code, format; + int width, height, format; + double ratio; } vidix_frame_t; @@ -521,7 +522,7 @@ static void vidix_config_playback (vidix_driver_t *this) { static void vidix_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { vidix_frame_t *frame = (vidix_frame_t *) frame_gen; @@ -566,7 +567,7 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, } } - frame->ratio_code = ratio_code; + frame->ratio = ratio; } @@ -612,16 +613,16 @@ static void vidix_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) - || (frame->ratio_code != this->sc.delivered_ratio_code) + || (frame->ratio != this->sc.delivered_ratio) || (frame->format != this->delivered_format ) ) { #ifdef LOG printf("video_out_vidix: change frame format\n"); #endif - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio_code = frame->ratio_code; - this->delivered_format = frame->format; + this->sc.delivered_width = frame->width; + this->sc.delivered_height = frame->height; + this->sc.delivered_ratio = frame->ratio; + this->delivered_format = frame->format; vidix_compute_ideal_size( this ); this->sc.force_redraw = 1; @@ -677,8 +678,8 @@ static int vidix_set_property (vo_driver_t *this_gen, vo_scale_aspect_ratio_name(value)); #endif - if(value == NUM_ASPECT_RATIOS) - value = this->props[property].value = ASPECT_AUTO; + if(value == XINE_VO_ASPECT_NUM_RATIOS) + value = this->props[property].value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; vidix_compute_ideal_size (this); @@ -961,9 +962,9 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { (void*) vidix_db_callback, this); /* Set up remaining props */ - this->props[VO_PROP_ASPECT_RATIO].value = ASPECT_AUTO; + this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; this->props[VO_PROP_ASPECT_RATIO].min = 0; - this->props[VO_PROP_ASPECT_RATIO].max = NUM_ASPECT_RATIOS; + this->props[VO_PROP_ASPECT_RATIO].max = XINE_VO_ASPECT_NUM_RATIOS; this->props[VO_PROP_ZOOM_X].value = 100; this->props[VO_PROP_ZOOM_X].min = VO_ZOOM_MIN; @@ -1228,10 +1229,10 @@ static vo_info_t vo_info_vidixfb = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ #ifdef HAVE_X11 - { PLUGIN_VIDEO_OUT, 15, "vidix", XINE_VERSION_CODE, &vo_info_vidix, vidix_init_class }, + { PLUGIN_VIDEO_OUT, 16, "vidix", XINE_VERSION_CODE, &vo_info_vidix, vidix_init_class }, #endif #ifdef HAVE_FB - { PLUGIN_VIDEO_OUT, 15, "vidixfb", XINE_VERSION_CODE, &vo_info_vidixfb, vidixfb_init_class }, + { PLUGIN_VIDEO_OUT, 16, "vidixfb", XINE_VERSION_CODE, &vo_info_vidixfb, vidixfb_init_class }, #endif { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index b4bb0ec5d..dece34455 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.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_xshm.c,v 1.111 2003/05/31 18:33:31 miguelfreitas Exp $ + * $Id: video_out_xshm.c,v 1.112 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -447,7 +447,7 @@ static void xshm_compute_rgb_size (xshm_driver_t *this, xshm_frame_t *frame) { static void xshm_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; @@ -463,7 +463,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, if ((width != frame->sc.delivered_width) || (height != frame->sc.delivered_height) - || (ratio_code != frame->sc.delivered_ratio_code) + || (ratio != frame->sc.delivered_ratio) || (flags != frame->flags) || (format != frame->format) || (this->sc.user_ratio != frame->sc.user_ratio) @@ -475,13 +475,13 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, printf ("video_out_xshm: frame format (from decoder) has changed => adapt\n"); #endif - frame->sc.delivered_width = width; - frame->sc.delivered_height = height; - frame->sc.delivered_ratio_code = ratio_code; - frame->flags = flags; - frame->format = format; - frame->sc.user_ratio = this->sc.user_ratio; - frame->sc.gui_pixel_aspect = this->sc.gui_pixel_aspect; + frame->sc.delivered_width = width; + frame->sc.delivered_height = height; + frame->sc.delivered_ratio = ratio; + frame->flags = flags; + frame->format = format; + frame->sc.user_ratio = this->sc.user_ratio; + frame->sc.gui_pixel_aspect = this->sc.gui_pixel_aspect; xshm_compute_ideal_size (this, frame); } @@ -781,7 +781,7 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { switch (property) { case VO_PROP_ASPECT_RATIO: - return this->sc.user_ratio ; + return this->sc.user_ratio; case VO_PROP_MAX_NUM_FRAMES: return 15; case VO_PROP_BRIGHTNESS: @@ -807,8 +807,8 @@ static int xshm_set_property (vo_driver_t *this_gen, if ( property == VO_PROP_ASPECT_RATIO) { - if (value>=NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if (value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { printf ("video_out_xshm: aspect ratio changed to %s\n", @@ -1074,7 +1074,7 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; - this->sc.user_ratio = ASPECT_AUTO; + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; this->sc.scaling_disabled = config->register_bool (config, "video.disable_scaling", 0, _("disable all video scaling (faster!)"), @@ -1289,6 +1289,6 @@ static vo_info_t vo_info_xshm = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class }, + { PLUGIN_VIDEO_OUT, 16, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 900d137fa..9b990ea9b 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.170 2003/07/12 12:31:14 mroi Exp $ + * $Id: video_out_xv.c,v 1.171 2003/08/04 03:47:11 miguelfreitas Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -93,7 +93,8 @@ typedef struct { typedef struct { vo_frame_t vo_frame; - int width, height, ratio_code, format; + int width, height, format; + double ratio; XvImage *image; XShmSegmentInfo shminfo; @@ -408,7 +409,7 @@ static void dispose_ximage (xv_driver_t *this, static void xv_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, - int ratio_code, int format, int flags) { + double ratio, int format, int flags) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; @@ -456,7 +457,7 @@ static void xv_update_frame_format (vo_driver_t *this_gen, XUnlockDisplay (this->display); } - frame->ratio_code = ratio_code; + frame->ratio = ratio; } #define DEINTERLACE_CROMA @@ -473,7 +474,7 @@ static void xv_deinterlace_frame (xv_driver_t *this) { || (frame->width != this->deinterlace_frame.width) || (frame->height != this->deinterlace_frame.height ) || (frame->format != this->deinterlace_frame.format) - || (frame->ratio_code != this->deinterlace_frame.ratio_code)) { + || (frame->ratio != this->deinterlace_frame.ratio)) { XLockDisplay (this->display); if( this->deinterlace_frame.image ) @@ -486,7 +487,7 @@ static void xv_deinterlace_frame (xv_driver_t *this) { this->deinterlace_frame.width = frame->width; this->deinterlace_frame.height = frame->height; this->deinterlace_frame.format = frame->format; - this->deinterlace_frame.ratio_code = frame->ratio_code; + this->deinterlace_frame.ratio = frame->ratio; XUnlockDisplay (this->display); } @@ -673,9 +674,9 @@ static int xv_redraw_needed (vo_driver_t *this_gen) { if( this->cur_frame ) { - this->sc.delivered_height = this->cur_frame->height; - this->sc.delivered_width = this->cur_frame->width; - this->sc.delivered_ratio_code = this->cur_frame->ratio_code; + this->sc.delivered_height = this->cur_frame->height; + this->sc.delivered_width = this->cur_frame->width; + this->sc.delivered_ratio = this->cur_frame->ratio; xv_compute_ideal_size(this); @@ -717,7 +718,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { */ if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) - || (frame->ratio_code != this->sc.delivered_ratio_code) ) { + || (frame->ratio != this->sc.delivered_ratio) ) { #ifdef LOG printf("video_out_xv: frame format changed\n"); #endif @@ -832,8 +833,8 @@ static int xv_set_property (vo_driver_t *this_gen, break; case VO_PROP_ASPECT_RATIO: - if (value>=NUM_ASPECT_RATIOS) - value = ASPECT_AUTO; + if (value>=XINE_VO_ASPECT_NUM_RATIOS) + value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { @@ -1221,7 +1222,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } this->props[VO_PROP_INTERLACED].value = 0; - this->sc.user_ratio = this->props[VO_PROP_ASPECT_RATIO].value = ASPECT_AUTO; + this->sc.user_ratio = this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; this->props[VO_PROP_ZOOM_X].value = 100; this->props[VO_PROP_ZOOM_Y].value = 100; @@ -1472,7 +1473,7 @@ static vo_info_t vo_info_xv = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 15, "xv", XINE_VERSION_CODE, &vo_info_xv, init_class }, + { PLUGIN_VIDEO_OUT, 16, "xv", XINE_VERSION_CODE, &vo_info_xv, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c index 8c247e706..07c9c223d 100644 --- a/src/xine-engine/post.c +++ b/src/xine-engine/post.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: post.c,v 1.12 2003/05/31 18:33:31 miguelfreitas Exp $ + * $Id: post.c,v 1.13 2003/08/04 03:47:11 miguelfreitas Exp $ */ /* @@ -39,10 +39,10 @@ static void post_video_open(xine_video_port_t *port_gen, xine_stream_t *stream) } static vo_frame_t *post_video_get_frame(xine_video_port_t *port_gen, uint32_t width, - uint32_t height, int ratio_code, int format, int flags) { + uint32_t height, double ratio, int format, int flags) { post_video_port_t *port = (post_video_port_t *)port_gen; return port->original_port->get_frame(port->original_port, - width, height, ratio_code, format, flags); + width, height, ratio, format, flags); } static vo_frame_t *post_video_get_last_frame(xine_video_port_t *port_gen) { diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h index 894ef9180..38dc3a75c 100644 --- a/src/xine-engine/post.h +++ b/src/xine-engine/post.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: post.h,v 1.9 2003/05/31 18:33:31 miguelfreitas Exp $ + * $Id: post.h,v 1.10 2003/08/04 03:47:11 miguelfreitas Exp $ * * post plugin definitions * @@ -38,7 +38,7 @@ # include <xine/xineutils.h> #endif -#define POST_PLUGIN_IFACE_VERSION 3 +#define POST_PLUGIN_IFACE_VERSION 4 typedef struct post_class_s post_class_t; diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h index bf5936b70..e324e4b39 100644 --- a/src/xine-engine/video_decoder.h +++ b/src/xine-engine/video_decoder.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: video_decoder.h,v 1.9 2003/05/20 13:50:57 mroi Exp $ + * $Id: video_decoder.h,v 1.10 2003/08/04 03:47:11 miguelfreitas Exp $ * * xine video decoder plugin interface * @@ -34,7 +34,7 @@ # include <xine/buffer.h> #endif -#define VIDEO_DECODER_IFACE_VERSION 14 +#define VIDEO_DECODER_IFACE_VERSION 15 /* * generic xine video decoder plugin interface diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index bc3373b58..6797023fa 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.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.c,v 1.166 2003/07/13 15:27:34 guenter Exp $ + * $Id: video_out.c,v 1.167 2003/08/04 03:47:11 miguelfreitas Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -266,7 +266,7 @@ static void vo_frame_driver_copy(vo_frame_t *img) static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen, uint32_t width, uint32_t height, - int ratio, int format, + double ratio, int format, int flags) { vo_frame_t *img; @@ -1116,34 +1116,16 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue); pthread_mutex_unlock(&this->display_img_buf_queue->mutex); - frame->vpts = img->vpts; - frame->duration = img->duration; - frame->width = img->width; - frame->height = img->height; - frame->pos_stream = img->extra_info->input_pos; - frame->pos_time = img->extra_info->input_time; - - switch (img->ratio) { - case XINE_VO_ASPECT_ANAMORPHIC: /* anamorphic */ - case XINE_VO_ASPECT_PAN_SCAN: /* we display pan&scan as widescreen */ - frame->aspect_ratio = 16.0 /9.0; - break; - case XINE_VO_ASPECT_DVB: /* 2.11:1 */ - frame->aspect_ratio = 2.11/1.0; - break; - case XINE_VO_ASPECT_SQUARE: /* square pels */ - case XINE_VO_ASPECT_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ - frame->aspect_ratio = (double) img->width / (double) img->height; - break; - case 0: /* forbidden -> 4:3 */ - default: - case XINE_VO_ASPECT_4_3: /* 4:3 */ - frame->aspect_ratio = 4.0 / 3.0; - break; - } - frame->colorspace = img->format; - frame->data = img->base[0]; - frame->xine_frame = img; + frame->vpts = img->vpts; + frame->duration = img->duration; + frame->width = img->width; + frame->height = img->height; + frame->pos_stream = img->extra_info->input_pos; + frame->pos_time = img->extra_info->input_time; + frame->aspect_ratio = img->ratio; + frame->colorspace = img->format; + frame->data = img->base[0]; + frame->xine_frame = img; return 1; } diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index aeccdf01e..77517a9c8 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.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: video_out.h,v 1.92 2003/06/27 13:40:51 mroi Exp $ + * $Id: video_out.h,v 1.93 2003/08/04 03:47:11 miguelfreitas Exp $ * * * xine version of video_out.h @@ -129,7 +129,7 @@ struct vo_frame_s { /* additional information to be able to duplicate frames: */ int width, height; - int ratio; /* aspect ratio, codes see below */ + double ratio; /* aspect ratio */ int format; /* IMGFMT_YV12 or IMGFMT_YUY2 */ int drawn; /* used by decoder, frame has already been drawn */ @@ -175,7 +175,7 @@ struct xine_video_port_s { * flags == field/prediction flags */ vo_frame_t* (*get_frame) (xine_video_port_t *self, uint32_t width, - uint32_t height, int ratio_code, + uint32_t height, double ratio, int format, int flags); vo_frame_t* (*get_last_frame) (xine_video_port_t *self); @@ -245,16 +245,6 @@ struct xine_video_port_s { */ #define VO_NUM_RECENT_FRAMES 2 - -/* possible ratios for the VO_PROP_ASPECT_RATIO call */ - -#define ASPECT_AUTO 0 -#define ASPECT_ANAMORPHIC 1 /* 16:9 */ -#define ASPECT_FULL 2 /* 4:3 */ -#define ASPECT_DVB 3 /* 1:2 */ -#define ASPECT_SQUARE 4 /* square pels */ -#define NUM_ASPECT_RATIOS 5 - /* get_frame flags */ #define VO_TOP_FIELD 1 @@ -288,7 +278,7 @@ struct xine_video_port_s { * from generic vo functions. */ -#define VIDEO_OUT_DRIVER_IFACE_VERSION 15 +#define VIDEO_OUT_DRIVER_IFACE_VERSION 16 struct vo_driver_s { @@ -307,7 +297,7 @@ struct vo_driver_s { */ void (*update_frame_format) (vo_driver_t *self, vo_frame_t *img, uint32_t width, uint32_t height, - int ratio_code, int format, int flags); + double ratio, int format, int flags); /* display a given frame */ void (*display_frame) (vo_driver_t *self, vo_frame_t *vo_img); diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index 168d3e4fd..d113439eb 100644 --- a/src/xine-engine/vo_scale.c +++ b/src/xine-engine/vo_scale.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: vo_scale.c,v 1.21 2003/04/24 11:03:50 jstembridge Exp $ + * $Id: vo_scale.c,v 1.22 2003/08/04 03:47:11 miguelfreitas Exp $ * * Contains common code to calculate video scaling parameters. * In short, it will map frame dimensions to screen/window size. @@ -59,42 +59,24 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) { image_ratio = (double) this->delivered_width / (double) this->delivered_height; switch (this->user_ratio) { - case ASPECT_AUTO: - switch (this->delivered_ratio_code) { - case XINE_VO_ASPECT_ANAMORPHIC: /* anamorphic */ - case XINE_VO_ASPECT_PAN_SCAN: /* we display pan&scan as widescreen */ - desired_ratio = 16.0 /9.0; - break; - case XINE_VO_ASPECT_DVB: /* 2.11:1 */ - desired_ratio = 2.11/1.0; - break; - case XINE_VO_ASPECT_SQUARE: /* square pels */ - case XINE_VO_ASPECT_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ - desired_ratio = image_ratio; - break; - case 0: /* forbidden -> 4:3 */ - printf ("vo_scale: invalid ratio, using 4:3\n"); - default: - if (!warning_issued) { - printf ("vo_scale: unknown aspect ratio (%d) in stream => using 4:3\n", - this->delivered_ratio_code); - warning_issued = 1; - } - case XINE_VO_ASPECT_4_3: /* 4:3 */ - desired_ratio = 4.0 / 3.0; - break; + case XINE_VO_ASPECT_AUTO: + if (this->delivered_ratio <= 0.0) { + /* no way, that's crazy */ + desired_ratio = image_ratio; + } else { + desired_ratio = this->delivered_ratio; } break; - case ASPECT_ANAMORPHIC: + case XINE_VO_ASPECT_ANAMORPHIC: desired_ratio = 16.0 / 9.0; break; - case ASPECT_DVB: + case XINE_VO_ASPECT_DVB: desired_ratio = 2.0 / 1.0; break; - case ASPECT_SQUARE: + case XINE_VO_ASPECT_SQUARE: desired_ratio = image_ratio; break; - case ASPECT_FULL: + case XINE_VO_ASPECT_4_3: default: desired_ratio = 4.0 / 3.0; } @@ -325,15 +307,15 @@ void vo_scale_translate_gui2video(vo_scale_t *this, char *vo_scale_aspect_ratio_name(int a) { switch (a) { - case ASPECT_AUTO: + case XINE_VO_ASPECT_AUTO: return "auto"; - case ASPECT_SQUARE: + case XINE_VO_ASPECT_SQUARE: return "square"; - case ASPECT_FULL: + case XINE_VO_ASPECT_4_3: return "4:3"; - case ASPECT_ANAMORPHIC: + case XINE_VO_ASPECT_ANAMORPHIC: return "16:9"; - case ASPECT_DVB: + case XINE_VO_ASPECT_DVB: return "2:1"; default: return "unknown"; @@ -373,7 +355,8 @@ void vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled, this->zoom_factor_x = 1.0; this->zoom_factor_y = 1.0; this->gui_pixel_aspect = 1.0; - this->user_ratio = ASPECT_AUTO; + this->user_ratio = XINE_VO_ASPECT_AUTO; + this->delivered_ratio = 0.0; this->output_horizontal_position = config->register_range(config, "video.horizontal_position", 50, 0, 100, diff --git a/src/xine-engine/vo_scale.h b/src/xine-engine/vo_scale.h index 16d44f3f2..f53f6b852 100644 --- a/src/xine-engine/vo_scale.h +++ b/src/xine-engine/vo_scale.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: vo_scale.h,v 1.8 2003/05/20 13:50:57 mroi Exp $ + * $Id: vo_scale.h,v 1.9 2003/08/04 03:47:11 miguelfreitas Exp $ * * vo_scale.h * @@ -64,7 +64,7 @@ struct vo_scale_s { */ int delivered_width; int delivered_height; - int delivered_ratio_code; + double delivered_ratio; /* * displayed part of delivered images, |