diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt b/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt index e024acd72..8cc0aa52a 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/utils/MimeTypes.kt @@ -99,9 +99,12 @@ object MimeTypes { else -> true } - // as of `ExifInterface` v1.3.1, `isSupportedMimeType` reports - // no support for TIFF images, but it can actually open them (maybe other formats too) - fun canReadWithExifInterface(mimeType: String, strict: Boolean = true) = ExifInterface.isSupportedMimeType(mimeType) || !strict + // as of `ExifInterface` v1.4.0-alpha01, `isSupportedMimeType` reports + // no support for AVIF/TIFF images, but it can actually open them (maybe other formats too) + fun canReadWithExifInterface(mimeType: String, strict: Boolean = true): Boolean { + if (!strict) return true + return ExifInterface.isSupportedMimeType(mimeType) || mimeType == AVIF + } // as of latest PixyMeta fun canReadWithPixyMeta(mimeType: String) = when (mimeType) { @@ -143,7 +146,7 @@ object MimeTypes { return if (pageId != null && MultiPageImage.isSupported(mimeType)) { true } else when (mimeType) { - DNG, DNG_ADOBE, HEIC, HEIF, PNG, WEBP -> true + AVIF, DNG, DNG_ADOBE, HEIC, HEIF, PNG, WEBP -> true else -> false } } diff --git a/lib/model/entry/extensions/catalog.dart b/lib/model/entry/extensions/catalog.dart index fc158c122..c6c7605ba 100644 --- a/lib/model/entry/extensions/catalog.dart +++ b/lib/model/entry/extensions/catalog.dart @@ -33,7 +33,13 @@ extension ExtraAvesEntryCatalog on AvesEntry { if ((isVideo && (!isSized || durationMillis == 0)) || mimeType == MimeTypes.avif) { // exotic video that is not sized during loading final fields = await VideoMetadataFormatter.getLoadingMetadata(this); - await applyNewFields(fields, persist: persist); + // check size as the video interpreter may fail on some AVIF stills + final width = fields['width']; + final height = fields['height']; + final isValid = (width == null || width > 0) && (height == null || height > 0); + if (isValid) { + await applyNewFields(fields, persist: persist); + } } // cataloguing on platform