# HG changeset patch # User atmos4 # Date 1002120113 0 # Node ID 720ca9249e4e30f517f326e281449449e85cb719 # Parent 9af96cfbe17502f0edeacd6a3562b8596dc8b745 Monitor aspect stuff. diff -r 9af96cfbe175 -r 720ca9249e4e cfg-mplayer.h --- a/cfg-mplayer.h Tue Oct 02 22:37:28 2001 +0000 +++ b/cfg-mplayer.h Wed Oct 03 14:41:53 2001 +0000 @@ -64,6 +64,9 @@ extern char * skinName; #endif +/* from libvo/aspect.c */ +extern float monitor_aspect; + /* * CONF_TYPE_FUNC_FULL : * allows own implemtations for passing the params @@ -212,6 +215,7 @@ {"xy", &screen_size_xy, CONF_TYPE_INT, CONF_RANGE, 0, 4096}, {"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0}, {"noaspect", &movie_aspect, CONF_TYPE_FLAG, 0, 0, 0}, + {"monitoraspect", &monitor_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0}, {"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1}, {"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0}, {"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1}, diff -r 9af96cfbe175 -r 720ca9249e4e libvo/aspect.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libvo/aspect.c Wed Oct 03 14:41:53 2001 +0000 @@ -0,0 +1,32 @@ +/* Stuff for correct aspect scaling. */ +#include "aspect.h" + +float monitor_aspect=4.0/3.0; + +/* aspect is called with the source resolution and the + * resolution, that the scaled image should fit into + */ + +rect_t aspect(int srcw, int srch, int fitinw, int fitinh){ + rect_t r,z; + r.w=fitinw; + r.x=0; + r.h=(int)(((float)fitinw / (float)srcw * (float)srch) + * ((float)fitinh/((float)fitinw/monitor_aspect))); + r.h+=r.h%2; // round + r.y=(fitinh-r.h)/2; + z=r; + //printf("aspect rez x: %d y: %d wh: %dx%d\n",r.x,r.y,r.w,r.h); + if(r.h>fitinh || r.hfitinw) r=z; + //printf("aspect ret x: %d y: %d wh: %dx%d\n",r.x,r.y,r.w,r.h); + return r; +} + diff -r 9af96cfbe175 -r 720ca9249e4e libvo/aspect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libvo/aspect.h Wed Oct 03 14:41:53 2001 +0000 @@ -0,0 +1,15 @@ +#ifndef __ASPECT_H +#define __ASPECT_H +/* Stuff for correct aspect scaling. */ + +typedef struct { + int x; /* x,y starting coordinate */ + int y; /* of upper left corner */ + int w; /* width */ + int h; /* height */ +} rect_t; + +rect_t aspect(int srcw, int srch, int fitinw, int fitinh); + +#endif +