Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Add method to getXMP data via computer

Neeraj Guptac20b3cf585c7
diff --git a/mobile/lib/utils/exif_util.dart b/mobile/lib/utils/exif_util.dart
index 5459cd543f..1febb9bb0c 100644
--- a/mobile/lib/utils/exif_util.dart
+++ b/mobile/lib/utils/exif_util.dart
@@ -10,6 +10,7 @@ import "package:ffmpeg_kit_flutter_min/media_information_session.dart";
import "package:flutter/foundation.dart";
import 'package:intl/intl.dart';
import 'package:logging/logging.dart';
+import "package:motion_photos/src/xmp_extractor.dart";
import "package:photos/models/ffmpeg/ffprobe_props.dart";
import 'package:photos/models/file/file.dart';
import "package:photos/models/location/location.dart";
@@ -56,6 +57,32 @@ Future<Map<String, IfdTag>?> getExifFromSourceFile(File originFile) async {
}
}
+Future<FFProbeProps?> getVideoPropsAsyncV2(File originalFile) async {
+ return Computer.shared().compute(
+ getVideoPropsComputer,
+ param: {"file": originalFile},
+ taskName: "getVideoPropsAsyncV2",
+ );
+}
+
+Future<FFProbeProps?> getVideoPropsComputer(Map<String, dynamic> args) {
+ final File originalFile = args["file"];
+ return getVideoPropsAsync(originalFile);
+}
+
+Future<Map<String, dynamic>> getXmp(File file) async {
+ return Computer.shared().compute(
+ _getXMPComputer,
+ param: {"file": file},
+ taskName: "getXMPAsync",
+ );
+}
+
+Map<String, dynamic> _getXMPComputer(Map<String, dynamic> args) {
+ final File originalFile = args["file"] as File;
+ return XMPExtractor().extract(originalFile.readAsBytesSync());
+}
+
Future<FFProbeProps?> getVideoPropsAsync(File originalFile) async {
try {
final stopwatch = Stopwatch()..start();