summaryrefslogtreecommitdiff
path: root/src/libexif/olympus
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexif/olympus')
-rw-r--r--src/libexif/olympus/exif-mnote-data-olympus.c403
-rw-r--r--src/libexif/olympus/exif-mnote-data-olympus.h45
-rw-r--r--src/libexif/olympus/mnote-olympus-entry.c540
-rw-r--r--src/libexif/olympus/mnote-olympus-entry.h43
-rw-r--r--src/libexif/olympus/mnote-olympus-tag.c155
-rw-r--r--src/libexif/olympus/mnote-olympus-tag.h130
6 files changed, 1316 insertions, 0 deletions
diff --git a/src/libexif/olympus/exif-mnote-data-olympus.c b/src/libexif/olympus/exif-mnote-data-olympus.c
new file mode 100644
index 0000000..02794c5
--- /dev/null
+++ b/src/libexif/olympus/exif-mnote-data-olympus.c
@@ -0,0 +1,403 @@
+/* exif-mnote-data-olympus.c
+ *
+ * Copyright © 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "exif-mnote-data-olympus.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <libexif/exif-utils.h>
+#include <libexif/exif-data.h>
+
+#define DEBUG
+
+static void
+exif_mnote_data_olympus_clear (ExifMnoteDataOlympus *n)
+{
+ ExifMnoteData *d = (ExifMnoteData *) n;
+ unsigned int i;
+
+ if (!n) return;
+
+ if (n->entries) {
+ for (i = 0; i < n->count; i++)
+ if (n->entries[i].data) {
+ exif_mem_free (d->mem, n->entries[i].data);
+ n->entries[i].data = NULL;
+ }
+ exif_mem_free (d->mem, n->entries);
+ n->entries = NULL;
+ n->count = 0;
+ }
+}
+
+static void
+exif_mnote_data_olympus_free (ExifMnoteData *n)
+{
+ if (!n) return;
+
+ exif_mnote_data_olympus_clear ((ExifMnoteDataOlympus *) n);
+}
+
+static char *
+exif_mnote_data_olympus_get_value (ExifMnoteData *d, unsigned int i, char *val, unsigned int maxlen)
+{
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
+
+ if (!d || !val) return NULL;
+ if (i > n->count -1) return NULL;
+ exif_log (d->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
+ "Querying value for tag '%s'...",
+ mnote_olympus_tag_get_name (n->entries[i].tag));
+ return mnote_olympus_entry_get_value (&n->entries[i], val, maxlen);
+}
+
+static void
+exif_mnote_data_olympus_save (ExifMnoteData *ne,
+ unsigned char **buf, unsigned int *buf_size)
+{
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) ne;
+ unsigned int i, o, s, doff, base = 0, o2 = 6;
+ int datao = 0;
+
+ if (!n || !buf || !buf_size) return;
+
+ /*
+ * Allocate enough memory for all entries and the number of entries.
+ */
+ *buf_size = 6 + 2 + 2 + n->count * 12;
+ switch (n->version) {
+ case 0: /* Olympus */
+ *buf = exif_mem_alloc (ne->mem, *buf_size);
+ if (!*buf) return;
+
+ /* Write the header and the number of entries. */
+ strcpy (*buf, "OLYMP");
+ o2 += 2;
+ datao = n->offset;
+ break;
+ case 1: /* Nikon v1 */
+ base = MNOTE_NIKON1_TAG_BASE;
+ *buf_size -= 8;
+ /* Fall through */
+ case 2: /* Nikon v2 */
+ *buf_size += 8;
+ *buf = exif_mem_alloc (ne->mem, *buf_size);
+ if (!*buf) return;
+
+ /* Write the header and the number of entries. */
+ strcpy (*buf, "Nikon");
+ (*buf)[6] = n->version;
+ o2 += 2; *buf_size += 2;
+ if (n->version == 2) {
+ exif_set_short (*buf + 10, n->order, (ExifShort) (
+ (n->order == EXIF_BYTE_ORDER_INTEL) ?
+ ('I' << 8) | 'I' :
+ ('M' << 8) | 'M'));
+ exif_set_short (*buf + 12, n->order, (ExifShort) 0x2A);
+ exif_set_long (*buf + 14, n->order, (ExifShort) 8);
+ o2 += 2 + 8;
+ }
+ datao = -10;
+ break;
+ }
+
+ exif_set_short (*buf + o2, n->order, (ExifShort) n->count);
+ o2 += 2;
+
+ /* Save each entry */
+ for (i = 0; i < n->count; i++) {
+ o = o2 + i * 12;
+ exif_set_short (*buf + o + 0, n->order,
+ (ExifShort) (n->entries[i].tag - base));
+ exif_set_short (*buf + o + 2, n->order,
+ (ExifShort) n->entries[i].format);
+ exif_set_long (*buf + o + 4, n->order,
+ n->entries[i].components);
+ o += 8;
+ s = exif_format_get_size (n->entries[i].format) *
+ n->entries[i].components;
+ if (s > 4) {
+ doff = *buf_size;
+ *buf_size += s;
+ *buf = exif_mem_realloc (ne->mem, *buf,
+ sizeof (char) * *buf_size);
+ if (!*buf) return;
+ exif_set_long (*buf + o, n->order, datao + doff);
+ } else
+ doff = o;
+
+ /* Write the data. */
+ if (n->entries[i].data) {
+ memcpy (*buf + doff, n->entries[i].data, s);
+ } else {
+ /* Most certainly damaged input file */
+ memset (*buf + doff, 0, s);
+ }
+ }
+}
+
+static void
+exif_mnote_data_olympus_load (ExifMnoteData *en,
+ const unsigned char *buf, unsigned int buf_size)
+{
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) en;
+ ExifShort c;
+ unsigned int i, s, o, o2 = 0, datao = 6, base = 0;
+
+ if (!n || !buf) return;
+
+ /* Start of interesting data */
+ o2 = 6 + n->offset;
+
+ /*
+ * Olympus headers start with "OLYMP" and need to have at least
+ * a size of 22 bytes (6 for 'OLYMP', 2 other bytes, 2 for the
+ * number of entries, and 12 for one entry.
+ *
+ * Nikon headers start with "Nikon" (6 bytes including '\0'),
+ * version number (1 or 2).
+ *
+ * Version 1 continues with 0, 1, 0, number_of_tags,
+ * or just with number_of_tags (models D1H, D1X...).
+ *
+ * Version 2 continues with an unknown byte (0 or 10),
+ * two unknown bytes (0), "MM" or "II", another byte 0 and
+ * lastly 0x2A.
+ */
+ if (buf_size - n->offset < 22) return;
+ if (!memcmp (buf + o2, "OLYMP", 5)) {
+ exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
+ "Parsing Olympus maker note...");
+
+ /* The number of entries is at position 8. */
+ n->version = 0;
+ o2 += 8;
+
+ } else if (!memcmp (buf + o2, "Nikon", 6)) {
+ o2 += 6;
+ exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
+ "Parsing Nikon maker note (0x%02x, %02x, %02x, "
+ "%02x, %02x, %02x, %02x, %02x)...",
+ buf[o2 + 0], buf[o2 + 1], buf[o2 + 2], buf[o2 + 3],
+ buf[o2 + 4], buf[o2 + 5], buf[o2 + 6], buf[o2 + 7]);
+
+ /* The first byte is the version. */
+ if (o2 >= buf_size) return;
+ n->version = buf[o2];
+ o2 += 1;
+
+ /* Skip an unknown byte (00 or 0A). */
+ o2 += 1;
+
+ switch (n->version) {
+ case 1:
+
+ base = MNOTE_NIKON1_TAG_BASE;
+ break;
+
+ case 2:
+
+ /* Skip 2 unknown bytes (00 00). */
+ o2 += 2;
+
+ /*
+ * Byte order. From here the data offset
+ * gets calculated.
+ */
+ datao = o2;
+ if (o2 >= buf_size) return;
+ if (!strncmp (&buf[o2], "II", 2))
+ n->order = EXIF_BYTE_ORDER_INTEL;
+ else if (!strncmp (&buf[o2], "MM", 2))
+ n->order = EXIF_BYTE_ORDER_MOTOROLA;
+ else {
+ exif_log (en->log, EXIF_LOG_CODE_DEBUG,
+ "ExifMnoteDatalympus", "Unknown "
+ "byte order '%c%c'", buf[o2],
+ buf[o2 + 1]);
+ return;
+ }
+ o2 += 2;
+
+ /* Skip 2 unknown bytes (00 2A). */
+ o2 += 2;
+
+ /* Go to where the number of entries is. */
+ if (o2 >= buf_size) return;
+ o2 = datao + exif_get_long (buf + o2, n->order);
+ break;
+
+ default:
+ exif_log (en->log, EXIF_LOG_CODE_DEBUG,
+ "ExifMnoteDataOlympus", "Unknown version "
+ "number %i.", n->version);
+ return;
+ }
+ } else if (!memcmp (buf + o2, "\0\x1b", 2)) {
+ n->version = 2;
+ } else {
+ return;
+ }
+
+ /* Number of entries */
+ if (o2 >= buf_size) return;
+ c = exif_get_short (buf + o2, n->order);
+ o2 += 2;
+
+ /* Read the number of entries and remove old ones. */
+ exif_mnote_data_olympus_clear (n);
+
+ n->entries = exif_mem_alloc (en->mem, sizeof (MnoteOlympusEntry) * c);
+ if (!n->entries) return;
+
+ /* Parse the entries */
+ for (i = 0; i < c; i++) {
+ o = o2 + 12 * i;
+ if (o + 12 > buf_size) return;
+
+ n->count = i + 1;
+ n->entries[i].tag = exif_get_short (buf + o, n->order) + base;
+ n->entries[i].format = exif_get_short (buf + o + 2, n->order);
+ n->entries[i].components = exif_get_long (buf + o + 4, n->order);
+ n->entries[i].order = n->order;
+
+ exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteOlympus",
+ "Loading entry 0x%x ('%s')...", n->entries[i].tag,
+ mnote_olympus_tag_get_name (n->entries[i].tag));
+
+ /*
+ * Size? If bigger than 4 bytes, the actual data is not
+ * in the entry but somewhere else (offset).
+ */
+ s = exif_format_get_size (n->entries[i].format) *
+ n->entries[i].components;
+ if (!s) continue;
+ o += 8;
+ if (s > 4) o = exif_get_long (buf + o, n->order) + datao;
+ if (o + s > buf_size) continue;
+
+ /* Sanity check */
+ n->entries[i].data = exif_mem_alloc (en->mem, s);
+ if (!n->entries[i].data) continue;
+ n->entries[i].size = s;
+ memcpy (n->entries[i].data, buf + o, s);
+ }
+}
+
+static unsigned int
+exif_mnote_data_olympus_count (ExifMnoteData *n)
+{
+ return n ? ((ExifMnoteDataOlympus *) n)->count : 0;
+}
+
+static unsigned int
+exif_mnote_data_olympus_get_id (ExifMnoteData *d, unsigned int n)
+{
+ ExifMnoteDataOlympus *note = (ExifMnoteDataOlympus *) d;
+
+ if (!note) return 0;
+ if (note->count <= n) return 0;
+ return note->entries[n].tag;
+}
+
+static const char *
+exif_mnote_data_olympus_get_name (ExifMnoteData *d, unsigned int i)
+{
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
+
+ if (!n) return NULL;
+ if (i >= n->count) return NULL;
+ return mnote_olympus_tag_get_name (n->entries[i].tag);
+}
+
+static const char *
+exif_mnote_data_olympus_get_title (ExifMnoteData *d, unsigned int i)
+{
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
+
+ if (!n) return NULL;
+ if (i >= n->count) return NULL;
+ return mnote_olympus_tag_get_title (n->entries[i].tag);
+}
+
+static const char *
+exif_mnote_data_olympus_get_description (ExifMnoteData *d, unsigned int i)
+{
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
+
+ if (!n) return NULL;
+ if (i >= n->count) return NULL;
+ return mnote_olympus_tag_get_title (n->entries[i].tag);
+}
+
+static void
+exif_mnote_data_olympus_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
+{
+ ExifByteOrder o_orig;
+ ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
+ unsigned int i;
+
+ if (!n) return;
+
+ o_orig = n->order;
+ n->order = o;
+ for (i = 0; i < n->count; i++) {
+ n->entries[i].order = o;
+ exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
+ n->entries[i].components, o_orig, o);
+ }
+}
+
+static void
+exif_mnote_data_olympus_set_offset (ExifMnoteData *n, unsigned int o)
+{
+ if (n) ((ExifMnoteDataOlympus *) n)->offset = o;
+}
+
+ExifMnoteData *
+exif_mnote_data_olympus_new (ExifMem *mem)
+{
+ ExifMnoteData *d;
+
+ if (!mem) return NULL;
+
+ d = exif_mem_alloc (mem, sizeof (ExifMnoteDataOlympus));
+ if (!d) return NULL;
+
+ exif_mnote_data_construct (d, mem);
+
+ /* Set up function pointers */
+ d->methods.free = exif_mnote_data_olympus_free;
+ d->methods.set_byte_order = exif_mnote_data_olympus_set_byte_order;
+ d->methods.set_offset = exif_mnote_data_olympus_set_offset;
+ d->methods.load = exif_mnote_data_olympus_load;
+ d->methods.save = exif_mnote_data_olympus_save;
+ d->methods.count = exif_mnote_data_olympus_count;
+ d->methods.get_id = exif_mnote_data_olympus_get_id;
+ d->methods.get_name = exif_mnote_data_olympus_get_name;
+ d->methods.get_title = exif_mnote_data_olympus_get_title;
+ d->methods.get_description = exif_mnote_data_olympus_get_description;
+ d->methods.get_value = exif_mnote_data_olympus_get_value;
+
+ return d;
+}
diff --git a/src/libexif/olympus/exif-mnote-data-olympus.h b/src/libexif/olympus/exif-mnote-data-olympus.h
new file mode 100644
index 0000000..b9b4209
--- /dev/null
+++ b/src/libexif/olympus/exif-mnote-data-olympus.h
@@ -0,0 +1,45 @@
+/* mnote-olympus-data.h
+ *
+ * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __MNOTE_OLYMPUS_CONTENT_H__
+#define __MNOTE_OLYMPUS_CONTENT_H__
+
+#include <libexif/exif-mnote-data-priv.h>
+#include <libexif/olympus/mnote-olympus-entry.h>
+#include <libexif/exif-byte-order.h>
+#include <libexif/exif-mem.h>
+
+typedef struct _ExifMnoteDataOlympus ExifMnoteDataOlympus;
+
+struct _ExifMnoteDataOlympus {
+ ExifMnoteData parent;
+
+ MnoteOlympusEntry *entries;
+ unsigned int count;
+
+ ExifByteOrder order;
+ unsigned int offset;
+ /* 0: Olympus; 1: Nikon v1; 2: Nikon v2 */
+ int version;
+};
+
+ExifMnoteData *exif_mnote_data_olympus_new (ExifMem *);
+
+#endif /* __MNOTE_OLYMPUS_CONTENT_H__ */
diff --git a/src/libexif/olympus/mnote-olympus-entry.c b/src/libexif/olympus/mnote-olympus-entry.c
new file mode 100644
index 0000000..1eff6fe
--- /dev/null
+++ b/src/libexif/olympus/mnote-olympus-entry.c
@@ -0,0 +1,540 @@
+/* mnote-olympus-entry.c
+ *
+ * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "mnote-olympus-entry.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libexif/exif-format.h>
+#include <libexif/exif-utils.h>
+#include <libexif/exif-entry.h>
+#include <libexif/i18n.h>
+
+#define CF(format,target,v,maxlen) \
+{ \
+ if (format != target) { \
+ snprintf (v, maxlen, \
+ _("Invalid format '%s', " \
+ "expected '%s'."), \
+ exif_format_get_name (format), \
+ exif_format_get_name (target)); \
+ break; \
+ } \
+}
+
+#define CC(number,target,v,maxlen) \
+{ \
+ if (number != target) { \
+ snprintf (v, maxlen, \
+ _("Invalid number of components (%i, " \
+ "expected %i)."), (int) number, (int) target); \
+ break; \
+ } \
+}
+
+#define CC2(number,t1,t2,v,maxlen) \
+{ \
+ if ((number != t1) && (number != t2)) { \
+ snprintf (v, maxlen, \
+ _("Invalid number of components (%i, " \
+ "expected %i or %i)."), (int) number, \
+ (int) t1, (int) t2); \
+ break; \
+ } \
+}
+
+static struct {
+ ExifTag tag;
+ ExifFormat fmt;
+ struct {
+ int index;
+ const char *string;
+ } elem[10];
+} items[] = {
+ { MNOTE_NIKON_TAG_LENSTYPE, EXIF_FORMAT_BYTE,
+ { {0, N_("AF non D Lens")},
+ {1, N_("Manual")},
+ {2, N_("AF-D or AF-S Lens")},
+ {6, N_("AF-D G Lens")},
+ {10, N_("AF-D VR Lens")},
+ {0, NULL}}},
+ { MNOTE_NIKON_TAG_FLASHUSED, EXIF_FORMAT_BYTE,
+ { {0, N_("Flash did not fire")},
+ {4, N_("Flash unit unknown")},
+ {7, N_("Flash is external")},
+ {9, N_("Flash is on Camera")},
+ {0, NULL}}},
+ { MNOTE_NIKON1_TAG_QUALITY, EXIF_FORMAT_SHORT,
+ { {1, N_("VGA Basic")},
+ {2, N_("VGA Normal")},
+ {3, N_("VGA Fine")},
+ {4, N_("SXGA Basic")},
+ {5, N_("SXGA Normal")},
+ {6, N_("SXGA Fine")},
+ {10, N_("2 MPixel Basic")},
+ {11, N_("2 MPixel Normal")},
+ {12, N_("2 MPixel Fine")},
+ {0, NULL}}},
+ { MNOTE_NIKON1_TAG_COLORMODE, EXIF_FORMAT_SHORT,
+ { {1, N_("Color")},
+ {2, N_("Monochrome")},
+ {0, NULL}}},
+ { MNOTE_NIKON1_TAG_IMAGEADJUSTMENT, EXIF_FORMAT_SHORT,
+ { {0, N_("Normal")},
+ {1, N_("Bright+")},
+ {2, N_("Bright-")},
+ {3, N_("Contrast+")},
+ {4, N_("Contrast-")},
+ {0, NULL}}},
+ { MNOTE_NIKON1_TAG_CCDSENSITIVITY, EXIF_FORMAT_SHORT,
+ { {0, N_("ISO80")},
+ {2, N_("ISO160")},
+ {4, N_("ISO320")},
+ {5, N_("ISO100")},
+ {0, NULL}}},
+ { MNOTE_NIKON1_TAG_WHITEBALANCE, EXIF_FORMAT_SHORT,
+ { {0, N_("Auto")},
+ {1, N_("Preset")},
+ {2, N_("Daylight")},
+ {3, N_("Incandescense")},
+ {4, N_("Fluorescence")},
+ {5, N_("Cloudy")},
+ {6, N_("SpeedLight")},
+ {0, NULL}}},
+ { MNOTE_NIKON1_TAG_CONVERTER, EXIF_FORMAT_SHORT,
+ { {0, N_("No Fisheye")},
+ {1, N_("Fisheye On")},
+ {0, NULL}}},
+ { MNOTE_OLYMPUS_TAG_QUALITY, EXIF_FORMAT_SHORT,
+ { {1, N_("SQ")},
+ {2, N_("HQ")},
+ {3, N_("SHQ")},
+ {0, NULL}}},
+ { MNOTE_OLYMPUS_TAG_MACRO, EXIF_FORMAT_SHORT,
+ { {0, N_("No")},
+ {1, N_("Yes")},
+ {0, NULL}}},
+ { MNOTE_OLYMPUS_TAG_DIGIZOOM, EXIF_FORMAT_SHORT,
+ { {0, N_("1x")},
+ {2, N_("2x")},
+ {0, NULL}}},
+ { MNOTE_OLYMPUS_TAG_FLASHMODE, EXIF_FORMAT_SHORT,
+ { {0, N_("Auto")},
+ {1, N_("Red-eye reduction")},
+ {2, N_("Fill")},
+ {3, N_("Off")},
+ {0, NULL}}},
+ { MNOTE_OLYMPUS_TAG_SHARPNESS, EXIF_FORMAT_SHORT,
+ { {0, N_("Normal")},
+ {1, N_("Hard")},
+ {2, N_("Soft")},
+ {0, NULL}}},
+ { MNOTE_OLYMPUS_TAG_CONTRAST, EXIF_FORMAT_SHORT,
+ { {0, N_("Hard")},
+ {1, N_("Normal")},
+ {2, N_("Soft")},
+ {0, NULL}}},
+ { MNOTE_OLYMPUS_TAG_MANFOCUS, EXIF_FORMAT_SHORT,
+ { {0, N_("No")},
+ {1, N_("Yes")},
+ {0, NULL}}},
+ { 0, }
+};
+
+char *
+mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int maxlen)
+{
+ char buf[30];
+ ExifLong vl;
+ ExifShort vs = 0;
+ ExifRational vr;
+ int i, j;
+ double r, b;
+
+ if (!entry)
+ return (NULL);
+
+ memset (v, 0, maxlen);
+ maxlen--;
+
+ if ((!entry->data) && (entry->components > 0)) return (v);
+
+ switch (entry->tag) {
+
+ /* Nikon */
+ case MNOTE_NIKON_TAG_FIRMWARE:
+ CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
+ CC (entry->components, 4, v, maxlen);
+ vl = exif_get_long (entry->data, entry->order);
+ if ((vl & 0xF0F0F0F0) == 0x30303030) {
+ memcpy (v, entry->data, MIN (maxlen, 4));
+ } else {
+ snprintf (v, maxlen, "%04lx", (long unsigned int) vl);
+ }
+ break;
+ case MNOTE_NIKON_TAG_ISO:
+ CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
+ CC (entry->components, 2, v, maxlen);
+ //vs = exif_get_short (entry->data, entry->order);
+ vs = exif_get_short (entry->data + 2, entry->order);
+ snprintf (v, maxlen, "ISO %hd", vs);
+ break;
+ case MNOTE_NIKON_TAG_ISO2:
+ CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
+ CC (entry->components, 2, v, maxlen);
+ //vs = exif_get_short (entry->data, entry->order);
+ vs = exif_get_short (entry->data + 2, entry->order);
+ snprintf (v, maxlen, "ISO2 %hd", vs);
+ break;
+ case MNOTE_NIKON_TAG_QUALITY:
+ CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
+ //CC (entry->components, 8, v, maxlen);
+ //vl = exif_get_long (entry->data , entry->order);
+ //printf("-> 0x%04x\n",entry->data);
+ //printf("-> 0x%s<\n",entry->data - 0);
+ memcpy(v, entry->data ,entry->components);
+ //snprintf (v, maxlen, "%s<", ( entry->data - 9 );
+ break;
+ case MNOTE_NIKON_TAG_COLORMODE:
+ case MNOTE_NIKON_TAG_COLORMODE1:
+ case MNOTE_NIKON_TAG_WHITEBALANCE:
+ case MNOTE_NIKON_TAG_SHARPENING:
+ case MNOTE_NIKON_TAG_FOCUSMODE:
+ case MNOTE_NIKON_TAG_FLASHSETTING:
+ case MNOTE_NIKON_TAG_ISOSELECTION:
+ case MNOTE_NIKON_TAG_FLASHMODE:
+ case MNOTE_NIKON_TAG_IMAGEADJUSTMENT:
+ case MNOTE_NIKON_TAG_ADAPTER:
+ CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
+ memcpy(v, entry->data, MIN (maxlen, entry->components));
+ break;
+ case MNOTE_NIKON_TAG_TOTALPICTURES:
+ CF (entry->format, EXIF_FORMAT_LONG, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ vl = exif_get_long (entry->data, entry->order);
+ snprintf (v, maxlen, "%lu", (long unsigned int) vl );
+ break;
+ case MNOTE_NIKON_TAG_WHITEBALANCEFINE:
+ CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ vs = exif_get_short (entry->data, entry->order);
+ snprintf (v, maxlen, "%hd", vs);
+ break;
+ case MNOTE_NIKON_TAG_WHITEBALANCERB:
+ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
+ CC (entry->components, 4, v, maxlen);
+ vr = exif_get_rational (entry->data, entry->order);
+ r = (double)vr.numerator / vr.denominator;
+ vr = exif_get_rational (entry->data+8, entry->order);
+ b = (double)vr.numerator / vr.denominator;
+ //printf("numerator %li, denominator %li\n", vr.numerator, vr.denominator);
+ snprintf (v, maxlen, "Red Correction %f, Blue Correction %f", r,b);
+ break;
+ case MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE:
+ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ vr = exif_get_rational (entry->data, entry->order);
+ if (vr.numerator) {
+ r = (double)vr.numerator / vr.denominator;
+ snprintf (v, maxlen, "%2.2f meters", r);
+ } else {
+ strncpy (v, _("No manual focus selection"), maxlen);
+ }
+ break;
+ case MNOTE_NIKON_TAG_DIGITALZOOM:
+ case MNOTE_NIKON1_TAG_DIGITALZOOM:
+ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ vr = exif_get_rational (entry->data, entry->order);
+ r = (double)vr.numerator / vr.denominator;
+ snprintf (v, maxlen, "%2.2f", r);
+ break;
+ case MNOTE_NIKON_TAG_AFFOCUSPOSITION:
+ CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
+ CC (entry->components, 4, v, maxlen);
+ switch ( *( entry->data+1) ) {
+ case 0: strncpy (v, "AF Position: Center", maxlen); break;
+ case 1: strncpy (v, "AF Position: Top", maxlen); break;
+ case 2: strncpy (v, "AF Position: Bottom", maxlen); break;
+ case 3: strncpy (v, "AF Position: Left", maxlen); break;
+ case 4: strncpy (v, "AF Position: Right", maxlen); break;
+ default: strncpy (v, "Unknown AF Position", maxlen);
+ }
+ break;
+ case MNOTE_OLYMPUS_TAG_DIGIZOOM:
+ if (entry->format == EXIF_FORMAT_RATIONAL) {
+ CC (entry->components, 1, v, maxlen);
+ vr = exif_get_rational (entry->data, entry->order);
+ r = (double)vr.numerator / vr.denominator;
+ if (!vr.numerator) {
+ strncpy (v, _("None"), maxlen);
+ } else {
+ snprintf (v, maxlen, "%2.2f", r);
+ }
+ break;
+ }
+ /* fall through to handle SHORT version of this tag */
+ case MNOTE_NIKON_TAG_LENSTYPE:
+ case MNOTE_NIKON_TAG_FLASHUSED:
+ case MNOTE_NIKON1_TAG_QUALITY:
+ case MNOTE_NIKON1_TAG_COLORMODE:
+ case MNOTE_NIKON1_TAG_IMAGEADJUSTMENT:
+ case MNOTE_NIKON1_TAG_CCDSENSITIVITY:
+ case MNOTE_NIKON1_TAG_WHITEBALANCE:
+ case MNOTE_NIKON1_TAG_CONVERTER:
+ case MNOTE_OLYMPUS_TAG_QUALITY:
+ case MNOTE_OLYMPUS_TAG_MACRO:
+ case MNOTE_OLYMPUS_TAG_FLASHMODE:
+ case MNOTE_OLYMPUS_TAG_SHARPNESS:
+ case MNOTE_OLYMPUS_TAG_CONTRAST:
+ case MNOTE_OLYMPUS_TAG_MANFOCUS:
+ /* search the tag */
+ for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++);
+ if (!items[i].tag) {
+ strncpy (v, "Internal error", maxlen);
+ break;
+ }
+ CF (entry->format, items[i].fmt, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ switch (entry->format) {
+ case EXIF_FORMAT_BYTE:
+ case EXIF_FORMAT_UNDEFINED:
+ vs = entry->data[0];
+ break;
+ case EXIF_FORMAT_SHORT:
+ vs = exif_get_short(entry->data, entry->order);
+ break;
+ default:
+ vs = 0;
+ break;
+ }
+ /* find the value */
+ for (j = 0; items[i].elem[j].string &&
+ (items[i].elem[j].index < vs); j++);
+ if (items[i].elem[j].index != vs) {
+ snprintf (v, maxlen, "Unknown value %hi", vs);
+ break;
+ }
+ strncpy (v, items[i].elem[j].string, maxlen);
+ break;
+
+ case MNOTE_NIKON_TAG_LENS:
+ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
+ CC (entry->components, 4, v, maxlen);
+ {
+ double c,d;
+ unsigned long a,b;
+ vr = exif_get_rational (entry->data, entry->order);
+ a = vr.numerator / vr.denominator;
+ vr = exif_get_rational (entry->data+8, entry->order);
+ b = vr.numerator / vr.denominator;
+ vr = exif_get_rational (entry->data+16, entry->order);
+ c = (double)vr.numerator / vr.denominator;
+ vr = exif_get_rational (entry->data+24, entry->order);
+ d = (double)vr.numerator / vr.denominator;
+ //printf("numerator %li, denominator %li\n", vr.numerator, vr.denominator);
+ snprintf (v, maxlen, "%ld-%ldmm 1:%3.1f - %3.1f",a,b,c,d);
+ }
+ break;
+ case MNOTE_NIKON1_TAG_FOCUS:
+ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ vr = exif_get_rational (entry->data, entry->order);
+ if (!vr.denominator) {
+ strncpy (v, _("Infinite"), maxlen);
+ } else {
+ r = (double)vr.numerator / vr.denominator;
+ snprintf (v, maxlen, "%2.2f", r);
+ }
+ break;
+
+ /* Olympus */
+ case MNOTE_OLYMPUS_TAG_MODE:
+ CF (entry->format, EXIF_FORMAT_LONG, v, maxlen);
+ CC (entry->components, 3, v, maxlen);
+ vl = exif_get_long (entry->data, entry->order);
+ switch (vl) {
+ case 0:
+ strncpy (v, _("normal"), maxlen);
+ break;
+ case 1:
+ strncpy (v, _("unknown"), maxlen);
+ break;
+ case 2:
+ strncpy (v, _("fast"), maxlen);
+ break;
+ case 3:
+ strncpy (v, _("panorama"), maxlen);
+ break;
+ default:
+ snprintf (v, maxlen, _("%li"), (long int) vl);
+ }
+ vl = exif_get_long (entry->data + 4, entry->order);
+ snprintf (buf, sizeof (buf), "/%li/", (long int) vl);
+ strncat (v, buf, maxlen - strlen (v));
+ vl = exif_get_long (entry->data + 4, entry->order);
+ switch (vl) {
+ case 1:
+ strncat (v, _("left to right"), maxlen - strlen (v));
+ break;
+ case 2:
+ strncat (v, _("right to left"), maxlen - strlen (v));
+ break;
+ case 3:
+ strncat (v, _("bottom to top"), maxlen - strlen (v));
+ break;
+ case 4:
+ strncat (v, _("top to bottom"), maxlen - strlen (v));
+ break;
+ default:
+ snprintf (buf, sizeof (buf), _("%li"),
+ (long int) vl);
+ strncat (v, buf, maxlen - strlen (v));
+ }
+ break;
+ case MNOTE_OLYMPUS_TAG_UNKNOWN_1:
+ CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ strncpy (v, _("Unknown tag."), maxlen);
+ break;
+ case MNOTE_OLYMPUS_TAG_UNKNOWN_2:
+ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ break;
+ case MNOTE_OLYMPUS_TAG_UNKNOWN_3:
+ CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ break;
+ case MNOTE_OLYMPUS_TAG_VERSION:
+ CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
+ CC2 (entry->components, 5, 8, v, maxlen);
+ strncpy (v, entry->data, MIN (maxlen, entry->size));
+ break;
+ case MNOTE_OLYMPUS_TAG_INFO:
+ CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
+ CC2 (entry->components, 52, 53, v, maxlen);
+ strncpy (v, entry->data, MIN (maxlen, entry->size));
+ break;
+ case MNOTE_OLYMPUS_TAG_ID:
+ CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
+ CC (entry->components, 32, v, maxlen);
+ strncpy (v, entry->data, MIN (maxlen, entry->size));
+ break;
+ case MNOTE_OLYMPUS_TAG_UNKNOWN_4:
+ CF (entry->format, EXIF_FORMAT_LONG, v, maxlen);
+ CC (entry->components, 30, v, maxlen);
+ break;
+ case MNOTE_OLYMPUS_TAG_FOCUSDIST:
+ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
+ CC (entry->components, 1, v, maxlen);
+ vr = exif_get_rational (entry->data, entry->order);
+ if (vr.numerator == 0) {
+ strncpy (v, _("Unknown"), maxlen);
+ }
+ else {
+ unsigned long tmp = vr.numerator / vr.denominator;
+ /* printf("numerator %li, denominator %li\n", vr.numerator, vr.denominator); */
+ snprintf (v, maxlen, "%li mm", tmp);
+ }
+ break;
+ case MNOTE_OLYMPUS_TAG_WBALANCE:
+ CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
+ CC (entry->components, 2, v, maxlen);
+ vs = exif_get_short (entry->data, entry->order);
+ switch (vs) {
+ case 1:
+ strncpy (v, _("Automatic"), maxlen);
+ break;
+ case 2:
+ {
+ ExifShort v2 = exif_get_short (entry->data + 2, entry->order);
+ unsigned long colorTemp = 0;
+ switch (v2) {
+ case 2:
+ colorTemp = 3000;
+ break;
+ case 3:
+ colorTemp = 3700;
+ break;
+ case 4:
+ colorTemp = 4000;
+ break;
+ case 5:
+ colorTemp = 4500;
+ break;
+ case 6:
+ colorTemp = 5500;
+ break;
+ case 7:
+ colorTemp = 6500;
+ break;
+ case 9:
+ colorTemp = 7500;
+ break;
+ }
+ if (colorTemp) {
+ snprintf (v, maxlen, "Manual: %liK", colorTemp);
+ }
+ else {
+ strncpy (v, _("Manual: Unknown"), maxlen);
+ }
+
+ }
+ break;
+ case 3:
+ strncpy (v, _("One-touch"), maxlen);
+ break;
+ default:
+ strncpy (v, _("Unknown"), maxlen);
+ break;
+ }
+ break;
+ default:
+ switch (entry->format) {
+ case EXIF_FORMAT_ASCII:
+ strncpy (v, entry->data,
+ MIN (maxlen, entry->components));
+ break;
+ case EXIF_FORMAT_SHORT:
+ vs = exif_get_short (entry->data, entry->order);
+ snprintf (v, maxlen, "%hi", vs);
+ break;
+ case EXIF_FORMAT_LONG:
+ vl = exif_get_long (entry->data, entry->order);
+ snprintf (v, maxlen, "%li", (long int) vl);
+ break;
+ case EXIF_FORMAT_UNDEFINED:
+ default:
+ snprintf (v, maxlen, _("%li bytes unknown data: "),
+ (long int) entry->size);
+ for (i = 0; i < (int)entry->size; i++) {
+ sprintf (buf, "%02x", entry->data[i]);
+ strncat (v, buf, maxlen - strlen (v));
+ }
+ break;
+ }
+ break;
+ }
+
+ return (v);
+}
diff --git a/src/libexif/olympus/mnote-olympus-entry.h b/src/libexif/olympus/mnote-olympus-entry.h
new file mode 100644
index 0000000..a725228
--- /dev/null
+++ b/src/libexif/olympus/mnote-olympus-entry.h
@@ -0,0 +1,43 @@
+/* mnote-olympus-entry.h
+ *
+ * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __MNOTE_OLYMPUS_ENTRY_H__
+#define __MNOTE_OLYMPUS_ENTRY_H__
+
+#include <libexif/exif-format.h>
+#include <libexif/exif-byte-order.h>
+#include <libexif/olympus/mnote-olympus-tag.h>
+
+typedef struct _MnoteOlympusEntry MnoteOlympusEntry;
+
+struct _MnoteOlympusEntry {
+ MnoteOlympusTag tag;
+ ExifFormat format;
+ unsigned long components;
+
+ unsigned char *data;
+ unsigned int size;
+
+ ExifByteOrder order;
+};
+
+char *mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *val, unsigned int maxlen);
+
+#endif /* __MNOTE_OLYMPUS_ENTRY_H__ */
diff --git a/src/libexif/olympus/mnote-olympus-tag.c b/src/libexif/olympus/mnote-olympus-tag.c
new file mode 100644
index 0000000..b7beacd
--- /dev/null
+++ b/src/libexif/olympus/mnote-olympus-tag.c
@@ -0,0 +1,155 @@
+/* mnote-olympus-tag.c:
+ *
+ * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include "mnote-olympus-tag.h"
+
+#include <libexif/i18n.h>
+#include <libexif/exif-utils.h>
+
+#include <stdlib.h>
+
+static struct {
+ MnoteOlympusTag tag;
+ const char *name;
+ const char *title;
+ const char *description;
+} table[] = {
+
+ /* Nikon v2 */
+ {MNOTE_NIKON_TAG_FIRMWARE, "Firmware", N_("Firmware Version"), NULL},
+ {MNOTE_NIKON_TAG_ISO, "ISO", N_("ISO Setting"), NULL},
+ {MNOTE_NIKON_TAG_COLORMODE1, "COLORMODE1", N_("Colormode (?)"), NULL},
+ {MNOTE_NIKON_TAG_QUALITY, "QUALITY", N_("Quality"), NULL},
+ {MNOTE_NIKON_TAG_WHITEBALANCE, "WHITEBALANCE", N_("Whitebalance"), NULL},
+ {MNOTE_NIKON_TAG_SHARPENING, "SHARPENING", N_("Image Sharpening"), NULL},
+ {MNOTE_NIKON_TAG_FOCUSMODE, "FOCUSMODE", N_("Focus Mode"), NULL},
+ {MNOTE_NIKON_TAG_FLASHSETTING, "FLASHSETTING", N_("Flash Setting"), NULL},
+ {MNOTE_NIKON_TAG_FLASHMODE, "FLASHMODE", N_("Flash Mode"), NULL},
+ {MNOTE_NIKON_TAG_WHITEBALANCEFINE,"WHITEBALANCEFINE",N_("Whitebalance fine ajustment"), NULL},
+ {MNOTE_NIKON_TAG_WHITEBALANCERB, "WHITEBALANCERB", N_("Whitebalance RB"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X000D, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_ISOSELECTION, "ISOSELECTION", N_("Isoselection"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0011, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_EXPOSUREDIFF, "EXPOSUREDIFF", N_("Exposurediff ?"), NULL},
+ {MNOTE_NIKON_TAG_FLASHCOMPENSATION, "FLASHCOMPENSATION", N_("Flashcompensation ?"), NULL},
+ {MNOTE_NIKON_TAG_ISO2, "ISO", N_("ISO Setting"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0016, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0017, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0018, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0019, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_IMAGEADJUSTMENT, "ImageAdjustment", N_("Image Adjustment"), NULL},
+ {MNOTE_NIKON_TAG_TONECOMPENSATION, "TONECOMPENSATION", N_("Tonecompensation"), NULL},
+ {MNOTE_NIKON_TAG_ADAPTER, "Adapter", N_("Adapter"), NULL},
+ {MNOTE_NIKON_TAG_LENSTYPE, "LENSTYPE", N_("Lenstype"), NULL},
+ {MNOTE_NIKON_TAG_LENS, "LENS", N_("Lens"), NULL},
+ {MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE, "MANUALFOCUSDISTANCE", N_("Manual Focus Distance"), NULL},
+ {MNOTE_NIKON_TAG_DIGITALZOOM, "DigitalZoom", N_("Digital Zoom"), NULL},
+ {MNOTE_NIKON_TAG_FLASHUSED, "FLASHUSED", N_("Flash used"), NULL},
+ {MNOTE_NIKON_TAG_AFFOCUSPOSITION, "AFFOCUSPOSITION", N_("AF Focus position"), NULL},
+ {MNOTE_NIKON_TAG_BRACKETING, "BRACKETING", N_("Bracketing"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X008A, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X008B, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_CURVE, "CURVE,", N_("Contrast curve"), NULL},
+ {MNOTE_NIKON_TAG_COLORMODE, "COLORMODE,", N_("Colormode"), NULL},
+ {MNOTE_NIKON_TAG_LIGHTYPE, "LIGHTYPE,", N_("Lightype"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0091, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_HUE, "Hue,", N_("Hue Adjustment"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0094, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_NOISEREDUCTION, "NOISEREDUCTION,", N_("Noisereduction"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0097, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0098, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X009A, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X009B, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X00A0, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X00A2, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X00A3, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_TOTALPICTURES, "TOTALPICTURES,", N_("Total number of pictures taken"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X00A8, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_OPTIMIZATION, "OPTIMIZATION,", N_("Optimize Image"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X00AA, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X00AB, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_CAPTUREEDITORDATA, "CAPTUREEDITORDATA", N_("Capture Editor Data"), NULL},
+ {MNOTE_NIKON_TAG_CAPTUREEDITORVER, "CAPTUREEDITORVER", N_("Capture Editor Version"), NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0E0E, NULL, NULL, NULL},
+ {MNOTE_NIKON_TAG_UNKNOWN_0X0E10, NULL, NULL, NULL},
+ {MNOTE_NIKON1_TAG_UNKNOWN_0X0002, NULL, NULL, NULL},
+ {MNOTE_NIKON1_TAG_QUALITY, "QUALITY", N_("Quality"), NULL},
+ {MNOTE_NIKON1_TAG_COLORMODE, "COLORMODE,", N_("Colormode"), NULL},
+ {MNOTE_NIKON1_TAG_IMAGEADJUSTMENT, "ImageAdjustment", N_("Image Adjustment"), NULL},
+ {MNOTE_NIKON1_TAG_CCDSENSITIVITY, "CCDSensitivity", N_("CCD Sensitivity"), NULL},
+ {MNOTE_NIKON1_TAG_WHITEBALANCE, "WhiteBalance", N_("Whitebalance"), NULL},
+ {MNOTE_NIKON1_TAG_FOCUS, "Focus", N_("Focus"), NULL},
+ {MNOTE_NIKON1_TAG_UNKNOWN_0X0009, NULL, NULL, NULL},
+ {MNOTE_NIKON1_TAG_DIGITALZOOM, "DigitalZoom", N_("Digital Zoom"), NULL},
+ {MNOTE_NIKON1_TAG_CONVERTER, "Converter", N_("Converter"), NULL},
+
+ /* Olympus */
+ {MNOTE_OLYMPUS_TAG_MODE, "Mode", N_("Speed/Sequence/Panorama direction"), NULL},
+ {MNOTE_OLYMPUS_TAG_QUALITY, "Quality", N_("Quality"), NULL},
+ {MNOTE_OLYMPUS_TAG_MACRO, "Macro", N_("Macro"), NULL},
+ {MNOTE_OLYMPUS_TAG_UNKNOWN_1, NULL, NULL, NULL},
+ {MNOTE_OLYMPUS_TAG_DIGIZOOM, "DigiZoom", N_("Digital Zoom"), NULL},
+ {MNOTE_OLYMPUS_TAG_UNKNOWN_2, NULL, NULL, NULL},
+ {MNOTE_OLYMPUS_TAG_UNKNOWN_3, NULL, NULL, NULL},
+ {MNOTE_OLYMPUS_TAG_VERSION, "FirmwareVersion", N_("Firmware version"), NULL},
+ {MNOTE_OLYMPUS_TAG_INFO, "Info", N_("Info"), NULL},
+ {MNOTE_OLYMPUS_TAG_ID, "CameraID", N_("Camera ID"), NULL},
+ {MNOTE_OLYMPUS_TAG_UNKNOWN_4, NULL, NULL, NULL},
+ {MNOTE_OLYMPUS_TAG_FLASHMODE, "FlashMode", N_("Flash Mode"), NULL},
+ {MNOTE_OLYMPUS_TAG_FOCUSDIST, "ManualFocusDistance", N_("Manual Focus Distance"), NULL},
+ {MNOTE_OLYMPUS_TAG_SHARPNESS, "Sharpness", N_("Sharpness Setting"), NULL},
+ {MNOTE_OLYMPUS_TAG_WBALANCE, "WhiteBalance", N_("White Balance Setting"), NULL},
+ {MNOTE_OLYMPUS_TAG_CONTRAST, "Contrast", N_("Contrast Setting"), NULL},
+ {MNOTE_OLYMPUS_TAG_MANFOCUS, "ManualFocus", N_("Manual Focus"), NULL},
+ {0, NULL, NULL, NULL}
+};
+
+const char *
+mnote_olympus_tag_get_name (MnoteOlympusTag t)
+{
+ unsigned int i;
+
+ for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
+ if (table[i].tag == t) return (table[i].name);
+ return NULL;
+}
+
+const char *
+mnote_olympus_tag_get_title (MnoteOlympusTag t)
+{
+ unsigned int i;
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
+ if (table[i].tag == t) return (_(table[i].title));
+ return NULL;
+}
+
+const char *
+mnote_olympus_tag_get_description (MnoteOlympusTag t)
+{
+ unsigned int i;
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
+ if (table[i].tag == t) return (_(table[i].description));
+ return NULL;
+}
diff --git a/src/libexif/olympus/mnote-olympus-tag.h b/src/libexif/olympus/mnote-olympus-tag.h
new file mode 100644
index 0000000..22278ac
--- /dev/null
+++ b/src/libexif/olympus/mnote-olympus-tag.h
@@ -0,0 +1,130 @@
+/* mnote-olympus-tag.h
+ *
+ * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __MNOTE_OLYMPUS_TAG_H__
+#define __MNOTE_OLYMPUS_TAG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+enum _MnoteOlympusTag {
+
+ /* Nikon v.2 */
+ MNOTE_NIKON_TAG_FIRMWARE = 0x0001,
+ MNOTE_NIKON_TAG_ISO = 0x0002,
+ MNOTE_NIKON_TAG_COLORMODE1 = 0x0003,
+ MNOTE_NIKON_TAG_QUALITY = 0x0004,
+ MNOTE_NIKON_TAG_WHITEBALANCE = 0x0005,
+ MNOTE_NIKON_TAG_SHARPENING = 0x0006,
+ MNOTE_NIKON_TAG_FOCUSMODE = 0x0007,
+ MNOTE_NIKON_TAG_FLASHSETTING = 0x0008,
+ MNOTE_NIKON_TAG_FLASHMODE = 0x0009,
+ MNOTE_NIKON_TAG_WHITEBALANCEFINE = 0x000b,
+ MNOTE_NIKON_TAG_WHITEBALANCERB = 0x000c,
+ MNOTE_NIKON_TAG_UNKNOWN_0X000D = 0x000d,
+ MNOTE_NIKON_TAG_EXPOSUREDIFF = 0x000e,
+ MNOTE_NIKON_TAG_ISOSELECTION = 0x000f,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0011 = 0x0011,
+ MNOTE_NIKON_TAG_FLASHCOMPENSATION = 0x0012,
+ MNOTE_NIKON_TAG_ISO2 = 0x0013,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0016 = 0x0016,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0017 = 0x0017,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0018 = 0x0018,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0019 = 0x0019,
+ MNOTE_NIKON_TAG_IMAGEADJUSTMENT = 0x0080,
+ MNOTE_NIKON_TAG_TONECOMPENSATION = 0x0081,
+ MNOTE_NIKON_TAG_ADAPTER = 0x0082,
+ MNOTE_NIKON_TAG_LENSTYPE = 0x0083,
+ MNOTE_NIKON_TAG_LENS = 0x0084,
+ MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE = 0x0085,
+ MNOTE_NIKON_TAG_DIGITALZOOM = 0x0086,
+ MNOTE_NIKON_TAG_FLASHUSED = 0x0087,
+ MNOTE_NIKON_TAG_AFFOCUSPOSITION = 0x0088,
+ MNOTE_NIKON_TAG_BRACKETING = 0x0089,
+ MNOTE_NIKON_TAG_UNKNOWN_0X008A = 0x008a,
+ MNOTE_NIKON_TAG_UNKNOWN_0X008B = 0x008b,
+ MNOTE_NIKON_TAG_CURVE = 0x008c,
+ MNOTE_NIKON_TAG_COLORMODE = 0x008d,
+ MNOTE_NIKON_TAG_LIGHTYPE = 0x0090,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0091 = 0x0091,
+ MNOTE_NIKON_TAG_HUE = 0x0092,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0094 = 0x0094,
+ MNOTE_NIKON_TAG_NOISEREDUCTION = 0x0095,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0097 = 0x0097,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0098 = 0x0098,
+ MNOTE_NIKON_TAG_UNKNOWN_0X009A = 0x009a,
+ MNOTE_NIKON_TAG_UNKNOWN_0X009B = 0x009b,
+ MNOTE_NIKON_TAG_UNKNOWN_0X00A0 = 0x00a0,
+ MNOTE_NIKON_TAG_UNKNOWN_0X00A2 = 0x00a2,
+ MNOTE_NIKON_TAG_UNKNOWN_0X00A3 = 0x00a3,
+ MNOTE_NIKON_TAG_TOTALPICTURES = 0x00a7,
+ MNOTE_NIKON_TAG_UNKNOWN_0X00A8 = 0x00a8,
+ MNOTE_NIKON_TAG_OPTIMIZATION = 0x00a9,
+ MNOTE_NIKON_TAG_UNKNOWN_0X00AA = 0x00aa,
+ MNOTE_NIKON_TAG_UNKNOWN_0X00AB = 0x00ab,
+ MNOTE_NIKON_TAG_CAPTUREEDITORDATA = 0x0e01,
+ MNOTE_NIKON_TAG_CAPTUREEDITORVER = 0x0e09,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0E0E = 0x0e0e,
+ MNOTE_NIKON_TAG_UNKNOWN_0X0E10 = 0x0e10,
+
+ /* Nikon v1: real values + our proprietary base to distinguish from v2 */
+ MNOTE_NIKON1_TAG_BASE = 0x8000,
+ MNOTE_NIKON1_TAG_UNKNOWN_0X0002 = 0x0002 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_QUALITY = 0x0003 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_COLORMODE = 0x0004 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_IMAGEADJUSTMENT = 0x0005 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_CCDSENSITIVITY = 0x0006 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_WHITEBALANCE = 0x0007 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_FOCUS = 0x0008 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_UNKNOWN_0X0009 = 0x0009 + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_DIGITALZOOM = 0x000a + MNOTE_NIKON1_TAG_BASE,
+ MNOTE_NIKON1_TAG_CONVERTER = 0x000b + MNOTE_NIKON1_TAG_BASE,
+
+ /* Olympus */
+ MNOTE_OLYMPUS_TAG_MODE = 0x0200,
+ MNOTE_OLYMPUS_TAG_QUALITY = 0x0201,
+ MNOTE_OLYMPUS_TAG_MACRO = 0x0202,
+ MNOTE_OLYMPUS_TAG_UNKNOWN_1 = 0x0203,
+ MNOTE_OLYMPUS_TAG_DIGIZOOM = 0x0204,
+ MNOTE_OLYMPUS_TAG_UNKNOWN_2 = 0x0205,
+ MNOTE_OLYMPUS_TAG_UNKNOWN_3 = 0x0206,
+ MNOTE_OLYMPUS_TAG_VERSION = 0x0207,
+ MNOTE_OLYMPUS_TAG_INFO = 0x0208,
+ MNOTE_OLYMPUS_TAG_ID = 0x0209,
+ MNOTE_OLYMPUS_TAG_UNKNOWN_4 = 0x0f04,
+ MNOTE_OLYMPUS_TAG_FLASHMODE = 0x1004,
+ MNOTE_OLYMPUS_TAG_MANFOCUS = 0x100b,
+ MNOTE_OLYMPUS_TAG_FOCUSDIST = 0x100c,
+ MNOTE_OLYMPUS_TAG_SHARPNESS = 0x100f,
+ MNOTE_OLYMPUS_TAG_WBALANCE = 0x1015,
+ MNOTE_OLYMPUS_TAG_CONTRAST = 0x1029
+};
+typedef enum _MnoteOlympusTag MnoteOlympusTag;
+
+const char *mnote_olympus_tag_get_name (MnoteOlympusTag tag);
+const char *mnote_olympus_tag_get_title (MnoteOlympusTag tag);
+const char *mnote_olympus_tag_get_description (MnoteOlympusTag tag);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MNOTE_OLYMPUS_TAG_H__ */