38 #define M_PI 3.14159265358979323846
51 #ifndef NO_VERBOSE_TAG_STRINGS
65 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
66 #define exif_entry_log(...) do { } while (0)
67 #elif defined(__GNUC__)
68 #define exif_entry_log(x...) do { } while (0)
70 #define exif_entry_log (void)
80 if (!e || !e->
priv || !i)
return NULL;
97 if (!e || !e->
priv)
return NULL;
207 unsigned int i, newsize;
208 unsigned char *newdata;
213 if (!e || !e->
priv)
return;
243 _(
"Tag '%s' was of format '%s' (which is "
244 "against specification) and has been "
245 "changed to format '%s'."),
256 "Could not allocate %lu byte(s).", (
unsigned long)newsize);
280 _(
"Tag '%s' is of format '%s' (which is "
281 "against specification) but cannot be changed "
312 _(
"Tag '%s' was of format '%s' (which is "
313 "against specification) and has been "
314 "changed to format '%s'."),
345 _(
"Tag '%s' was of format '%s' (which is "
346 "against specification) and has been "
347 "changed to format '%s'."),
363 _(
"Tag 'UserComment' had invalid format '%s'. "
364 "Format has been set to 'undefined'."),
371 if ((e->
size >= 8) && (e->
data[0] == 0)) {
372 memcpy(e->
data,
"\0\0\0\0\0\0\0\0", 8);
385 memcpy (e->
data,
"ASCII\0\0\0", 8);
389 _(
"Tag 'UserComment' has been expanded to at "
390 "least 8 bytes in order to follow the "
400 for (i = 0; (i < e->
size) && !e->
data[i]; i++);
401 if (!i)
for ( ; (i < e->
size) && (e->
data[i] ==
' '); i++);
402 if ((i >= 8) && (i < e->
size)) {
404 _(
"Tag 'UserComment' is not empty but does not "
405 "start with a format identifier. "
406 "This has been fixed."));
407 memcpy (e->
data,
"ASCII\0\0\0", 8);
415 if (memcmp (e->
data,
"ASCII\0\0\0" , 8) &&
416 memcmp (e->
data,
"UNICODE\0" , 8) &&
417 memcmp (e->
data,
"JIS\0\0\0\0\0" , 8) &&
418 memcmp (e->
data,
"\0\0\0\0\0\0\0\0", 8)) {
427 memcpy (e->
data,
"ASCII\0\0\0", 8);
431 _(
"Tag 'UserComment' did not start with a "
432 "format identifier. This has been fixed."));
464 if (!e->
size || !maxlen)
468 snprintf (val, maxlen,
_(
"%i bytes undefined data"), e->
size);
473 snprintf (val, maxlen,
"0x%02x", v_byte);
477 snprintf (val+len, maxlen-len,
", 0x%02x", v_byte);
478 len += strlen (val+len);
479 if (len >= maxlen-1)
break;
484 snprintf (val, maxlen,
"%u", v_short);
489 snprintf (val+len, maxlen-len,
", %u", v_short);
490 len += strlen (val+len);
491 if (len >= maxlen-1)
break;
496 snprintf (val, maxlen,
"%i", v_sshort);
502 snprintf (val+len, maxlen-len,
", %i", v_sshort);
503 len += strlen (val+len);
504 if (len >= maxlen-1)
break;
509 snprintf (val, maxlen,
"%lu", (
unsigned long) v_long);
515 snprintf (val+len, maxlen-len,
", %lu", (
unsigned long) v_long);
516 len += strlen (val+len);
517 if (len >= maxlen-1)
break;
522 snprintf (val, maxlen,
"%li", (
long) v_slong);
527 snprintf (val+len, maxlen-len,
", %li", (
long) v_slong);
528 len += strlen (val+len);
529 if (len >= maxlen-1)
break;
533 strncpy (val, (
char *) e->
data,
MIN (maxlen-1, e->
size));
534 val[
MIN (maxlen-1, e->
size)] = 0;
540 snprintf (val+len, maxlen-len,
", ");
541 len += strlen (val+len);
552 int decimals = (int)(log10(v_rat.
denominator)-0.08+1.0);
553 snprintf (val+len, maxlen-len,
"%2.*f",
558 snprintf (val+len, maxlen-len,
"%lu/%lu",
561 len += strlen (val+len);
562 if (len >= maxlen-1)
break;
569 snprintf (val+len, maxlen-len,
", ");
570 len += strlen (val+len);
575 int decimals = (int)(log10(abs(v_srat.
denominator))-0.08+1.0);
576 snprintf (val+len, maxlen-len,
"%2.*f",
581 snprintf (val+len, maxlen-len,
"%li/%li",
584 len += strlen (val+len);
585 if (len >= maxlen-1)
break;
591 snprintf (val, maxlen,
_(
"%i bytes unsupported data type"),
607 l =
MIN(
sizeof(buf)-1, 2*indent);
611 printf (
"%sTag: 0x%x ('%s')\n", buf, e->
tag,
613 printf (
"%s Format: %i ('%s')\n", buf, e->
format,
615 printf (
"%s Components: %i\n", buf, (
int) e->
components);
616 printf (
"%s Size: %i\n", buf, e->
size);
633 for (i=n; i; --i, ++data) {
644 #define CF(entry,target,v,maxlen) \
646 if (entry->format != target) { \
647 exif_entry_log (entry, EXIF_LOG_CODE_CORRUPT_DATA, \
648 _("The tag '%s' contains data of an invalid " \
649 "format ('%s', expected '%s')."), \
650 exif_tag_get_name (entry->tag), \
651 exif_format_get_name (entry->format), \
652 exif_format_get_name (target)); \
657 #define CC(entry,target,v,maxlen) \
659 if (entry->components != target) { \
660 exif_entry_log (entry, EXIF_LOG_CODE_CORRUPT_DATA, \
661 _("The tag '%s' contains an invalid number of " \
662 "components (%i, expected %i)."), \
663 exif_tag_get_name (entry->tag), \
664 (int) entry->components, (int) target); \
669 static const struct {
673 #ifndef NO_VERBOSE_TAG_DATA
675 {
N_(
"Chunky format"),
N_(
"Planar format"), NULL}},
677 {
"",
N_(
"Not defined"),
N_(
"One-chip color area sensor"),
678 N_(
"Two-chip color area sensor"),
N_(
"Three-chip color area sensor"),
679 N_(
"Color sequential area sensor"),
"",
N_(
"Trilinear sensor"),
680 N_(
"Color sequential linear sensor"), NULL}},
682 {
"",
N_(
"Top-left"),
N_(
"Top-right"),
N_(
"Bottom-right"),
683 N_(
"Bottom-left"),
N_(
"Left-top"),
N_(
"Right-top"),
684 N_(
"Right-bottom"),
N_(
"Left-bottom"), NULL}},
686 {
"",
N_(
"Centered"),
N_(
"Co-sited"), NULL}},
688 {
N_(
"Reversed mono"),
N_(
"Normal mono"),
N_(
"RGB"),
N_(
"Palette"),
"",
689 N_(
"CMYK"),
N_(
"YCbCr"),
"",
N_(
"CieLAB"), NULL}},
691 {
N_(
"Normal process"),
N_(
"Custom process"), NULL}},
693 {
N_(
"Auto exposure"),
N_(
"Manual exposure"),
N_(
"Auto bracket"), NULL}},
695 {
N_(
"Auto white balance"),
N_(
"Manual white balance"), NULL}},
697 {
N_(
"Standard"),
N_(
"Landscape"),
N_(
"Portrait"),
698 N_(
"Night scene"), NULL}},
700 {
N_(
"Normal"),
N_(
"Low gain up"),
N_(
"High gain up"),
701 N_(
"Low gain down"),
N_(
"High gain down"), NULL}},
703 {
N_(
"Normal"),
N_(
"Low saturation"),
N_(
"High saturation"), NULL}},
710 static const struct {
719 #ifndef NO_VERBOSE_TAG_DATA
721 { { 0, {
N_(
"Unknown"), NULL}},
722 { 1, {
N_(
"Average"),
N_(
"Avg"), NULL}},
723 { 2, {
N_(
"Center-weighted average"),
N_(
"Center-weight"), NULL}},
724 { 3, {
N_(
"Spot"), NULL}},
725 { 4, {
N_(
"Multi spot"), NULL}},
726 { 5, {
N_(
"Pattern"), NULL}},
727 { 6, {
N_(
"Partial"), NULL}},
728 {255, {
N_(
"Other"), NULL}},
731 { {1, {
N_(
"Uncompressed"), NULL}},
732 {5, {
N_(
"LZW compression"), NULL}},
733 {6, {
N_(
"JPEG compression"), NULL}},
734 {7, {
N_(
"JPEG compression"), NULL}},
735 {8, {
N_(
"Deflate/ZIP compression"), NULL}},
736 {32773, {
N_(
"PackBits compression"), NULL}},
739 { { 0, {
N_(
"Unknown"), NULL}},
740 { 1, {
N_(
"Daylight"), NULL}},
741 { 2, {
N_(
"Fluorescent"), NULL}},
742 { 3, {
N_(
"Tungsten incandescent light"),
N_(
"Tungsten"), NULL}},
743 { 4, {
N_(
"Flash"), NULL}},
744 { 9, {
N_(
"Fine weather"), NULL}},
745 { 10, {
N_(
"Cloudy weather"),
N_(
"Cloudy"), NULL}},
746 { 11, {
N_(
"Shade"), NULL}},
747 { 12, {
N_(
"Daylight fluorescent"), NULL}},
748 { 13, {
N_(
"Day white fluorescent"), NULL}},
749 { 14, {
N_(
"Cool white fluorescent"), NULL}},
750 { 15, {
N_(
"White fluorescent"), NULL}},
751 { 17, {
N_(
"Standard light A"), NULL}},
752 { 18, {
N_(
"Standard light B"), NULL}},
753 { 19, {
N_(
"Standard light C"), NULL}},
754 { 20, {
N_(
"D55"), NULL}},
755 { 21, {
N_(
"D65"), NULL}},
756 { 22, {
N_(
"D75"), NULL}},
757 { 24, {
N_(
"ISO studio tungsten"),NULL}},
758 {255, {
N_(
"Other"), NULL}},
761 { {2, {
N_(
"Inch"),
N_(
"in"), NULL}},
762 {3, {
N_(
"Centimeter"),
N_(
"cm"), NULL}},
765 { {2, {
N_(
"Inch"),
N_(
"in"), NULL}},
766 {3, {
N_(
"Centimeter"),
N_(
"cm"), NULL}},
769 { {0, {
N_(
"Not defined"), NULL}},
770 {1, {
N_(
"Manual"), NULL}},
771 {2, {
N_(
"Normal program"),
N_(
"Normal"), NULL}},
772 {3, {
N_(
"Aperture priority"),
N_(
"Aperture"), NULL}},
773 {4, {
N_(
"Shutter priority"),
N_(
"Shutter"), NULL}},
774 {5, {
N_(
"Creative program (biased toward depth of field)"),
775 N_(
"Creative"), NULL}},
776 {6, {
N_(
"Creative program (biased toward fast shutter speed)"),
777 N_(
"Action"), NULL}},
778 {7, {
N_(
"Portrait mode (for closeup photos with the background out "
779 "of focus)"),
N_(
"Portrait"), NULL}},
780 {8, {
N_(
"Landscape mode (for landscape photos with the background "
781 "in focus)"),
N_(
"Landscape"), NULL}},
784 { {0, {
N_(
"Unknown"), NULL}},
785 {1, {
N_(
"Standard output sensitivity (SOS)"), NULL}},
786 {2, {
N_(
"Recommended exposure index (REI)"), NULL}},
787 {3, {
N_(
"ISO speed"), NULL}},
788 {4, {
N_(
"Standard output sensitivity (SOS) and recommended exposure index (REI)"), NULL}},
789 {5, {
N_(
"Standard output sensitivity (SOS) and ISO speed"), NULL}},
790 {6, {
N_(
"Recommended exposure index (REI) and ISO speed"), NULL}},
791 {7, {
N_(
"Standard output sensitivity (SOS) and recommended exposure index (REI) and ISO speed"), NULL}},
794 { {0x0000, {
N_(
"Flash did not fire"),
N_(
"No flash"), NULL}},
795 {0x0001, {
N_(
"Flash fired"),
N_(
"Flash"),
N_(
"Yes"), NULL}},
796 {0x0005, {
N_(
"Strobe return light not detected"),
N_(
"Without strobe"),
798 {0x0007, {
N_(
"Strobe return light detected"),
N_(
"With strobe"), NULL}},
799 {0x0008, {
N_(
"Flash did not fire"), NULL}},
800 {0x0009, {
N_(
"Flash fired, compulsory flash mode"), NULL}},
801 {0x000d, {
N_(
"Flash fired, compulsory flash mode, return light "
802 "not detected"), NULL}},
803 {0x000f, {
N_(
"Flash fired, compulsory flash mode, return light "
805 {0x0010, {
N_(
"Flash did not fire, compulsory flash mode"), NULL}},
806 {0x0018, {
N_(
"Flash did not fire, auto mode"), NULL}},
807 {0x0019, {
N_(
"Flash fired, auto mode"), NULL}},
808 {0x001d, {
N_(
"Flash fired, auto mode, return light not detected"),
810 {0x001f, {
N_(
"Flash fired, auto mode, return light detected"), NULL}},
811 {0x0020, {
N_(
"No flash function"),NULL}},
812 {0x0041, {
N_(
"Flash fired, red-eye reduction mode"), NULL}},
813 {0x0045, {
N_(
"Flash fired, red-eye reduction mode, return light "
814 "not detected"), NULL}},
815 {0x0047, {
N_(
"Flash fired, red-eye reduction mode, return light "
817 {0x0049, {
N_(
"Flash fired, compulsory flash mode, red-eye reduction "
819 {0x004d, {
N_(
"Flash fired, compulsory flash mode, red-eye reduction "
820 "mode, return light not detected"), NULL}},
821 {0x004f, {
N_(
"Flash fired, compulsory flash mode, red-eye reduction mode, "
822 "return light detected"), NULL}},
823 {0x0058, {
N_(
"Flash did not fire, auto mode, red-eye reduction mode"), NULL}},
824 {0x0059, {
N_(
"Flash fired, auto mode, red-eye reduction mode"), NULL}},
825 {0x005d, {
N_(
"Flash fired, auto mode, return light not detected, "
826 "red-eye reduction mode"), NULL}},
827 {0x005f, {
N_(
"Flash fired, auto mode, return light detected, "
828 "red-eye reduction mode"), NULL}},
831 { {0, {
N_(
"Unknown"),
N_(
"?"), NULL}},
832 {1, {
N_(
"Macro"), NULL}},
833 {2, {
N_(
"Close view"),
N_(
"Close"), NULL}},
834 {3, {
N_(
"Distant view"),
N_(
"Distant"), NULL}},
837 { {1, {
N_(
"sRGB"), NULL}},
838 {2, {
N_(
"Adobe RGB"), NULL}},
839 {0xffff, {
N_(
"Uncalibrated"), NULL}},
842 {0, { { 0, {NULL}}} }
848 unsigned int i, j, k;
849 ExifShort v_short, v_short2, v_short3, v_short4;
858 static const struct {
882 memset (val, 0, maxlen);
889 snprintf (val, maxlen,
_(
"Invalid size of entry (%i, "
906 ( memcmp (e->
data,
"ASCII\0\0\0" , 8) &&
907 memcmp (e->
data,
"UNICODE\0" , 8) &&
908 memcmp (e->
data,
"JIS\0\0\0\0\0", 8) &&
909 memcmp (e->
data,
"\0\0\0\0\0\0\0\0", 8)))
917 if ((e->
size >= 8) && !memcmp (e->
data,
"ASCII\0\0\0", 8)) {
918 strncpy (val, (
char *) e->
data + 8,
MIN (e->
size - 8, maxlen-1));
921 if ((e->
size >= 8) && !memcmp (e->
data,
"UNICODE\0", 8)) {
922 strncpy (val,
_(
"Unsupported UNICODE string"), maxlen-1);
929 if ((e->
size >= 8) && !memcmp (e->
data,
"JIS\0\0\0\0\0", 8)) {
930 strncpy (val,
_(
"Unsupported JIS string"), maxlen-1);
936 for (i = 0; (i < e->
size) &&
937 (!e->
data[i] || (e->
data[i] ==
' ')); i++);
938 if (i == e->
size)
break;
947 _(
"Tag UserComment contains data but is "
948 "against specification."));
949 for (j = 0; (i < e->
size) && (j < maxlen-1); i++, j++) {
951 _(
"Byte at position %i: 0x%02x"), i, e->
data[i]);
952 val[j] = isprint (e->
data[i]) ? e->
data[i] :
'.';
958 CC (e, 4, val, maxlen);
959 strncpy (val,
_(
"Unknown Exif Version"), maxlen-1);
960 for (i = 0; *versions[i].label; i++) {
961 if (!memcmp (e->
data, versions[i].label, 4)) {
962 snprintf (val, maxlen,
963 _(
"Exif Version %d.%d"),
972 CC (e, 4, val, maxlen);
973 if (!memcmp (e->
data,
"0100", 4))
974 strncpy (val,
_(
"FlashPix Version 1.0"), maxlen-1);
975 else if (!memcmp (e->
data,
"0101", 4))
976 strncpy (val,
_(
"FlashPix Version 1.01"), maxlen-1);
978 strncpy (val,
_(
"Unknown FlashPix Version"), maxlen-1);
989 strncpy (val, (
char *) e->
data,
MIN (maxlen-1, e->
size));
991 strncpy (val,
_(
"[None]"), maxlen-1);
992 strncat (val,
" ", maxlen-1 - strlen (val));
993 strncat (val,
_(
"(Photographer)"), maxlen-1 - strlen (val));
996 strncat (val,
" - ", maxlen-1 - strlen (val));
999 const unsigned char *tagdata = memchr(e->
data, 0, e->
size);
1001 unsigned int editor_ofs = tagdata - e->
data;
1002 unsigned int remaining = e->
size - editor_ofs;
1004 strncat (val, (
const char*)tagdata,
MIN (maxlen-1 - strlen (val), remaining));
1010 strncat (val,
_(
"[None]"), maxlen-1 - strlen (val));
1011 strncat (val,
" ", maxlen-1 - strlen (val));
1012 strncat (val,
_(
"(Editor)"), maxlen-1 - strlen (val));
1017 CC (e, 1, val, maxlen);
1024 snprintf (val, maxlen,
"f/%.01f", d);
1029 CC (e, 1, val, maxlen);
1036 snprintf (val, maxlen,
_(
"%.02f EV"), d);
1037 snprintf (b,
sizeof (b),
_(
" (f/%.01f)"), pow (2, d / 2.));
1038 strncat (val, b, maxlen-1 - strlen (val));
1042 CC (e, 1, val, maxlen);
1057 if (entry && entry->
data && entry->
size >= 7 &&
1058 !strncmp ((
char *)entry->
data,
"Minolta", 7)) {
1062 if (entry && entry->
data && entry->
size >= 8) {
1063 if (!strncmp ((
char *)entry->
data,
"DiMAGE 7", 8))
1065 else if (!strncmp ((
char *)entry->
data,
"DiMAGE 5", 8))
1070 snprintf (b,
sizeof (b),
_(
" (35 equivalent: %.0f mm)"),
1077 snprintf (val, maxlen,
"%.1f mm", d);
1078 strncat (val, b, maxlen-1 - strlen (val));
1082 CC (e, 1, val, maxlen);
1089 snprintf (val, maxlen,
"%.1f m", d);
1093 CC (e, 1, val, maxlen);
1101 snprintf (val, maxlen,
_(
"1/%.0f"), 1. / d);
1103 snprintf (val, maxlen,
"%.0f", d);
1104 strncat (val,
_(
" sec."), maxlen-1 - strlen (val));
1108 CC (e, 1, val, maxlen);
1115 snprintf (val, maxlen,
_(
"%.02f EV"), d);
1117 d = 1. / pow (2, d);
1119 snprintf (b,
sizeof (b),
_(
" (1/%.0f sec.)"), 1. / d);
1121 snprintf (b,
sizeof (b),
_(
" (%.0f sec.)"), d);
1122 strncat (val, b, maxlen-1 - strlen (val));
1126 CC (e, 1, val, maxlen);
1133 snprintf (val, maxlen,
_(
"%.02f EV"), d);
1134 snprintf (b,
sizeof (b),
_(
" (%.02f cd/m^2)"),
1135 1. / (
M_PI * 0.3048 * 0.3048) * pow (2, d));
1136 strncat (val, b, maxlen-1 - strlen (val));
1140 CC (e, 1, val, maxlen);
1141 v_byte = e->
data[0];
1143 strncpy (val,
_(
"DSC"), maxlen-1);
1145 snprintf (val, maxlen,
_(
"Internal error (unknown "
1146 "value %i)"), v_byte);
1150 CC (e, 4, val, maxlen);
1151 for (i = 0; i < 4; i++) {
1152 switch (e->
data[i]) {
1153 case 0: c =
_(
"-");
break;
1154 case 1: c =
_(
"Y");
break;
1155 case 2: c =
_(
"Cb");
break;
1156 case 3: c =
_(
"Cr");
break;
1157 case 4: c =
_(
"R");
break;
1158 case 5: c =
_(
"G");
break;
1159 case 6: c =
_(
"B");
break;
1160 default: c =
_(
"Reserved");
break;
1162 strncat (val, c, maxlen-1 - strlen (val));
1164 strncat (val,
" ", maxlen-1 - strlen (val));
1169 CC (e, 1, val, maxlen);
1176 snprintf (val, maxlen,
_(
"%.02f EV"), d);
1180 CC (e, 1, val, maxlen);
1181 v_byte = e->
data[0];
1183 strncpy (val,
_(
"Directly photographed"), maxlen-1);
1185 snprintf (val, maxlen,
_(
"Internal error (unknown "
1186 "value %i)"), v_byte);
1190 CC (e, 2, val, maxlen);
1195 if ((v_short == 2) && (v_short2 == 1))
1196 strncpy (val,
_(
"YCbCr4:2:2"), maxlen-1);
1197 else if ((v_short == 2) && (v_short2 == 2))
1198 strncpy (val,
_(
"YCbCr4:2:0"), maxlen-1);
1200 snprintf (val, maxlen,
"%u, %u", v_short, v_short2);
1208 snprintf (val, maxlen,
"(x,y) = (%i,%i)",
1215 snprintf (val, maxlen,
_(
"Within distance %i of "
1216 "(x,y) = (%i,%i)"), v_short3, v_short,
1224 snprintf (val, maxlen,
_(
"Within rectangle "
1225 "(width %i, height %i) around "
1226 "(x,y) = (%i,%i)"), v_short3, v_short4,
1230 snprintf (val, maxlen,
_(
"Unexpected number "
1231 "of components (%li, expected 2, 3, or 4)."),
1238 CC (e, 4, val, maxlen);
1239 v_byte = e->
data[0];
1240 snprintf (val, maxlen,
"%u", v_byte);
1242 v_byte = e->
data[i];
1243 snprintf (b,
sizeof (b),
".%u", v_byte);
1244 strncat (val, b, maxlen-1 - strlen (val));
1251 strncpy (val, (
char *) e->
data,
MIN (maxlen-1, e->
size));
1262 CC (e, 1, val, maxlen);
1263 v_byte = e->
data[0];
1265 strncpy (val,
_(
"Sea level"), maxlen-1);
1266 else if (v_byte == 1)
1267 strncpy (val,
_(
"Sea level reference"), maxlen-1);
1269 snprintf (val, maxlen,
_(
"Internal error (unknown "
1270 "value %i)"), v_byte);
1275 CC (e, 3, val, maxlen);
1301 snprintf (val, maxlen,
"%02u:%02u:%05.2f", i, j, d);
1315 CC (e, 1, val, maxlen);
1321 snprintf (val, maxlen,
_(
"Internal error (unknown "
1322 "value %i)"), v_short);
1327 for (j = 0;
list2[i].elem[j].values[0] &&
1328 (
list2[i].elem[j].index < v_short); j++);
1330 snprintf (val, maxlen,
_(
"Internal error (unknown "
1331 "value %i)"), v_short);
1336 memset (val, 0, maxlen);
1337 for (k = 0;
list2[i].elem[j].values[k]; k++) {
1339 if ((maxlen > l) && (strlen (val) < l))
1342 if (!val[0]) snprintf (val, maxlen,
"%i", v_short);
1360 CC (e, 1, val, maxlen);
1364 for (i = 0;
list[i].tag && (
list[i].tag != e->
tag); i++);
1366 snprintf (val, maxlen,
_(
"Internal error (unknown "
1367 "value %i)"), v_short);
1372 for (j = 0;
list[i].strings[j] && (j < v_short); j++);
1374 snprintf (val, maxlen,
"%i", v_short);
1376 snprintf (val, maxlen,
_(
"Unknown value %i"), v_short);
1387 unsigned char *utf16;
1390 if (e->
size >= 65536 -
sizeof(uint16_t)*2)
break;
1403 utf16[e->
size+1] = 0;
1404 utf16[e->
size+2] = 0;
1443 e->
size = allocSize;
1685 #if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
1691 #ifdef HAVE_LOCALTIME_R
1692 tm = localtime_r (&t, &tms);
1693 #elif defined(HAVE_LOCALTIME_S)
1694 localtime_s (&tms, &t);
1697 tm = localtime (&t);
1704 snprintf ((
char *) e->
data, e->
size,
1705 "%04i:%02i:%02i %02i:%02i:%02i",
1706 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
1707 tm->tm_hour, tm->tm_min, tm->tm_sec);
1732 strncpy ((
char *)e->
data,
_(
"[None]"), e->
size);
1741 strcpy (((
char *)e->
data) + 0,
_(
"[None]"));
1742 strcpy (((
char *)e->
data) + strlen (
_(
"[None]")) + 1,
_(
"[None]"));
1772 memcpy (e->
data,
"0100", 4);
1782 memcpy (e->
data,
"0210", 4);
ExifByteOrder
Which byte order to use.
ExifEntry * exif_content_get_entry(ExifContent *content, ExifTag tag)
Return the ExifEntry in this IFD corresponding to the given tag.
ExifByteOrder exif_data_get_byte_order(ExifData *data)
Return the byte order in use by this EXIF structure.
static void clear_entry(ExifEntry *e)
static const struct @4 list[]
void exif_entry_free(ExifEntry *e)
Actually free the ExifEntry.
const char * values[4]
list of progressively shorter string descriptions; the longest one that fits will be selected
#define CC(entry, target, v, maxlen)
ExifEntry * exif_entry_new_mem(ExifMem *mem)
Reserve memory for and initialize new ExifEntry using the specified memory allocator.
ExifEntry * exif_entry_new(void)
Reserve memory for and initialize a new ExifEntry.
void exif_entry_unref(ExifEntry *e)
Decrease reference counter for ExifEntry.
#define CF(entry, target, v, maxlen)
static const struct @5 list2[]
static void * exif_entry_alloc(ExifEntry *e, unsigned int i)
void exif_entry_fix(ExifEntry *e)
Fix the type or format of the given EXIF entry to bring it into spec.
static void * exif_entry_realloc(ExifEntry *e, void *d_orig, unsigned int i)
static void exif_entry_log(ExifEntry *e, ExifLogCode code, const char *format,...)
static int match_repeated_char(const unsigned char *data, unsigned char ch, size_t n)
Check if a string consists entirely of a single, repeated character.
ExifLog * exif_data_get_log(ExifData *)
void exif_entry_initialize(ExifEntry *e, ExifTag tag)
Initialize an empty ExifEntry with default data in the correct format for the given tag.
void exif_entry_dump(ExifEntry *e, unsigned int indent)
Dump text representation of ExifEntry to stdout.
static void exif_entry_format_value(ExifEntry *e, char *val, size_t maxlen)
Format the value of an ExifEntry for human display in a generic way.
static void exif_entry_initialize_gps(ExifEntry *e, ExifTag tag)
void exif_entry_ref(ExifEntry *e)
Increase reference counter for ExifEntry.
const char * exif_entry_get_value(ExifEntry *e, char *val, unsigned int maxlen)
Return a localized textual representation of the value of the EXIF entry.
static ExifShort exif_get_short_convert(const unsigned char *buf, ExifFormat format, ExifByteOrder order)
Get a value and convert it to an ExifShort.
#define exif_entry_get_ifd(e)
Return the IFD number of the given ExifEntry.
const ExifGPSIfdTagInfo * exif_get_gps_tag_info(ExifTag tag)
void exif_logv(ExifLog *log, ExifLogCode code, const char *domain, const char *format, va_list args)
@ EXIF_LOG_CODE_NO_MEMORY
@ EXIF_LOG_CODE_CORRUPT_DATA
#define EXIF_LOG_NO_MEMORY(l, d, s)
void * exif_mem_realloc(ExifMem *mem, void *d, ExifLong ds)
void exif_mem_free(ExifMem *mem, void *d)
void exif_mem_unref(ExifMem *mem)
Unrefcount an ExifMem.
ExifMem * exif_mem_new_default(void)
Create a new ExifMem with default values for your convenience.
void * exif_mem_alloc(ExifMem *mem, ExifLong ds)
void exif_mem_ref(ExifMem *mem)
Refcount an ExifMem.
const char * exif_tag_get_name_in_ifd(ExifTag tag, ExifIfd ifd)
Return a textual name of the given tag when found in the given IFD.
@ EXIF_TAG_DATE_TIME_ORIGINAL
@ EXIF_TAG_SUBJECT_LOCATION
@ EXIF_TAG_ISO_SPEED_RATINGS
@ EXIF_TAG_EXIF_IFD_POINTER
@ EXIF_TAG_INTEROPERABILITY_VERSION
@ EXIF_TAG_MAX_APERTURE_VALUE
@ EXIF_TAG_PLANAR_CONFIGURATION
@ EXIF_TAG_RESOLUTION_UNIT
@ EXIF_TAG_BITS_PER_SAMPLE
@ EXIF_TAG_SUBJECT_DISTANCE
@ EXIF_TAG_GPS_INFO_IFD_POINTER
@ EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT
@ EXIF_TAG_APERTURE_VALUE
@ EXIF_TAG_IMAGE_DESCRIPTION
@ EXIF_TAG_INTEROPERABILITY_IFD_POINTER
@ EXIF_TAG_FLASH_PIX_VERSION
@ EXIF_TAG_DIGITAL_ZOOM_RATIO
@ EXIF_TAG_JPEG_INTERCHANGE_FORMAT
@ EXIF_TAG_COMPONENTS_CONFIGURATION
@ EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH
@ EXIF_TAG_SHUTTER_SPEED_VALUE
@ EXIF_TAG_PIXEL_Y_DIMENSION
@ EXIF_TAG_PIXEL_X_DIMENSION
@ EXIF_TAG_YCBCR_POSITIONING
@ EXIF_TAG_EXPOSURE_PROGRAM
@ EXIF_TAG_PHOTOMETRIC_INTERPRETATION
@ EXIF_TAG_EXPOSURE_INDEX
@ EXIF_TAG_YCBCR_SUB_SAMPLING
@ EXIF_TAG_SCENE_CAPTURE_TYPE
@ EXIF_TAG_SAMPLES_PER_PIXEL
@ EXIF_TAG_EXPOSURE_BIAS_VALUE
@ EXIF_TAG_SENSITIVITY_TYPE
@ EXIF_TAG_SUBJECT_DISTANCE_RANGE
@ EXIF_TAG_CUSTOM_RENDERED
@ EXIF_TAG_REFERENCE_BLACK_WHITE
@ EXIF_TAG_DATE_TIME_DIGITIZED
@ EXIF_TAG_BRIGHTNESS_VALUE
@ EXIF_TAG_SENSING_METHOD
@ EXIF_TAG_SUB_SEC_TIME_DIGITIZED
@ EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM
@ EXIF_TAG_FOCAL_PLANE_X_RESOLUTION
@ EXIF_TAG_COMPRESSED_BITS_PER_PIXEL
@ EXIF_TAG_SUB_SEC_TIME_ORIGINAL
@ EXIF_TAG_PRIMARY_CHROMATICITIES
@ EXIF_TAG_FOCAL_PLANE_Y_RESOLUTION
#define EXIF_TAG_GPS_TIME_STAMP
#define EXIF_TAG_GPS_VERSION_ID
#define EXIF_TAG_GPS_ALTITUDE_REF
ExifRational exif_get_rational(const unsigned char *buf, ExifByteOrder order)
Retrieve an ExifRational value from memory.
void exif_set_rational(unsigned char *buf, ExifByteOrder order, ExifRational value)
Store an ExifRational value into memory in EXIF format.
ExifLong exif_get_long(const unsigned char *buf, ExifByteOrder order)
Retrieve an ExifLong value from memory.
ExifShort exif_get_short(const unsigned char *buf, ExifByteOrder order)
Retrieve an ExifShort value from memory.
ExifSLong exif_get_slong(const unsigned char *b, ExifByteOrder order)
Retrieve an ExifSLong value from memory.
ExifSShort exif_get_sshort(const unsigned char *buf, ExifByteOrder order)
Retrieve an ExifSShort value from memory.
void exif_set_srational(unsigned char *buf, ExifByteOrder order, ExifSRational value)
Store an ExifSRational value into memory in EXIF format.
void exif_set_short(unsigned char *b, ExifByteOrder order, ExifShort value)
Store an ExifShort value into memory in EXIF format.
ExifSRational exif_get_srational(const unsigned char *buf, ExifByteOrder order)
Retrieve an ExifSRational value from memory.
void exif_convert_utf16_to_utf8(char *out, const unsigned char *in, int maxlen)
This function converts rather UCS-2LE than UTF-16 to UTF-8.
EXIF data manipulation functions and types.
unsigned char ExifByte
EXIF Unsigned Byte data type.
uint32_t ExifLong
EXIF Unsigned Long data type.
int32_t ExifSLong
EXIF Signed Long data type.
uint16_t ExifShort
EXIF Unsigned Short data type.
int16_t ExifSShort
EXIF Signed Short data type.
#define bindtextdomain(Domain, Directory)
const char * default_value
EXIF Unsigned Rational data type.
EXIF Signed Rational data type.
ExifData * parent
Data containing this content.
Represents the entire EXIF data found in an image.
ExifContent * ifd[EXIF_IFD_COUNT]
Data for each IFD.
Data found in one EXIF tag.
unsigned long components
Number of elements in the array, if this is an array entry.
ExifFormat format
Type of data in this entry.
ExifContent * parent
ExifContent containing this entry.
unsigned char * data
Pointer to the raw EXIF data for this entry.
ExifTag tag
EXIF tag for this entry.
ExifEntryPrivate * priv
Internal data to be used by libexif itself.
unsigned int size
Number of bytes in the buffer at data.