summaryrefslogtreecommitdiffstats
path: root/video/out/aspect.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-11 18:44:27 +0100
committerwm4 <wm4@nowhere>2014-01-11 18:58:06 +0100
commitd956bbc065d570f425f402c83d69957584591dbd (patch)
treea515ffd2ada6a21d583e00f22079c0e33ff0dc76 /video/out/aspect.c
parent3b8e457379586b3400ede0b3ca96baa15aa1ab06 (diff)
downloadmpv-d956bbc065d570f425f402c83d69957584591dbd.tar.bz2
mpv-d956bbc065d570f425f402c83d69957584591dbd.tar.xz
video/out: simplify monitor aspect handling
For some reason, this made all VO backends both set the screen resolution in opts->screenwidth/height, and call aspect_save_screenres(). Remove the latter. Move the code to calculate the PAR-corrected window size from aspect.c to vo.c, and make it so that the monitor PAR is recalculated when it makes sense.
Diffstat (limited to 'video/out/aspect.c')
-rw-r--r--video/out/aspect.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/video/out/aspect.c b/video/out/aspect.c
index 0e2e926c0f..b7c6c61e07 100644
--- a/video/out/aspect.c
+++ b/video/out/aspect.c
@@ -35,37 +35,16 @@ void aspect_save_videores(struct vo *vo, int w, int h, int d_w, int d_h)
vo->aspdat.par = (double)d_w / d_h * h / w;
}
-void aspect_save_screenres(struct vo *vo, int scrw, int scrh)
-{
- MP_DBG(vo, "aspect_save_screenres %dx%d\n", scrw, scrh);
- struct mp_vo_opts *opts = vo->opts;
- if (scrw > 0 && scrh > 0 && opts->force_monitor_aspect)
- vo->aspdat.monitor_par = opts->force_monitor_aspect * scrh / scrw;
- else
- vo->aspdat.monitor_par = 1.0 / opts->monitor_pixel_aspect;
-}
-
-void aspect_calc_monitor(struct vo *vo, int *w, int *h)
-{
- float pixelaspect = vo->aspdat.monitor_par;
-
- if (pixelaspect < 1) {
- *h /= pixelaspect;
- } else {
- *w *= pixelaspect;
- }
-}
-
static void aspect_calc(struct vo *vo, int *srcw, int *srch)
{
struct aspect_data *aspdat = &vo->aspdat;
- float pixelaspect = aspdat->monitor_par;
+ float pixelaspect = vo->monitor_par;
int fitw = FFMAX(1, vo->dwidth);
int fith = FFMAX(1, vo->dheight);
MP_DBG(vo, "aspect(0) fitin: %dx%d monitor_par: %.2f\n",
- fitw, fith, aspdat->monitor_par);
+ fitw, fith, pixelaspect);
*srcw = fitw;
*srch = (float)fitw / aspdat->prew * aspdat->preh / pixelaspect;
MP_DBG(vo, "aspect(1) wh: %dx%d (org: %dx%d)\n",