From 6ac6d446cfbf40136c28b011cd13e029b5af7fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Rish=C3=B8j?= Date: Fri, 29 Sep 2023 14:55:17 +0200 Subject: [PATCH] =?UTF-8?q?handle=20streams=20that=20are=20rotated=2090?= =?UTF-8?q?=C2=B0=20or=20270=C2=B0=20(hadronepoch/PHP-FFmpeg-video-streami?= =?UTF-8?q?ng#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AutoReps.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/AutoReps.php b/src/AutoReps.php index 63aa200..d76306e 100644 --- a/src/AutoReps.php +++ b/src/AutoReps.php @@ -74,7 +74,13 @@ public function sort(bool $sort) private function getDimensions(): Dimension { try { - return $this->video->getDimensions(); + $rotation = (int) ($this->video->get('tags')['rotate'] ?? 0); + $dimensions = $this->video->getDimensions(); + + return ($rotation % 180 == 0) + ? $dimensions + : new Dimension($dimensions->getHeight(), $dimensions->getWidth()); + } catch (ExceptionInterface $e) { throw new RuntimeException("Unable to extract dimensions.: " . $e->getMessage(), $e->getCode(), $e); }