--- src/libxinevdec/image.c.orig 2006-07-31 15:25:33.000000000 +0300 +++ src/libxinevdec/image.c 2006-09-04 19:06:53.000000000 +0300 @@ -89,4 +89,5 @@ yuv_planes_t yuv_planes; vo_frame_t *img; + int scale, win_width, win_height; /* @@ -105,4 +106,33 @@ width = MagickGetImageWidth(wand) & ~1; /* must be even for init_yuv_planes */ height = MagickGetImageHeight(wand); + + win_width = this->stream->video_out->get_property( this->stream->video_out, + VO_PROP_WINDOW_WIDTH); + win_height = this->stream->video_out->get_property( this->stream->video_out, + VO_PROP_WINDOW_HEIGHT); + scale = 0; + if(width > win_width) { + height = height * win_width / width; + width = win_width & ~1; + scale = 1; + } + if(height > win_height) { + width = (width * win_height / height) & ~1; + height = win_height; + scale = 1; + } + if(scale) { + status = MagickResizeImage(wand, width, height, UndefinedFilter, 1.0); + //MagickResizeImage(wand, width, height, LanczosFilter, 1.0); + + if (status == MagickFalse) { + DestroyMagickWand(wand); + lprintf("error scaling image\n"); + return; + } + } + + width = MagickGetImageWidth(wand) & ~1; /* must be even for init_yuv_planes */ + height = MagickGetImageHeight(wand); img_buf = malloc(width * height * 3); MagickGetImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf);