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