command: check for monitor par in window-scale

When performing the scaling calculations, the window scale properties do
not bother checking for potential monitor par. The vo keeps track of
this via vo->monitor_par. Simply multiply/divide the video's width or
height depending on the value of monitor_par. We also clamp the values
to avoid the values running away to infinity in extreme cases.
This commit is contained in:
Dudemanguy 2021-08-09 10:33:55 -05:00
parent 9dc0857b3d
commit 02323a184f
1 changed files with 6 additions and 0 deletions

View File

@ -2333,6 +2333,12 @@ static int mp_property_current_window_scale(void *ctx, struct m_property *prop,
if (params.rotate % 180 == 90 && (vo->driver->caps & VO_CAP_ROTATE90)) if (params.rotate % 180 == 90 && (vo->driver->caps & VO_CAP_ROTATE90))
MPSWAP(int, vid_w, vid_h); MPSWAP(int, vid_w, vid_h);
if (vo->monitor_par < 1) {
vid_h = MPCLAMP(vid_h / vo->monitor_par, 1, 16000);
} else {
vid_w = MPCLAMP(vid_w * vo->monitor_par, 1, 16000);
}
if (action == M_PROPERTY_SET) { if (action == M_PROPERTY_SET) {
// Also called by update_window_scale as a NULL property. // Also called by update_window_scale as a NULL property.
double scale = *(double *)arg; double scale = *(double *)arg;