#808 fixed detecting motion photos with more items in the XMP container
This commit is contained in:
parent
70a76c4f56
commit
83edd91f39
4 changed files with 11 additions and 13 deletions
|
@ -174,9 +174,7 @@ object MultiPage {
|
|||
} else if (xmpMeta.doesPropExist(XMP.GCONTAINER_DIRECTORY_PROP_NAME)) {
|
||||
// `Container` motion photo
|
||||
val count = xmpMeta.countPropArrayItems(XMP.GCONTAINER_DIRECTORY_PROP_NAME)
|
||||
if (count == 2) {
|
||||
// expect the video to be the second item
|
||||
val i = 2
|
||||
for (i in 1 until count + 1) {
|
||||
val mime = xmpMeta.getSafeStructField(listOf(XMP.GCONTAINER_DIRECTORY_PROP_NAME, i, XMP.GCONTAINER_ITEM_PROP_NAME, XMP.GCONTAINER_ITEM_MIME_PROP_NAME))?.value
|
||||
val length = xmpMeta.getSafeStructField(listOf(XMP.GCONTAINER_DIRECTORY_PROP_NAME, i, XMP.GCONTAINER_ITEM_PROP_NAME, XMP.GCONTAINER_ITEM_LENGTH_PROP_NAME))?.value
|
||||
if (MimeTypes.isVideo(mime) && length != null) {
|
||||
|
|
|
@ -188,17 +188,15 @@ object XMP {
|
|||
// Container motion photo
|
||||
if (doesPropExist(GCONTAINER_DIRECTORY_PROP_NAME)) {
|
||||
val count = countPropArrayItems(GCONTAINER_DIRECTORY_PROP_NAME)
|
||||
if (count == 2) {
|
||||
var hasImage = false
|
||||
var hasVideo = false
|
||||
for (i in 1 until count + 1) {
|
||||
val mime = getSafeStructField(listOf(GCONTAINER_DIRECTORY_PROP_NAME, i, GCONTAINER_ITEM_PROP_NAME, GCONTAINER_ITEM_MIME_PROP_NAME))?.value
|
||||
val length = getSafeStructField(listOf(GCONTAINER_DIRECTORY_PROP_NAME, i, GCONTAINER_ITEM_PROP_NAME, GCONTAINER_ITEM_LENGTH_PROP_NAME))?.value
|
||||
hasImage = hasImage || MimeTypes.isImage(mime) && length != null
|
||||
hasVideo = hasVideo || MimeTypes.isVideo(mime) && length != null
|
||||
}
|
||||
if (hasImage && hasVideo) return true
|
||||
var hasImage = false
|
||||
var hasVideo = false
|
||||
for (i in 1 until count + 1) {
|
||||
val mime = getSafeStructField(listOf(GCONTAINER_DIRECTORY_PROP_NAME, i, GCONTAINER_ITEM_PROP_NAME, GCONTAINER_ITEM_MIME_PROP_NAME))?.value
|
||||
val length = getSafeStructField(listOf(GCONTAINER_DIRECTORY_PROP_NAME, i, GCONTAINER_ITEM_PROP_NAME, GCONTAINER_ITEM_LENGTH_PROP_NAME))?.value
|
||||
hasImage = hasImage || MimeTypes.isImage(mime) && length != null
|
||||
hasVideo = hasVideo || MimeTypes.isVideo(mime) && length != null
|
||||
}
|
||||
if (hasImage && hasVideo) return true
|
||||
}
|
||||
|
||||
return false
|
||||
|
|
|
@ -37,6 +37,7 @@ class XmpNamespaces {
|
|||
static const gettyImagesGift = 'http://xmp.gettyimages.com/gift/1.0/';
|
||||
static const gimp210 = 'http://www.gimp.org/ns/2.10/';
|
||||
static const gimpXmp = 'http://www.gimp.org/xmp/';
|
||||
static const hdrgm = 'http://ns.adobe.com/hdr-gain-map/1.0/';
|
||||
static const illustrator = 'http://ns.adobe.com/illustrator/1.0/';
|
||||
static const iptc4xmpCore = 'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/';
|
||||
static const iptc4xmpExt = 'http://iptc.org/std/Iptc4xmpExt/2008-02-29/';
|
||||
|
|
|
@ -34,6 +34,7 @@ class XmpNamespaceView {
|
|||
XmpNamespaces.gettyImagesGift: 'Getty Images',
|
||||
XmpNamespaces.gimp210: 'GIMP 2.10',
|
||||
XmpNamespaces.gimpXmp: 'GIMP',
|
||||
XmpNamespaces.hdrgm: 'HDR Gain Map',
|
||||
XmpNamespaces.illustrator: 'Illustrator',
|
||||
XmpNamespaces.iptc4xmpCore: 'IPTC Core',
|
||||
XmpNamespaces.iptc4xmpExt: 'IPTC Extension',
|
||||
|
|
Loading…
Reference in a new issue