summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-08-09 10:33:55 -0500
committerDudemanguy <random342@airmail.cc>2021-08-09 16:33:39 +0000
commit02323a184f2ddfed112d83d8e4f5880a0ee30480 (patch)
tree4f9ec3fe145516ce29e364f7b2eaeb011d7fab41
parent9dc0857b3d989148fb9d871e6cd3f1bc3c9110db (diff)
downloadmpv-02323a184f2ddfed112d83d8e4f5880a0ee30480.tar.bz2
mpv-02323a184f2ddfed112d83d8e4f5880a0ee30480.tar.xz
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.
-rw-r--r--player/command.c6
1 files changed, 6 insertions, 0 deletions
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;