|
From: Jef D. <jef...@ho...> - 2006-09-06 13:16:03
|
Many makernote tags are already documented by the 'exiftool' project
[1], but are not in the libexif library. I'm working on adding those
canon makernotes to the libexif library. I already figured out how to
add entries for already existing tags, but I'm having trouble adding new
tags.
In mnote-canon-tag.h, I define the new tag:
MNOTE_CANON_TAG_FOCAL_LENGTH = 0x2
And in mnote-canon-tag.c, I add the necessary human readable names to
both tables. And in mnote-canon-entry.c, I add a section to the function
mnote_canon_entry_get_value. I copied more or less the code from section
MNOTE_CANON_TAG_SETTINGS_1 as a starting point:
case MNOTE_CANON_TAG_FOCAL_LENGTH:
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
n = exif_get_short (data, entry->order) / 2;
if (t >= n) return NULL;
CC (entry->components, n, val, maxlen);
vs = exif_get_short (entry->data + 2 + t * 2, entry->order);
snprintf (buf, sizeof (buf), "0x%04x", vs);
strncpy (val, buf, maxlen - strlen (val));
break;
But when I run the exif commandline utility, an error is reported for
the new tag:
Focal type |Invalid number of components (4, expected 1).
What am I doing wrong here?
[1] http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html
|