aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-12-04 07:04:13 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-12-04 07:04:34 +0100
commit68009c1d3ea354e75e875246d82eaf72ed65d6d1 (patch)
treebfcb1deed1df884dcabab21aa875383648e34a5f /tools
parent5d659d208c593a0e910a1e62418f25bd8427a329 (diff)
downloadfiv-68009c1d3ea354e75e875246d82eaf72ed65d6d1.tar.gz
fiv-68009c1d3ea354e75e875246d82eaf72ed65d6d1.tar.xz
fiv-68009c1d3ea354e75e875246d82eaf72ed65d6d1.zip
jpeginfo: descend into Exif IFDs
Diffstat (limited to 'tools')
-rw-r--r--tools/jpeginfo.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/jpeginfo.c b/tools/jpeginfo.c
index 48e53b6..67e3703 100644
--- a/tools/jpeginfo.c
+++ b/tools/jpeginfo.c
@@ -522,9 +522,21 @@ static struct tiff_entry tiff_entries[] = {
{"ReferenceBlackWhite", 532, NULL},
{"ImageID", 32781, NULL}, // Adobe PageMaker 6.0 TIFF Technical Notes
{"Copyright", 33432, NULL},
+ {"Exif IFD Pointer", 34665, NULL}, // Exif 2.3
+ {"GPS Info IFD Pointer", 34853, NULL}, // Exif 2.3
+ {"Interoperability IFD Pointer", 40965, NULL}, // Exif 2.3
{}
};
+// TODO(p): Consider if these can't be inlined into the above table.
+static uint16_t tiff_subifd_tags[] = {
+ 330, // SubIFDs
+ 34665, // Exif IFD Pointer
+ 34853, // GPS Info IFD Pointer
+ 40965, // Interoperability IFD Pointer
+ 0
+};
+
// TODO(p): Insert tags and values from other documentation,
// so far only tags and non-bit-field values from TIFF 6.0 and PM6 are present.
@@ -635,11 +647,15 @@ parse_exif_entry(jv o, struct tiffer *T, struct tiffer_entry *entry)
if (info->tag == entry->tag)
break;
+ bool is_subifd = false;
+ for (const uint16_t *p = tiff_subifd_tags; *p; p++)
+ is_subifd |= *p == entry->tag;
+
jv v = jv_true();
double real = 0;
if (!entry->remaining_count) {
v = jv_null();
- } else if (entry->type == IFD) {
+ } else if (entry->type == IFD || is_subifd) {
v = parse_exif_subifds(T, entry);
} else if (entry->type == ASCII) {
v = parse_exif_extract_sole_array_element(parse_exif_ascii(entry));