aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-05-28 11:04:18 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-05-28 11:06:44 +0200
commit3bdffd03dbe71ace5986a65e04997676e7d5ace4 (patch)
tree6aba56a499a82d0f3b0a8b8126520af53fa30119 /tools
parenta71069272599888742c70f832898094744ddb6dc (diff)
downloadfiv-3bdffd03dbe71ace5986a65e04997676e7d5ace4.tar.gz
fiv-3bdffd03dbe71ace5986a65e04997676e7d5ace4.tar.xz
fiv-3bdffd03dbe71ace5986a65e04997676e7d5ace4.zip
tools: decode TIFF XMP fields as UTF-8
This is more space-efficient than an array of ASCII codepoints. Perhaps more fields would make good use of specialized decoders, just this one made listings particularly annoying to deal with, and it may additionaly contain important metadata.
Diffstat (limited to 'tools')
-rw-r--r--tools/info.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/info.h b/tools/info.h
index 699e434..0d7a699 100644
--- a/tools/info.h
+++ b/tools/info.h
@@ -176,6 +176,7 @@ static jv
parse_exif_entry(jv o, const struct tiffer *T, struct tiffer_entry *entry,
const struct tiff_entry *info)
{
+ const struct tiff_entry *info_begin = info;
static struct tiff_entry empty[] = {{}};
if (!info)
info = empty;
@@ -200,6 +201,9 @@ parse_exif_entry(jv o, const struct tiffer *T, struct tiffer_entry *entry,
} else if (entry->type == TIFFER_UNDEFINED && !info->values) {
// Several Exif entries of UNDEFINED type contain single-byte numbers.
v = parse_exif_undefined(entry);
+ } else if (info_begin == tiff_entries && entry->tag == TIFF_XMP &&
+ (entry->type == TIFFER_UNDEFINED || entry->type == TIFFER_BYTE)) {
+ v = jv_string_sized((const char *) entry->p, entry->remaining_count);
} else if (tiffer_real(T, entry, &real)) {
v = jv_array();
do v = jv_array_append(v, parse_exif_value(info->values, real));