diff options
author | Marco Migliori <sgerwk@aol.com> | 2018-02-15 13:33:19 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-02-21 22:27:18 -0800 |
commit | 5cc796daccd3f3ccc0506d4423fd52e00c12218a (patch) | |
tree | 4c793841fe6e006cd1feb2fba72ebe6ac199d791 /video/out | |
parent | ed13206a18f5f6fa7509144603f836ddacb59739 (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/out')
-rw-r--r-- | video/out/vo_drm.c | 8 |
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; |