diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MetadataHandler.kt b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MetadataHandler.kt index 22752003f..33fc09a69 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MetadataHandler.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/MetadataHandler.kt @@ -144,6 +144,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler { if (dir.getString(Mp4UuidBoxDirectory.TAG_UUID) == GSpherical.SPHERICAL_VIDEO_V1_UUID) { val bytes = dir.getByteArray(Mp4UuidBoxDirectory.TAG_USER_DATA) metadataMap["Spherical Video"] = HashMap(GSpherical(bytes).describe()) + metadataMap.remove(dirName) } } } diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/metadata/SphericalVideo.kt b/android/app/src/main/kotlin/deckers/thibault/aves/metadata/SphericalVideo.kt index 6bba753d9..d3e07061e 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/metadata/SphericalVideo.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/metadata/SphericalVideo.kt @@ -6,7 +6,8 @@ import deckers.thibault.aves.utils.LogUtils import org.xmlpull.v1.XmlPullParser import java.io.ByteArrayInputStream -class GSpherical(bytes: ByteArray) { +// `xmlBytes`: bytes representing the XML embedded in a MP4 `uuid` box, according to Spherical Video V1 spec +class GSpherical(xmlBytes: ByteArray) { var spherical: Boolean = false var stitched: Boolean = false var stitchingSoftware: String = "" @@ -26,7 +27,7 @@ class GSpherical(bytes: ByteArray) { init { try { - ByteArrayInputStream(bytes).use { + ByteArrayInputStream(xmlBytes).use { val parser = Xml.newPullParser().apply { setInput(it, null) nextTag() diff --git a/lib/widgets/fullscreen/info/metadata/xmp_ns/xmp.dart b/lib/widgets/fullscreen/info/metadata/xmp_ns/xmp.dart index 1a5dd4f28..2c73826c6 100644 --- a/lib/widgets/fullscreen/info/metadata/xmp_ns/xmp.dart +++ b/lib/widgets/fullscreen/info/metadata/xmp_ns/xmp.dart @@ -51,9 +51,13 @@ class XmpMMNamespace extends XmpNamespace { static final derivedFromPattern = RegExp(r'xmpMM:DerivedFrom/(.*)'); static final historyPattern = RegExp(r'xmpMM:History\[(\d+)\]/(.*)'); + static final ingredientsPattern = RegExp(r'xmpMM:Ingredients\[(\d+)\]/(.*)'); + static final pantryPattern = RegExp(r'xmpMM:Pantry\[(\d+)\]/(.*)'); final derivedFrom = {}; final history = >{}; + final ingredients = >{}; + final pantry = >{}; XmpMMNamespace() : super(ns); @@ -63,7 +67,9 @@ class XmpMMNamespace extends XmpNamespace { @override bool extractData(XmpProp prop) { final hasStructs = extractStruct(prop, derivedFromPattern, derivedFrom); - final hasIndexedStructs = extractIndexedStruct(prop, historyPattern, history); + var hasIndexedStructs = extractIndexedStruct(prop, historyPattern, history); + hasIndexedStructs |= extractIndexedStruct(prop, ingredientsPattern, ingredients); + hasIndexedStructs |= extractIndexedStruct(prop, pantryPattern, pantry); return hasStructs || hasIndexedStructs; } @@ -79,6 +85,16 @@ class XmpMMNamespace extends XmpNamespace { title: 'History', structByIndex: history, ), + if (ingredients.isNotEmpty) + XmpStructArrayCard( + title: 'Ingredients', + structByIndex: ingredients, + ), + if (pantry.isNotEmpty) + XmpStructArrayCard( + title: 'Pantry', + structByIndex: pantry, + ), ]; @override