Update of /cvsroot/libexif/libexif/libexif/olympus In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5597/libexif/olympus Modified Files: exif-mnote-data-olympus.c exif-mnote-data-olympus.h mnote-olympus-entry.c mnote-olympus-tag.c mnote-olympus-tag.h Log Message: Added support for Epson MakerNotes, which have the identical tag format and namespace of the Olympus ones. Index: mnote-olympus-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/mnote-olympus-entry.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -p -d -r1.42 -r1.43 --- mnote-olympus-entry.c 5 Dec 2008 20:52:53 -0000 1.42 +++ mnote-olympus-entry.c 13 Jan 2009 08:26:41 -0000 1.43 @@ -244,6 +244,7 @@ mnote_olympus_entry_get_value (MnoteOlym char buf[30]; ExifLong vl; ExifShort vs = 0; + ExifSShort vss = 0; ExifRational vr, vr2; ExifSRational vsr; int i, j; @@ -305,10 +306,13 @@ mnote_olympus_entry_get_value (MnoteOlym case MNOTE_NIKON_TAG_IMAGEADJUSTMENT: case MNOTE_NIKON_TAG_ADAPTER: case MNOTE_NIKON_TAG_SATURATION2: + case MNOTE_EPSON_TAG_OEM_MODEL: CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen); memcpy(v, entry->data, MIN (maxlen, entry->size)); break; case MNOTE_NIKON_TAG_TOTALPICTURES: + case MNOTE_EPSON_TAG_IMAGE_WIDTH: + case MNOTE_EPSON_TAG_IMAGE_HEIGHT: CF (entry->format, EXIF_FORMAT_LONG, v, maxlen); CC (entry->components, 1, v, maxlen); vl = exif_get_long (entry->data, entry->order); @@ -577,12 +581,21 @@ mnote_olympus_entry_get_value (MnoteOlym } break; case MNOTE_OLYMPUS_TAG_LENSDISTORTION: - CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen); - CC (entry->components, 6, v, maxlen); - for (i=0; i < (int)entry->components; ++i) { - vs = exif_get_sshort (entry->data+2*i, entry->order); - sprintf (buf, "%hd ", vs); + if (entry->format == EXIF_FORMAT_SHORT) { + /* Epson uses a single SHORT here */ + CC (entry->components, 1, v, maxlen); + vs = exif_get_short (entry->data, entry->order); + sprintf (buf, "%hu", vs); strncat (v, buf, maxlen - strlen (v)); + } else { + /* Others use an array of SSHORT here */ + CC (entry->components, 6, v, maxlen); + CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen); + for (i=0; i < (int)entry->components; ++i) { + vss = exif_get_sshort (entry->data+2*i, entry->order); + sprintf (buf, "%hd ", vss); + strncat (v, buf, maxlen - strlen (v)); + } } break; case MNOTE_OLYMPUS_TAG_COLORCONTROL: Index: mnote-olympus-tag.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/mnote-olympus-tag.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- mnote-olympus-tag.h 5 Dec 2008 07:07:17 -0000 1.9 +++ mnote-olympus-tag.h 13 Jan 2009 08:26:41 -0000 1.10 @@ -179,6 +179,11 @@ enum _MnoteOlympusTag { MNOTE_SANYO_TAG_SCENESELECT = 0x021f, MNOTE_SANYO_TAG_MANUALFOCUSDISTANCE = 0x0223, MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL = 0x0224, + + /* Epson */ + MNOTE_EPSON_TAG_IMAGE_WIDTH = 0x020b, + MNOTE_EPSON_TAG_IMAGE_HEIGHT = 0x020c, + MNOTE_EPSON_TAG_OEM_MODEL = 0x020d, }; typedef enum _MnoteOlympusTag MnoteOlympusTag; Index: mnote-olympus-tag.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/mnote-olympus-tag.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -p -d -r1.17 -r1.18 --- mnote-olympus-tag.c 20 Oct 2008 07:52:43 -0000 1.17 +++ mnote-olympus-tag.c 13 Jan 2009 08:26:41 -0000 1.18 @@ -182,6 +182,11 @@ static const struct { {MNOTE_SANYO_TAG_SCENESELECT, "SceneSelect", N_("Scene Select"), ""}, {MNOTE_SANYO_TAG_MANUALFOCUSDISTANCE, "ManualFocusDistance", N_("Manual Focus Distance"), ""}, {MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL, "SequenceShotInterval", N_("Sequence Shot Interval"), ""}, + + /* Epson */ + {MNOTE_EPSON_TAG_IMAGE_WIDTH, "EpsonImageWidth", N_("Epson Image Width"), ""}, + {MNOTE_EPSON_TAG_IMAGE_HEIGHT, "EpsonImageHeight", N_("Epson Image Height"), ""}, + {MNOTE_EPSON_TAG_OEM_MODEL, "EpsonOEMModel", N_("OEM Model Name"), ""}, #endif {0, NULL, NULL, NULL} }; Index: exif-mnote-data-olympus.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -p -d -r1.37 -r1.38 --- exif-mnote-data-olympus.c 11 Dec 2008 06:57:41 -0000 1.37 +++ exif-mnote-data-olympus.c 13 Jan 2009 08:26:41 -0000 1.38 @@ -102,11 +102,13 @@ exif_mnote_data_olympus_save (ExifMnoteD switch (n->version) { case olympusV1: case sanyoV1: + case epsonV1: *buf = exif_mem_alloc (ne->mem, *buf_size); if (!*buf) return; /* Write the header and the number of entries. */ - strcpy ((char *)*buf, n->version==sanyoV1?"SANYO":"OLYMP"); + strcpy ((char *)*buf, n->version==sanyoV1?"SANYO": + (n->version==epsonV1?"EPSON":"OLYMP")); exif_set_short (*buf + 6, n->order, (ExifShort) 1); datao = n->offset; break; @@ -224,6 +226,9 @@ exif_mnote_data_olympus_load (ExifMnoteD * Sanyo format is identical and uses identical tags except that * header starts with "SANYO". * + * Epson format is identical and uses identical tags except that + * header starts with "EPSON". + * * Nikon headers start with "Nikon" (6 bytes including '\0'), * version number (1 or 2). * @@ -235,13 +240,16 @@ exif_mnote_data_olympus_load (ExifMnoteD * lastly 0x2A. */ if (buf_size - n->offset < 22) return; - if (!memcmp (buf + o2, "OLYMP", 6) || !memcmp (buf + o2, "SANYO", 6)) { + if (!memcmp (buf + o2, "OLYMP", 6) || !memcmp (buf + o2, "SANYO", 6) || + !memcmp (buf + o2, "EPSON", 6)) { exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus", - "Parsing Olympus/Sanyo maker note v1..."); + "Parsing Olympus/Sanyo/Epson maker note v1..."); /* The number of entries is at position 8. */ if (!memcmp (buf + o2, "SANYO", 6)) n->version = sanyoV1; + else if (!memcmp (buf + o2, "EPSON", 6)) + n->version = epsonV1; else n->version = olympusV1; if (buf[o2 + 6] == 1) Index: exif-mnote-data-olympus.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- exif-mnote-data-olympus.h 17 Feb 2008 18:31:56 -0000 1.9 +++ exif-mnote-data-olympus.h 13 Jan 2009 08:26:41 -0000 1.10 @@ -26,7 +26,14 @@ #include <libexif/exif-byte-order.h> #include <libexif/exif-mem.h> -enum OlympusVersion {nikonV1 = 1, nikonV2 = 2, olympusV1 = 3, olympusV2 = 4, sanyoV1 = 5 }; +enum OlympusVersion { + nikonV1 = 1, + nikonV2 = 2, + olympusV1 = 3, + olympusV2 = 4, + sanyoV1 = 5, + epsonV1 = 6 +}; typedef struct _ExifMnoteDataOlympus ExifMnoteDataOlympus; |