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.
This commit is contained in:
parent
a710692725
commit
3bdffd03db
@ -176,6 +176,7 @@ static jv
|
|||||||
parse_exif_entry(jv o, const struct tiffer *T, struct tiffer_entry *entry,
|
parse_exif_entry(jv o, const struct tiffer *T, struct tiffer_entry *entry,
|
||||||
const struct tiff_entry *info)
|
const struct tiff_entry *info)
|
||||||
{
|
{
|
||||||
|
const struct tiff_entry *info_begin = info;
|
||||||
static struct tiff_entry empty[] = {{}};
|
static struct tiff_entry empty[] = {{}};
|
||||||
if (!info)
|
if (!info)
|
||||||
info = empty;
|
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) {
|
} else if (entry->type == TIFFER_UNDEFINED && !info->values) {
|
||||||
// Several Exif entries of UNDEFINED type contain single-byte numbers.
|
// Several Exif entries of UNDEFINED type contain single-byte numbers.
|
||||||
v = parse_exif_undefined(entry);
|
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)) {
|
} else if (tiffer_real(T, entry, &real)) {
|
||||||
v = jv_array();
|
v = jv_array();
|
||||||
do v = jv_array_append(v, parse_exif_value(info->values, real));
|
do v = jv_array_append(v, parse_exif_value(info->values, real));
|
||||||
|
Loading…
Reference in New Issue
Block a user