Skip to content

Commit bd41996

Browse files
committed
Allow negative MP4 rotations
1 parent 8430a31 commit bd41996

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

MetadataExtractor/Formats/QuickTime/QuickTimeMetadataReader.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ static void SetRotation(QuickTimeTrackHeaderDirectory directory)
8989
var x = matrix[1] + matrix[4];
9090
var y = matrix[0] + matrix[3];
9191
var theta = Math.Atan2(x, y);
92-
var degree = ((180 / Math.PI) * theta) - 45;
93-
if (degree < 0)
94-
degree += 360;
92+
var degree = RadiansToDegrees(theta) - 45;
9593

9694
directory.Set(QuickTimeTrackHeaderDirectory.TagRotation, degree);
95+
96+
static double RadiansToDegrees(double radians) => (180 / Math.PI) * radians;
9797
}
9898
}
9999

0 commit comments

Comments
 (0)