minor changes
This commit is contained in:
parent
e127a5ebca
commit
13a8e23034
3 changed files with 21 additions and 3 deletions
|
@ -144,6 +144,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
if (dir.getString(Mp4UuidBoxDirectory.TAG_UUID) == GSpherical.SPHERICAL_VIDEO_V1_UUID) {
|
if (dir.getString(Mp4UuidBoxDirectory.TAG_UUID) == GSpherical.SPHERICAL_VIDEO_V1_UUID) {
|
||||||
val bytes = dir.getByteArray(Mp4UuidBoxDirectory.TAG_USER_DATA)
|
val bytes = dir.getByteArray(Mp4UuidBoxDirectory.TAG_USER_DATA)
|
||||||
metadataMap["Spherical Video"] = HashMap(GSpherical(bytes).describe())
|
metadataMap["Spherical Video"] = HashMap(GSpherical(bytes).describe())
|
||||||
|
metadataMap.remove(dirName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import deckers.thibault.aves.utils.LogUtils
|
||||||
import org.xmlpull.v1.XmlPullParser
|
import org.xmlpull.v1.XmlPullParser
|
||||||
import java.io.ByteArrayInputStream
|
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 spherical: Boolean = false
|
||||||
var stitched: Boolean = false
|
var stitched: Boolean = false
|
||||||
var stitchingSoftware: String = ""
|
var stitchingSoftware: String = ""
|
||||||
|
@ -26,7 +27,7 @@ class GSpherical(bytes: ByteArray) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
try {
|
try {
|
||||||
ByteArrayInputStream(bytes).use {
|
ByteArrayInputStream(xmlBytes).use {
|
||||||
val parser = Xml.newPullParser().apply {
|
val parser = Xml.newPullParser().apply {
|
||||||
setInput(it, null)
|
setInput(it, null)
|
||||||
nextTag()
|
nextTag()
|
||||||
|
|
|
@ -51,9 +51,13 @@ class XmpMMNamespace extends XmpNamespace {
|
||||||
|
|
||||||
static final derivedFromPattern = RegExp(r'xmpMM:DerivedFrom/(.*)');
|
static final derivedFromPattern = RegExp(r'xmpMM:DerivedFrom/(.*)');
|
||||||
static final historyPattern = RegExp(r'xmpMM:History\[(\d+)\]/(.*)');
|
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 = <String, String>{};
|
final derivedFrom = <String, String>{};
|
||||||
final history = <int, Map<String, String>>{};
|
final history = <int, Map<String, String>>{};
|
||||||
|
final ingredients = <int, Map<String, String>>{};
|
||||||
|
final pantry = <int, Map<String, String>>{};
|
||||||
|
|
||||||
XmpMMNamespace() : super(ns);
|
XmpMMNamespace() : super(ns);
|
||||||
|
|
||||||
|
@ -63,7 +67,9 @@ class XmpMMNamespace extends XmpNamespace {
|
||||||
@override
|
@override
|
||||||
bool extractData(XmpProp prop) {
|
bool extractData(XmpProp prop) {
|
||||||
final hasStructs = extractStruct(prop, derivedFromPattern, derivedFrom);
|
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;
|
return hasStructs || hasIndexedStructs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +85,16 @@ class XmpMMNamespace extends XmpNamespace {
|
||||||
title: 'History',
|
title: 'History',
|
||||||
structByIndex: history,
|
structByIndex: history,
|
||||||
),
|
),
|
||||||
|
if (ingredients.isNotEmpty)
|
||||||
|
XmpStructArrayCard(
|
||||||
|
title: 'Ingredients',
|
||||||
|
structByIndex: ingredients,
|
||||||
|
),
|
||||||
|
if (pantry.isNotEmpty)
|
||||||
|
XmpStructArrayCard(
|
||||||
|
title: 'Pantry',
|
||||||
|
structByIndex: pantry,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in a new issue