#1269 fixed cataloguing images with wrong MPF offsets
This commit is contained in:
parent
89c4fdd854
commit
58e3912f86
2 changed files with 9 additions and 4 deletions
|
@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- crash when playing video with DCL restriction enabled
|
- crash when playing video with DCL restriction enabled
|
||||||
|
- cataloguing images with wrong MPF offsets
|
||||||
- printing multi-page items containing some unprintable pages
|
- printing multi-page items containing some unprintable pages
|
||||||
- English (Shavian) locale tags for store listing
|
- English (Shavian) locale tags for store listing
|
||||||
|
|
||||||
|
|
|
@ -792,7 +792,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
|
||||||
|
|
||||||
private fun hasAppleHdrGainMap(uri: Uri, sizeBytes: Long?): Boolean {
|
private fun hasAppleHdrGainMap(uri: Uri, sizeBytes: Long?): Boolean {
|
||||||
val mpEntries = MultiPage.getJpegMpfEntries(context, uri, sizeBytes) ?: return false
|
val mpEntries = MultiPage.getJpegMpfEntries(context, uri, sizeBytes) ?: return false
|
||||||
mpEntries.filter { it.type == MpEntry.TYPE_UNDEFINED }.forEach { mpEntry ->
|
mpEntries.filter { it.type == MpEntry.TYPE_UNDEFINED }.forEachIndexed { mpIndex, mpEntry ->
|
||||||
var dataOffset = mpEntry.dataOffset
|
var dataOffset = mpEntry.dataOffset
|
||||||
if (dataOffset > 0) {
|
if (dataOffset > 0) {
|
||||||
val baseOffset = MultiPage.getJpegMpfBaseOffset(context, uri, sizeBytes)
|
val baseOffset = MultiPage.getJpegMpfBaseOffset(context, uri, sizeBytes)
|
||||||
|
@ -802,9 +802,13 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
|
||||||
}
|
}
|
||||||
StorageUtils.openInputStream(context, uri)?.let { input ->
|
StorageUtils.openInputStream(context, uri)?.let { input ->
|
||||||
input.skip(dataOffset)
|
input.skip(dataOffset)
|
||||||
val pageMetadata = Helper.safeRead(input, sizeBytes)
|
try {
|
||||||
if (pageMetadata.getDirectoriesOfType(XmpDirectory::class.java).any { it.xmpMeta.hasHdrGainMap() }) {
|
val pageMetadata = Helper.safeRead(input, sizeBytes)
|
||||||
return true
|
if (pageMetadata.getDirectoriesOfType(XmpDirectory::class.java).any { it.xmpMeta.hasHdrGainMap() }) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.w(LOG_TAG, "failed to read metadata by metadata-extractor for uri=$uri mpIndex=$mpIndex mpEntry=$mpEntry", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue