diff options
author | scuri <scuri> | 2009-08-20 12:13:11 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-08-20 12:13:11 +0000 |
commit | 35733b87eed86e5228f12fa10c98a3d9d22a6073 (patch) | |
tree | aa7e3c89788c15b925eecdbdf7e9d98291b4f469 /src/libexif/olympus/mnote-olympus-entry.c | |
parent | 83b3c8b629d96f5fdf754d35d5f4f5369dbfef1d (diff) |
*** empty log message ***
Diffstat (limited to 'src/libexif/olympus/mnote-olympus-entry.c')
-rw-r--r-- | src/libexif/olympus/mnote-olympus-entry.c | 385 |
1 files changed, 305 insertions, 80 deletions
diff --git a/src/libexif/olympus/mnote-olympus-entry.c b/src/libexif/olympus/mnote-olympus-entry.c index 1eff6fe..1e9e1e2 100644 --- a/src/libexif/olympus/mnote-olympus-entry.c +++ b/src/libexif/olympus/mnote-olympus-entry.c @@ -1,6 +1,6 @@ /* mnote-olympus-entry.c * - * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net> + * Copyright (c) 2002 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 @@ -42,6 +42,19 @@ } \ } +#define CF2(format,target1,target2,v,maxlen) \ +{ \ + if ((format != target1) && (format != target2)) { \ + snprintf (v, maxlen, \ + _("Invalid format '%s', " \ + "expected '%s' or '%s'."), \ + exif_format_get_name (format), \ + exif_format_get_name (target1), \ + exif_format_get_name (target2)); \ + break; \ + } \ +} + #define CC(number,target,v,maxlen) \ { \ if (number != target) { \ @@ -54,7 +67,7 @@ #define CC2(number,t1,t2,v,maxlen) \ { \ - if ((number != t1) && (number != t2)) { \ + if ((number < t1) || (number > t2)) { \ snprintf (v, maxlen, \ _("Invalid number of components (%i, " \ "expected %i or %i)."), (int) number, \ @@ -63,7 +76,7 @@ } \ } -static struct { +static const struct { ExifTag tag; ExifFormat fmt; struct { @@ -71,6 +84,7 @@ static struct { const char *string; } elem[10]; } items[] = { +#ifndef NO_VERBOSE_TAG_DATA { MNOTE_NIKON_TAG_LENSTYPE, EXIF_FORMAT_BYTE, { {0, N_("AF non D Lens")}, {1, N_("Manual")}, @@ -116,7 +130,7 @@ static struct { { {0, N_("Auto")}, {1, N_("Preset")}, {2, N_("Daylight")}, - {3, N_("Incandescense")}, + {3, N_("Incandescence")}, {4, N_("Fluorescence")}, {5, N_("Cloudy")}, {6, N_("SpeedLight")}, @@ -129,14 +143,25 @@ static struct { { {1, N_("SQ")}, {2, N_("HQ")}, {3, N_("SHQ")}, + {4, N_("RAW")}, + {5, N_("SQ1")}, + {6, N_("SQ2")}, + {17, N_("Standard")}, + {529, N_("High")}, {0, NULL}}}, { MNOTE_OLYMPUS_TAG_MACRO, EXIF_FORMAT_SHORT, { {0, N_("No")}, {1, N_("Yes")}, + {2, N_("Super Macro")}, {0, NULL}}}, - { MNOTE_OLYMPUS_TAG_DIGIZOOM, EXIF_FORMAT_SHORT, - { {0, N_("1x")}, - {2, N_("2x")}, + { MNOTE_OLYMPUS_TAG_BWMODE, EXIF_FORMAT_SHORT, + { {0, N_("No")}, + {1, N_("Yes")}, + {0, NULL}}}, + { MNOTE_OLYMPUS_TAG_ONETOUCHWB, EXIF_FORMAT_SHORT, + { {0, N_("Off")}, + {1, N_("On")}, + {2, N_("On (Preset)")}, {0, NULL}}}, { MNOTE_OLYMPUS_TAG_FLASHMODE, EXIF_FORMAT_SHORT, { {0, N_("Auto")}, @@ -144,21 +169,73 @@ static struct { {2, N_("Fill")}, {3, N_("Off")}, {0, NULL}}}, + { MNOTE_OLYMPUS_TAG_FLASHDEVICE, EXIF_FORMAT_SHORT, + { {0, N_("None")}, + {1, N_("Internal")}, + {4, N_("External")}, + {5, N_("Internal + External")}, + {0, NULL}}}, + { MNOTE_OLYMPUS_TAG_FOCUSRANGE, EXIF_FORMAT_SHORT, + { {0, N_("Normal")}, + {1, N_("Macro")}, + {0, NULL}}}, + { MNOTE_OLYMPUS_TAG_MANFOCUS, EXIF_FORMAT_SHORT, + { {0, N_("Auto")}, + {1, N_("Manual")}, + {0, NULL}}}, { MNOTE_OLYMPUS_TAG_SHARPNESS, EXIF_FORMAT_SHORT, { {0, N_("Normal")}, {1, N_("Hard")}, {2, N_("Soft")}, {0, NULL}}}, + { MNOTE_OLYMPUS_TAG_EXTERNALFLASHBOUNCE, EXIF_FORMAT_SHORT, + { {0, N_("No")}, + {1, N_("Yes")}, + {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, + { MNOTE_OLYMPUS_TAG_PREVIEWIMAGEVALID, EXIF_FORMAT_LONG, + { {0, N_("No")}, + {1, N_("Yes")}, + {0, NULL}}}, + { MNOTE_OLYMPUS_TAG_CCDSCANMODE, EXIF_FORMAT_SHORT, + { {0, N_("Interlaced")}, + {1, N_("Progressive")}, + {0, NULL}}}, + { MNOTE_SANYO_TAG_SEQUENTIALSHOT, EXIF_FORMAT_SHORT, + { {0, N_("None")}, + {1, N_("Standard")}, + {2, N_("Best")}, + {3, N_("Adjust Exposure")}, + {0, NULL}}}, + { MNOTE_SANYO_TAG_RECORDSHUTTERRELEASE, EXIF_FORMAT_SHORT, + { {0, N_("Record while down")}, + {1, N_("Press start, press stop")}, + {0, NULL}}}, + { MNOTE_SANYO_TAG_RESAVED, EXIF_FORMAT_SHORT, { {0, N_("No")}, {1, N_("Yes")}, {0, NULL}}}, - { 0, } + { MNOTE_SANYO_TAG_SCENESELECT, EXIF_FORMAT_SHORT, + { {0, N_("Off")}, + {1, N_("Sport")}, + {2, N_("TV")}, + {3, N_("Night")}, + {4, N_("User 1")}, + {5, N_("User 2")}, + {6, N_("Lamp")}, + {0, NULL}}}, + { MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL, EXIF_FORMAT_SHORT, + { {0, N_("5 frames/sec")}, + {1, N_("10 frames/sec")}, + {2, N_("15 frames/sec")}, + {3, N_("20 frames/sec")}, + {0, NULL}}}, +#endif + { 0, 0, { { 0, NULL } } } }; char * @@ -167,7 +244,8 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m char buf[30]; ExifLong vl; ExifShort vs = 0; - ExifRational vr; + ExifRational vr, vr2; + ExifSRational vsr; int i, j; double r, b; @@ -177,7 +255,8 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m memset (v, 0, maxlen); maxlen--; - if ((!entry->data) && (entry->components > 0)) return (v); + if ((!entry->data) && (entry->components > 0)) + return (v); switch (entry->tag) { @@ -212,7 +291,7 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m //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); + memcpy(v, entry->data, MIN(maxlen, entry->size)); //snprintf (v, maxlen, "%s<", ( entry->data - 9 ); break; case MNOTE_NIKON_TAG_COLORMODE: @@ -225,21 +304,43 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m 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_SATURATION2: + CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen); + memcpy(v, entry->data, MIN (maxlen, entry->size)); + 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; + 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_LENS_FSTOPS: + case MNOTE_NIKON_TAG_EXPOSUREDIFF: { + unsigned char a,b,c,d; + CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen); + CC (entry->components, 4, v, maxlen); + vl = exif_get_long (entry->data, entry->order); + a = (vl>>24)&0xff; b = (vl>>16)&0xff; c = (vl>>8)&0xff; d = (vl)&0xff; + snprintf (v, maxlen, "%.1f", c?(float)a*((float)b/(float)c):0 ); + break; + } + case MNOTE_NIKON_TAG_FLASHEXPCOMPENSATION: + case MNOTE_NIKON_TAG_FLASHEXPOSUREBRACKETVAL: + CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen); + CC (entry->components, 4, v, maxlen); + vl = exif_get_long (entry->data, entry->order); + snprintf (v, maxlen, "%.1f", ((long unsigned int) vl>>24)/6.0 ); + break; + case MNOTE_NIKON_TAG_SATURATION: 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_HUE: + case MNOTE_OLYMPUS_TAG_SENSORTEMPERATURE: + case MNOTE_OLYMPUS_TAG_LENSTEMPERATURE: + 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); @@ -248,7 +349,7 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m 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); + 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); @@ -256,31 +357,69 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m vr = exif_get_rational (entry->data, entry->order); if (vr.numerator) { r = (double)vr.numerator / vr.denominator; - snprintf (v, maxlen, "%2.2f meters", r); + 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: + case MNOTE_NIKON_TAG_SENSORPIXELSIZE: CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); - CC (entry->components, 1, v, maxlen); + CC (entry->components, 2, v, maxlen); vr = exif_get_rational (entry->data, entry->order); + vr2 = exif_get_rational (entry->data+8, entry->order); r = (double)vr.numerator / vr.denominator; - snprintf (v, maxlen, "%2.2f", r); + b = (double)vr2.numerator / vr2.denominator; + snprintf (v, maxlen, "%2.2f x %2.2f um", r, b); + break; + case MNOTE_NIKON_TAG_BRACKETING: + CF2 (entry->format, EXIF_FORMAT_BYTE, EXIF_FORMAT_SHORT, v, maxlen); + CC (entry->components, 1, v, maxlen); + if (EXIF_FORMAT_SHORT == entry->format) { + vs = exif_get_short (entry->data, entry->order); + } else { + vs = entry->data[0]; + } + snprintf (v, maxlen, "%hd", vs); 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); + 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; + case 5: strncpy (v, _("AF Position: Upper-left"), maxlen); break; + case 6: strncpy (v, _("AF Position: Upper-right"), maxlen); break; + case 7: strncpy (v, _("AF Position: Lower-left"), maxlen); break; + case 8: strncpy (v, _("AF Position: Lower-right"), maxlen); break; + case 9: strncpy (v, _("AF Position: Far Left"), maxlen); break; + case 10: strncpy (v, _("AF Position: Far Right"), maxlen); break; + default: strncpy (v, _("Unknown AF Position"), maxlen); } break; + case MNOTE_OLYMPUS_TAG_FLASHDEVICE: + CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen); + CC (entry->components, 2, v, maxlen); + vs = exif_get_short(entry->data, entry->order); + /* search for the tag */ + for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++) + ; + if (!items[i].tag) { + snprintf (v, maxlen, _("Internal error (unknown value %hi)"), vs); + break; + } + CF (entry->format, items[i].fmt, v, maxlen); + /* 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_OLYMPUS_TAG_DIGIZOOM: if (entry->format == EXIF_FORMAT_RATIONAL) { CC (entry->components, 1, v, maxlen); @@ -304,17 +443,21 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m case MNOTE_NIKON1_TAG_CONVERTER: case MNOTE_OLYMPUS_TAG_QUALITY: case MNOTE_OLYMPUS_TAG_MACRO: + case MNOTE_OLYMPUS_TAG_BWMODE: + case MNOTE_OLYMPUS_TAG_ONETOUCHWB: case MNOTE_OLYMPUS_TAG_FLASHMODE: + case MNOTE_OLYMPUS_TAG_FOCUSRANGE: + case MNOTE_OLYMPUS_TAG_MANFOCUS: case MNOTE_OLYMPUS_TAG_SHARPNESS: + case MNOTE_OLYMPUS_TAG_EXTERNALFLASHBOUNCE: 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); + case MNOTE_OLYMPUS_TAG_PREVIEWIMAGEVALID: + case MNOTE_OLYMPUS_TAG_CCDSCANMODE: + case MNOTE_SANYO_TAG_SEQUENTIALSHOT: + case MNOTE_SANYO_TAG_RECORDSHUTTERRELEASE: + case MNOTE_SANYO_TAG_RESAVED: + case MNOTE_SANYO_TAG_SCENESELECT: + case MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL: CC (entry->components, 1, v, maxlen); switch (entry->format) { case EXIF_FORMAT_BYTE: @@ -328,16 +471,48 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m vs = 0; break; } + /* search for the tag */ + for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++) + ; + if (!items[i].tag) { + snprintf (v, maxlen, _("Internal error (unknown value %hi)"), vs); + break; + } + CF (entry->format, items[i].fmt, v, maxlen); /* 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); + snprintf (v, maxlen, _("Unknown value %hi"), vs); + break; + } + strncpy (v, _(items[i].elem[j].string), maxlen); + break; + case MNOTE_OLYMPUS_TAG_NOISEREDUCTION: + case MNOTE_SANYO_TAG_WIDERANGE: + case MNOTE_SANYO_TAG_COLORADJUSTMENTMODE: + case MNOTE_SANYO_TAG_QUICKSHOT: + case MNOTE_SANYO_TAG_SELFTIMER: + case MNOTE_SANYO_TAG_VOICEMEMO: + case MNOTE_SANYO_TAG_FLICKERREDUCE: + case MNOTE_SANYO_TAG_OPTICALZOOM: + case MNOTE_SANYO_TAG_DIGITALZOOM: + case MNOTE_SANYO_TAG_LIGHTSOURCESPECIAL: + CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen); + CC (entry->components, 1, v, maxlen); + vs = exif_get_short (entry->data, entry->order); + switch (vs) { + case 0: + strncpy (v, _("Off"), maxlen); + break; + case 1: + strncpy (v, _("On"), maxlen); + break; + default: + strncpy (v, _("Unknown"), maxlen); 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); @@ -356,17 +531,6 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m 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: @@ -412,37 +576,47 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m 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: + case MNOTE_OLYMPUS_TAG_LENSDISTORTION: CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen); - CC (entry->components, 1, 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); + strncat (v, buf, maxlen - strlen (v)); + } + break; + case MNOTE_OLYMPUS_TAG_COLORCONTROL: + CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen); + CC (entry->components, 6, v, maxlen); + for (i=0; i < (int)entry->components; ++i) { + vs = exif_get_short (entry->data+2*i, entry->order); + sprintf (buf, "%hu ", vs); + strncat (v, buf, maxlen - strlen (v)); + } 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)); + strncpy (v, (char *)entry->data, MIN (maxlen, entry->size)); + break; + case MNOTE_OLYMPUS_TAG_SERIALNUMBER2: + CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen); + strncpy (v, (char *)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)); + CC2 (entry->components, 52, 60, v, maxlen); + strncpy (v, (char *)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)); + strncpy (v, (char *)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); + /* TODO: display me */ break; case MNOTE_OLYMPUS_TAG_FOCUSDIST: CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); @@ -493,7 +667,7 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m break; } if (colorTemp) { - snprintf (v, maxlen, "Manual: %liK", colorTemp); + snprintf (v, maxlen, _("Manual: %liK"), colorTemp); } else { strncpy (v, _("Manual: Unknown"), maxlen); @@ -509,24 +683,75 @@ mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int m break; } break; + case MNOTE_OLYMPUS_TAG_REDBALANCE: + case MNOTE_OLYMPUS_TAG_BLUEBALANCE: + CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen); + CC (entry->components, 2, v, maxlen); + vs = exif_get_short (entry->data, entry->order); + snprintf (v, maxlen, "%hu ", vs); + vs = exif_get_short (entry->data + 2, entry->order); + sprintf (buf, "%hu", vs); + strncat (v, buf, maxlen - strlen (v)); + break; + case MNOTE_OLYMPUS_TAG_BLACKLEVEL: + case MNOTE_NIKON_TAG_IMAGEBOUNDARY: + CC (entry->components, 4, v, maxlen); + /* Fall through to COLORMATRIX */ + case MNOTE_OLYMPUS_TAG_COLORMATRIX: + CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen); + if (entry->tag == MNOTE_OLYMPUS_TAG_COLORMATRIX) + CC (entry->components, 9, v, maxlen); + for (i=0; i < (int)entry->components; ++i) { + vs = exif_get_short (entry->data+2*i, entry->order); + sprintf (buf, "%hu ", vs); + strncat (v, buf, maxlen - strlen (v)); + } + break; + case MNOTE_NIKON1_TAG_FOCUS: + case MNOTE_NIKON_TAG_DIGITALZOOM: + case MNOTE_NIKON1_TAG_DIGITALZOOM: + case MNOTE_OLYMPUS_TAG_FOCALPLANEDIAGONAL: + CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); + /* Fall through to default handler for display */ default: switch (entry->format) { case EXIF_FORMAT_ASCII: - strncpy (v, entry->data, - MIN (maxlen, entry->components)); + strncpy (v, (char *)entry->data, MIN (maxlen, entry->size)); break; case EXIF_FORMAT_SHORT: + CC (entry->components, 1, v, maxlen); vs = exif_get_short (entry->data, entry->order); - snprintf (v, maxlen, "%hi", vs); + snprintf (v, maxlen, "%hu", vs); break; case EXIF_FORMAT_LONG: + CC (entry->components, 1, v, maxlen); vl = exif_get_long (entry->data, entry->order); snprintf (v, maxlen, "%li", (long int) vl); break; + case EXIF_FORMAT_RATIONAL: + 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.3f", r); + } + break; + case EXIF_FORMAT_SRATIONAL: + CC (entry->components, 1, v, maxlen); + vsr = exif_get_srational (entry->data, entry->order); + if (!vsr.denominator) { + strncpy (v, _("Infinite"), maxlen); + } else { + r = (double)vsr.numerator / vsr.denominator; + snprintf (v, maxlen, "%2.3f", r); + } + break; case EXIF_FORMAT_UNDEFINED: default: - snprintf (v, maxlen, _("%li bytes unknown data: "), - (long int) entry->size); + snprintf (v, maxlen, _("%i bytes unknown data: "), + entry->size); for (i = 0; i < (int)entry->size; i++) { sprintf (buf, "%02x", entry->data[i]); strncat (v, buf, maxlen - strlen (v)); |