Update of /cvsroot/libexif/libexif/libexif/olympus
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1392
Modified Files:
exif-mnote-data-olympus.c exif-mnote-data-olympus.h
mnote-olympus-entry.c
Log Message:
Added support for Olympus S760 & S770 makernote (bug #1703284)
Index: mnote-olympus-entry.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/olympus/mnote-olympus-entry.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -p -d -r1.28 -r1.29
--- mnote-olympus-entry.c 26 Apr 2007 17:01:36 -0000 1.28
+++ mnote-olympus-entry.c 8 May 2007 09:18:36 -0000 1.29
@@ -475,7 +475,7 @@ mnote_olympus_entry_get_value (MnoteOlym
break;
case MNOTE_OLYMPUS_TAG_INFO:
CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
- CC2 (entry->components, 52, 53, v, maxlen);
+ CC2 (entry->components, 52, 60, v, maxlen);
strncpy (v, (char *)entry->data, MIN (maxlen, entry->size));
break;
case MNOTE_OLYMPUS_TAG_ID:
Index: exif-mnote-data-olympus.h
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -d -r1.6 -r1.7
--- exif-mnote-data-olympus.h 5 Jul 2005 08:29:32 -0000 1.6
+++ exif-mnote-data-olympus.h 8 May 2007 09:18:36 -0000 1.7
@@ -26,7 +26,7 @@
#include <libexif/exif-byte-order.h>
#include <libexif/exif-mem.h>
-enum OlympusVersion {olympus = 0, nikonV1 = 1, nikonV2 = 2};
+enum OlympusVersion {nikonV1 = 1, nikonV2 = 2, olympusV1 = 3, olympusV2 = 4 };
typedef struct _ExifMnoteDataOlympus ExifMnoteDataOlympus;
Index: exif-mnote-data-olympus.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -p -d -r1.26 -r1.27
--- exif-mnote-data-olympus.c 6 May 2007 17:41:57 -0000 1.26
+++ exif-mnote-data-olympus.c 8 May 2007 09:18:36 -0000 1.27
@@ -86,7 +86,7 @@ exif_mnote_data_olympus_save (ExifMnoteD
unsigned char **buf, unsigned int *buf_size)
{
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) ne;
- unsigned int i, o, s, doff, base = 0, o2 = 6;
+ unsigned int i, o, s, doff, base = 0, o2 = 6 + 2;
int datao = 0;
if (!n || !buf || !buf_size) return;
@@ -95,9 +95,8 @@ exif_mnote_data_olympus_save (ExifMnoteD
* Allocate enough memory for all entries and the number of entries.
*/
*buf_size = 6 + 2 + 2 + n->count * 12;
- o2 += 2;
switch (n->version) {
- case olympus:
+ case olympusV1:
*buf = exif_mem_alloc (ne->mem, *buf_size);
if (!*buf) return;
@@ -105,6 +104,20 @@ exif_mnote_data_olympus_save (ExifMnoteD
strcpy ((char *)*buf, "OLYMP");
datao = n->offset;
break;
+ case olympusV2:
+ *buf_size += 8-6 + 4;
+ *buf = exif_mem_alloc (ne->mem, *buf_size);
+ if (!*buf) return;
+
+ /* Write the header and the number of entries. */
+ strcpy ((char *)*buf, "OLYMPUS");
+ exif_set_short (*buf + 8, n->order, (ExifShort) (
+ (n->order == EXIF_BYTE_ORDER_INTEL) ?
+ ('I' << 8) | 'I' :
+ ('M' << 8) | 'M'));
+ exif_set_short (*buf + 10, n->order, (ExifShort) 3);
+ o2 += 4;
+ break;
case nikonV1:
base = MNOTE_NIKON1_TAG_BASE;
@@ -205,14 +218,31 @@ exif_mnote_data_olympus_load (ExifMnoteD
* lastly 0x2A.
*/
if (buf_size - n->offset < 22) return;
- if (!memcmp (buf + o2, "OLYMP", 5)) {
+ if (!memcmp (buf + o2, "OLYMP", 6)) {
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
- "Parsing Olympus maker note...");
+ "Parsing Olympus maker note v1...");
/* The number of entries is at position 8. */
- n->version = olympus;
+ n->version = olympusV1;
o2 += 8;
+ } else if (!memcmp (buf + o2, "OLYMPUS", 8)) {
+ /* Olympus S760, S770 */
+ datao = o2;
+ o2 += 8;
+ exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
+ "Parsing Olympus maker note v2 (0x%02x, %02x, %02x, %02x)...",
+ buf[o2], buf[o2 + 1], buf[o2 + 2], buf[o2 + 3]);
+
+ if ((buf[o2] == 'I') && (buf[o2 + 1] == 'I'))
+ n->order = EXIF_BYTE_ORDER_INTEL;
+ else if ((buf[o2] == 'M') && (buf[o2 + 1] == 'M'))
+ n->order = EXIF_BYTE_ORDER_MOTOROLA;
+
+ /* The number of entries is at position 8+4. */
+ n->version = olympusV2;
+ o2 += 4;
+
} else if (!memcmp (buf + o2, "Nikon", 6)) {
o2 += 6;
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|