mirror of
https://github.com/mpv-player/mpv
synced 2025-04-07 18:14:33 +00:00
Monitor aspect stuff.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2054 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d276fe5634
commit
abb7153e94
@ -64,6 +64,9 @@ extern int dvd_angle;
|
|||||||
extern char * skinName;
|
extern char * skinName;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* from libvo/aspect.c */
|
||||||
|
extern float monitor_aspect;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CONF_TYPE_FUNC_FULL :
|
* CONF_TYPE_FUNC_FULL :
|
||||||
* allows own implemtations for passing the params
|
* allows own implemtations for passing the params
|
||||||
@ -212,6 +215,7 @@ struct config conf[]={
|
|||||||
{"xy", &screen_size_xy, CONF_TYPE_INT, CONF_RANGE, 0, 4096},
|
{"xy", &screen_size_xy, CONF_TYPE_INT, CONF_RANGE, 0, 4096},
|
||||||
{"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0},
|
{"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0},
|
||||||
{"noaspect", &movie_aspect, CONF_TYPE_FLAG, 0, 0, 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},
|
{"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1},
|
||||||
{"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0},
|
{"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0},
|
||||||
{"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1},
|
{"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1},
|
||||||
|
32
libvo/aspect.c
Normal file
32
libvo/aspect.c
Normal file
@ -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.h<srch){
|
||||||
|
r.h=fitinh;
|
||||||
|
r.y=0;
|
||||||
|
r.w=(int)(((float)fitinh / (float)srch * (float)srcw)
|
||||||
|
* ((float)fitinw/((float)fitinh/(1/monitor_aspect))));
|
||||||
|
r.w+=r.w%2; // round
|
||||||
|
r.x=(fitinw-r.w)/2;
|
||||||
|
}
|
||||||
|
if(r.w>fitinw) r=z;
|
||||||
|
//printf("aspect ret x: %d y: %d wh: %dx%d\n",r.x,r.y,r.w,r.h);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
15
libvo/aspect.h
Normal file
15
libvo/aspect.h
Normal file
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user