jpeginfo: parse TIFF UNDEFINED values
This commit is contained in:
parent
4cbf9239ee
commit
4d9236336c
@ -601,6 +601,20 @@ parse_exif_ascii(struct tiffer_entry *entry)
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jv
|
||||||
|
parse_exif_undefined(struct tiffer_entry *entry)
|
||||||
|
{
|
||||||
|
const char *alphabet = "0123456789abcdef";
|
||||||
|
char *buf = calloc(1, 2 * entry->remaining_count + 1);
|
||||||
|
for (uint32_t i = 0; i < entry->remaining_count; i++) {
|
||||||
|
buf[2 * i + 0] = alphabet[entry->p[i] >> 4];
|
||||||
|
buf[2 * i + 1] = alphabet[entry->p[i] & 0xF];
|
||||||
|
}
|
||||||
|
jv s = jv_string(buf);
|
||||||
|
free(buf);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
static jv
|
static jv
|
||||||
parse_exif_entry(jv o, struct tiffer *T, struct tiffer_entry *entry)
|
parse_exif_entry(jv o, struct tiffer *T, struct tiffer_entry *entry)
|
||||||
{
|
{
|
||||||
@ -613,11 +627,13 @@ parse_exif_entry(jv o, struct tiffer *T, struct tiffer_entry *entry)
|
|||||||
value = parse_exif_subifds(T, entry);
|
value = parse_exif_subifds(T, entry);
|
||||||
} else if (entry->type == ASCII) {
|
} else if (entry->type == ASCII) {
|
||||||
value = parse_exif_ascii(entry);
|
value = parse_exif_ascii(entry);
|
||||||
|
} else if (entry->type == UNDEFINED) {
|
||||||
|
value = parse_exif_undefined(entry);
|
||||||
} else if ((numeric = tiffer_real(T, entry, &real))) {
|
} else if ((numeric = tiffer_real(T, entry, &real))) {
|
||||||
value = jv_number(real);
|
value = jv_number(real);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(p): Decode UNDEFINED as a hex dump, and iterate over all values.
|
// TODO(p): Iterate over all numeric values.
|
||||||
for (const struct tiff_entry *p = tiff_entries; p->name; p++) {
|
for (const struct tiff_entry *p = tiff_entries; p->name; p++) {
|
||||||
if (p->tag != entry->tag)
|
if (p->tag != entry->tag)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user