Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] write getter for video dimensions considering rotation in FFProbeProps

ashilkn3f0855d9a41d
diff --git a/mobile/lib/models/ffmpeg/ffprobe_props.dart b/mobile/lib/models/ffmpeg/ffprobe_props.dart
index 9023f83461..cbe8d98f53 100644
--- a/mobile/lib/models/ffmpeg/ffprobe_props.dart
+++ b/mobile/lib/models/ffmpeg/ffprobe_props.dart
@@ -1,8 +1,10 @@
// Adapted from: https://github.com/deckerst/aves
import "dart:developer";
+import "dart:ui";
import "package:collection/collection.dart";
+import "package:flutter/widgets.dart";
import "package:intl/intl.dart";
import "package:photos/models/ffmpeg/channel_layouts.dart";
import "package:photos/models/ffmpeg/codecs.dart";
@@ -33,6 +35,20 @@ class FFProbeProps {
return info.join(' * ');
}
+ Size? get videoDimentionsConsideringRotation {
+ final int width = int.tryParse(codecWidth ?? '0') ?? 0;
+ final int height = int.tryParse(codecHeight ?? '0') ?? 0;
+ if (width == 0 || height == 0) return null;
+
+ if (rotation != null) {
+ if ((rotation! ~/ 90).isEven) {
+ return Size(width.toDouble(), height.toDouble());
+ } else {
+ return Size(height.toDouble(), width.toDouble());
+ }
+ }
+ }
+
// toString() method
@override
String toString() {