mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
ed13206a18
commit
5cc796dacc
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue