Skip to content

Commit

Permalink
fix: prevent video distortion when rotation is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Oct 17, 2023
1 parent 8b1fba3 commit d0dc5be
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gridplayer/vlc_player/player_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
VIDEO_END_LOOP_MARGIN_MS,
AudioChannelMode,
VideoCrop,
VideoTransform,
)
from gridplayer.settings import Settings
from gridplayer.utils.aspect_calc import calc_crop, calc_resize_scale
Expand Down Expand Up @@ -516,7 +517,19 @@ def video_dimensions(self):
if self._media_player is None or self.media is None:
return 0, 0

return self._media_player.video_get_size()
video_size = self._media_player.video_get_size()

rotation_transforms = {
VideoTransform.ROTATE_90,
VideoTransform.ROTATE_270,
VideoTransform.TRANSPOSE,
VideoTransform.ANTITRANSPOSE,
}

if self.media_input.video.transform in rotation_transforms:
return tuple(reversed(video_size))

return video_size

@only_initialized_player
def adjust_view(self, size, aspect, scale, crop):
Expand Down

0 comments on commit d0dc5be

Please sign in to comment.