From 5cc796daccd3f3ccc0506d4423fd52e00c12218a Mon Sep 17 00:00:00 2001 From: Marco Migliori Date: Thu, 15 Feb 2018 13:33:19 +0100 Subject: drm_vo: pixel aspect from --monitoraspect When pixels are non-square, the appropriate value of vo->monitor_par is necessary to determine the destination rectangle, which in turn tells how to scale the video along the x and y axis. Before this commit, the drm driver only used --monitorpixelaspect. For example, to play a video with the right aspect on a 4:3 screen and 640:400 pixels, --monitorpixelaspect=5:6 had to be given. With this commit, vo->monitor_par is determined from the size of the screen in pixels and the --monitoraspect parameter. The latter is usually easier to determine than --monitorpixelaspect, since it is simply the proportion between the width and the height of the screen, in most cases 16:9 or 4:3. If --monitoraspect is not given, --monitorpixelaspect is used if given, otherwise pixel aspect is assumed 1:1. --- video/out/vo_drm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c index e66058657b..2cf88ad862 100644 --- a/video/out/vo_drm.c +++ b/video/out/vo_drm.c @@ -443,7 +443,13 @@ static int preinit(struct vo *vo) goto err; } - vo->monitor_par = 1 / vo->opts->monitor_pixel_aspect; + if (vo->opts->force_monitor_aspect != 0.0) { + vo->monitor_par = p->screen_w / (double) p->screen_h / + vo->opts->force_monitor_aspect; + } else { + vo->monitor_par = 1 / vo->opts->monitor_pixel_aspect; + } + mp_verbose(vo->log, "Monitor pixel aspect: %g\n", vo->monitor_par); return 0; -- cgit v1.2.3