From 02323a184f2ddfed112d83d8e4f5880a0ee30480 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Mon, 9 Aug 2021 10:33:55 -0500 Subject: 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. --- player/command.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/player/command.c b/player/command.c index 6e8679d1ad..04d5e076ae 100644 --- a/player/command.c +++ b/player/command.c @@ -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)) 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) { // Also called by update_window_scale as a NULL property. double scale = *(double *)arg; -- cgit v1.2.3