path: root/video
diff options
authorMarco Migliori <>2018-02-15 13:33:19 +0100
committerKevin Mitchell <>2018-02-21 22:27:18 -0800
commit5cc796daccd3f3ccc0506d4423fd52e00c12218a (patch)
tree4c793841fe6e006cd1feb2fba72ebe6ac199d791 /video
parented13206a18f5f6fa7509144603f836ddacb59739 (diff)
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.
Diffstat (limited to 'video')
1 files changed, 7 insertions, 1 deletions
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;