#1417 do not trust video size and orientation reported by media store
This commit is contained in:
parent
bbd819df19
commit
bad11564c6
3 changed files with 9 additions and 3 deletions
|
@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
- editing TIFF metadata increasing file size
|
- editing TIFF metadata increasing file size
|
||||||
- region decoding for some RAW files
|
- region decoding for some RAW files
|
||||||
|
- incorrect video size or orientation as reported by Media Store
|
||||||
|
|
||||||
## <a id="v1.12.2"></a>[v1.12.2] - 2025-01-13
|
## <a id="v1.12.2"></a>[v1.12.2] - 2025-01-13
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ extension ExtraAvesEntryCatalog on AvesEntry {
|
||||||
catalogMetadata = CatalogMetadata(id: id);
|
catalogMetadata = CatalogMetadata(id: id);
|
||||||
} else {
|
} else {
|
||||||
// pre-processing
|
// pre-processing
|
||||||
if ((isVideo && (!isSized || durationMillis == 0)) || mimeType == MimeTypes.avif) {
|
if (isVideo || mimeType == MimeTypes.avif) {
|
||||||
// exotic video that is not sized during loading
|
// on initial loading, original source may report incorrect size, rotation or duration
|
||||||
final fields = await VideoMetadataFormatter.getLoadingMetadata(this);
|
final fields = await VideoMetadataFormatter.getLoadingMetadata(this);
|
||||||
// check size as the video interpreter may fail on some AVIF stills
|
// check size as the video interpreter may fail on some AVIF stills
|
||||||
final width = fields[EntryFields.width];
|
final width = fields[EntryFields.width];
|
||||||
|
|
|
@ -47,7 +47,7 @@ class VideoMetadataFormatter {
|
||||||
Codecs.webm: 'WebM',
|
Codecs.webm: 'WebM',
|
||||||
};
|
};
|
||||||
|
|
||||||
// fetch size and duration
|
// fetch size, rotation and duration
|
||||||
static Future<Map<String, int>> getLoadingMetadata(AvesEntry entry) async {
|
static Future<Map<String, int>> getLoadingMetadata(AvesEntry entry) async {
|
||||||
final mediaInfo = await videoMetadataFetcher.getMetadata(entry);
|
final mediaInfo = await videoMetadataFetcher.getMetadata(entry);
|
||||||
final fields = <String, int>{};
|
final fields = <String, int>{};
|
||||||
|
@ -63,6 +63,11 @@ class VideoMetadataFormatter {
|
||||||
fields[EntryFields.width] = width;
|
fields[EntryFields.width] = width;
|
||||||
fields[EntryFields.height] = height;
|
fields[EntryFields.height] = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final rotationDegrees = sizedStream[Keys.rotate];
|
||||||
|
if (rotationDegrees is int) {
|
||||||
|
fields[EntryFields.rotationDegrees] = rotationDegrees;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue