summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-08-09 08:59:55 -0500
committerDudemanguy <random342@airmail.cc>2021-08-09 16:33:39 +0000
commit9dc0857b3d989148fb9d871e6cd3f1bc3c9110db (patch)
tree8aed4b88c87097f5ef359ba6ab70bcb9fda3a3b9
parent77f2fd97f89c93be6595dde29b86384047f05ba2 (diff)
downloadmpv-9dc0857b3d989148fb9d871e6cd3f1bc3c9110db.tar.bz2
mpv-9dc0857b3d989148fb9d871e6cd3f1bc3c9110db.tar.xz
command: check for rotation in window-scale
The vo currently handles rotations in 90 degree steps and some VOs set this via VO_CAP_ROTATE90. When the rotation exactly hits either 90 or 270 degrees, this causes the values of dwidth and dheight to perfectly swap like one would expect. However, the mp_image_params_get_dsize function call in both of the window scale functions do not take this special case into account. So the width/height values returned will be incorrectly flipped in the 90 and 270 degree cases if the vo driver does implement VO_CAP_ROTATE90 (like vo=gpu). Fortunately, the mp_image_params struct keeps track of the rotation for us. So all we need to do is check if the image is rotated at 90 or 270 degrees and check that the current vo driver supports VO_CAP_ROTATE90. If so, then swap vid_w and vid_h to their true, correct values.
-rw-r--r--player/command.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index d703c39afe..6e8679d1ad 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2330,6 +2330,9 @@ static int mp_property_current_window_scale(void *ctx, struct m_property *prop,
if (vid_w < 1 || vid_h < 1)
return M_PROPERTY_UNAVAILABLE;
+ if (params.rotate % 180 == 90 && (vo->driver->caps & VO_CAP_ROTATE90))
+ MPSWAP(int, vid_w, vid_h);
+
if (action == M_PROPERTY_SET) {
// Also called by update_window_scale as a NULL property.
double scale = *(double *)arg;