annotate src/format_nikon.c @ 51:276ea4c98d33

Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net> * exif.[ch]: Use glib provided data types and byte order functions for consistency with rest of application. Made several more functions available in the header. Use MakerNote parsing from format_raw.c. * format_canon.[ch]: Changes to match exif.h and format_raw.h. * format_fuji.[ch]: Add support for Fuji EXIF MakerNote. * format_nikon.[ch]: New files, add support for Nikon EXIF MakerNote. * format_raw.[ch]: Add EXIF MakerNote parser functions to gather all camera formats here (similar to existing raw format list). * src/Makefile.am: Add format_nikon.[ch]. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Sun, 05 Jun 2005 02:48:54 +0000
parents
children 00843150f7c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
1 /*
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
2 * GQView
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
3 * (C) 2005 John Ellis
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
4 *
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
5 * This software is released under the GNU General Public License (GNU GPL).
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
6 * Please read the included file COPYING for more information.
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
7 * This software comes with no warranty of any kind, use at your own risk!
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
8 */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
9
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
10 #ifdef HAVE_CONFIG_H
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
11 # include "config.h"
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
12 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
13
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
14
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
15 #include <stdio.h>
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
16 #include <string.h>
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
17 #include <unistd.h>
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
18
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
19 #include <glib.h>
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
20
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
21 #include "intl.h"
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
22
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
23 #include "format_nikon.h"
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
24
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
25 #include "exif.h"
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
26
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
27
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
28 /*
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
29 *-----------------------------------------------------------------------------
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
30 * EXIF Makernote for Nikon
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
31 *-----------------------------------------------------------------------------
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
32 */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
33
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
34 static ExifTextList NikonTagQuality[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
35 { 1, "VGA basic" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
36 { 2, "VGA normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
37 { 3, "VGA fine" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
38 { 4, "SXGA basic" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
39 { 5, "SXGA normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
40 { 6, "SXGA fine" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
41 { 7, "XGA basic (?)" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
42 { 8, "XGA normal (?)" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
43 { 9, "XGA fine (?)" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
44 { 10, "UXGA basic" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
45 { 11, "UXGA normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
46 { 12, "UXGA fine" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
47 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
48 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
49
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
50 static ExifTextList NikonTagColorMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
51 { 1, "color" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
52 { 2, "monochrome" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
53 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
54 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
55
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
56 static ExifTextList NikonTagImgAdjust[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
57 { 0, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
58 { 1, "bright+" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
59 { 2, "bright-" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
60 { 3, "contrast+" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
61 { 4, "contrast-" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
62 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
63 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
64
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
65 static ExifTextList NikonTagISOSensitivity[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
66 { 0, "80" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
67 { 2, "160" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
68 { 4, "320" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
69 { 5, "100" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
70 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
71 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
72
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
73 static ExifTextList NikonTagWhiteBalance[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
74 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
75 { 1, "preset" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
76 { 2, "daylight" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
77 { 3, "incandescent" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
78 { 4, "fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
79 { 5, "cloudy" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
80 { 6, "speedlight" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
81 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
82 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
83
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
84 static ExifTextList NikonTagConverter[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
85 { 0, "none" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
86 { 1, "Fisheye" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
87 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
88 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
89
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
90 #if 0
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
91 static ExifTextList NikonTag[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
92 { , "" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
93 { , "" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
94 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
95 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
96 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
97
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
98 static ExifMarker NikonExifMarkersList1[] = {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
99 { 0x0002, EXIF_FORMAT_STRING, 6, "MkN.Nikon.unknown", NULL, NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
100 { 0x0003, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.Quality", "Quality", NikonTagQuality },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
101 { 0x0004, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ColorMode", "Color mode", NikonTagColorMode },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
102 { 0x0005, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ImageAdjustment",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
103 "Image adjustment", NikonTagImgAdjust },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
104 { 0x0006, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ISOSensitivity",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
105 "ISO sensitivity", NikonTagISOSensitivity },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
106 { 0x0007, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.WhiteBalance",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
107 "White balance", NikonTagWhiteBalance },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
108 { 0x0008, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "MkN.Nikon.Focus", "Focus", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
109 { 0x000a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "MkN.Nikon.DigitalZoom","Digital zoom", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
110 { 0x000b, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.Converter", "Converter", NikonTagConverter },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
111 EXIF_MARKER_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
112 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
113
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
114 static ExifTextList NikonTag2FlashComp[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
115 { 0x06, "+1.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
116 { 0x04, "+0.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
117 { 0x03, "+0.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
118 { 0x02, "+0.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
119 { 0x00, "0.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
120 { 0xfe, "-0.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
121 { 0xfd, "-0.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
122 { 0xfc, "-0.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
123 { 0xfa, "-1.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
124 { 0xf8, "-1.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
125 { 0xf7, "-1.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
126 { 0xf6, "-1.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
127 { 0xf4, "-2.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
128 { 0xf2, "-2.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
129 { 0xf1, "-2.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
130 { 0xf0, "-2.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
131 { 0xee, "-3.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
132 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
133 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
134
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
135 static ExifTextList NikonTag2FlashUsed[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
136 { 0, "no" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
137 { 9, "yes" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
138 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
139 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
140
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
141 #if 0
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
142 static ExifTextList NikonTagi2Saturation[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
143 { -3, "black and white" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
144 { -2, "-2" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
145 { -1, "-1" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
146 { 0, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
147 { 1, "+1" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
148 { 2, "+2" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
149 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
150 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
151 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
152
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
153 static ExifMarker NikonExifMarkersList2[] = {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
154 { 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 2, "MkN.Nikon.ISOSpeed", "ISO speed", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
155 { 0x0003, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ColorMode", "Color mode", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
156 { 0x0004, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Quality", "Quality", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
157 { 0x0005, EXIF_FORMAT_STRING, -1, "MkN.Nikon.WhiteBalance",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
158 "White balance", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
159 { 0x0006, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Sharpening", "Sharpening", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
160 { 0x0007, EXIF_FORMAT_STRING, -1, "MkN.Nikon.FocusMode", "Focus mode", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
161 { 0x0008, EXIF_FORMAT_STRING, -1, "MkN.Nikon.FlashSetting",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
162 "Flash setting", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
163 { 0x0009, EXIF_FORMAT_STRING, -1, "MkN.Nikon.AutoFlashMode","Auto flash mode",NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
164 { 0x000b, EXIF_FORMAT_SHORT, 1, "MkN.Nikon.WhiteBalanceBias",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
165 "White balance bias value", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
166 /* { 0x000c, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.WhiteBalanceCoeff",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
167 "White balance red/blue coefficents", NULL }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
168 /* { 0x000f, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ISOSelect", "ISO selection",NULL }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
169 { 0x0012, EXIF_FORMAT_UNDEFINED, 4, "MkN.Nikon.FlashCompensation",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
170 "Flash compensation", NikonTag2FlashComp },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
171 { 0x0013, EXIF_FORMAT_SHORT_UNSIGNED, 2, "MkN.Nikon.ISOSpeedRequest",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
172 "ISO speed requested", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
173 { 0x0016, EXIF_FORMAT_SHORT_UNSIGNED, 4, "MkN.Nikon.CornerCoord",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
174 "Corner coordinates", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
175 { 0x0018, EXIF_FORMAT_UNDEFINED, 4, "MkN.Nikon.FlashBracketCompensation",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
176 "Flash bracket compensation", NikonTag2FlashComp },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
177 { 0x0019, EXIF_FORMAT_RATIONAL, 1, "MkN.Nikon.AEBracketCompensation",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
178 "AE bracket compensation", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
179 { 0x0080, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ImageAdjustment",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
180 "Image adjustment", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
181 { 0x0081, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Contrast", "Contrast", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
182 { 0x0082, EXIF_FORMAT_STRING, -1, "MkN.Nikon.AuxLens","Aux lens adapter", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
183 { 0x0083, EXIF_FORMAT_BYTE_UNSIGNED, -1, "MkN.Nikon.LensType", "Lens type", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
184 { 0x0084, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "MkN.Nikon.LensFocalLength",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
185 "Lens min/max focal length and aperture", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
186 { 0x0085, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ManualFocusDistance",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
187 "Manual focus distance", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
188 { 0x0086, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.DigitalZoomFactor",
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
189 "Digital zoom facotr", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
190 { 0x0087, EXIF_FORMAT_BYTE_UNSIGNED, 1, "MkN.Nikon.FlashUsed", "Flash used", NikonTag2FlashUsed },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
191 { 0x0088, EXIF_FORMAT_UNDEFINED, -1, "MkN.Nikon.AutoFocusArea", NULL, NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
192 /* { 0x0089, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Nikon.Bracket/ShootingMode", NULL, NULL }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
193 { 0x008d, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ColorMode", "Color mode", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
194 { 0x008f, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.SceneMode", NULL, NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
195 { 0x0090, EXIF_FORMAT_STRING, -1, "MkN.Nikon.LightingType", "Lighting type", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
196 { 0x0092, EXIF_FORMAT_SHORT, 1, "MkN.Nikon.HueAdjust", "Hue adjustment", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
197 /* { 0x0094, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.Saturation", "Saturation", NikonTag2Saturation }, */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
198 { 0x0095, EXIF_FORMAT_STRING, -1, "MkN.Nikon.NoiseReduction", "Noise reduction", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
199 { 0x00a7, EXIF_FORMAT_LONG_UNSIGNED, 1, "MkN.Nikon.ShutterCount", "Shutter release count", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
200 { 0x00a9, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ImageOptimization", "Image optimization", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
201 { 0x00aa, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Saturation", "Saturation", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
202 { 0x00ab, EXIF_FORMAT_STRING, -1, "MkN.Nikon.DigitalVariProg", "Digital Vari-program", NULL },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
203 EXIF_MARKER_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
204 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
205
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
206
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
207 gint format_nikon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
208 guint size, ExifByteOrder byte_order)
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
209 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
210 unsigned char *data;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
211
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
212 if (offset + 8 + 4 >= size) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
213
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
214 data = tiff + offset;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
215 if (memcmp(data, "Nikon\x00\x01\x00", 8) == 0)
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
216 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
217 if (exif_parse_IFD_table(exif, tiff, offset + 8, size,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
218 byte_order, NikonExifMarkersList1) != 0)
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
219 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
220 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
221 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
222 return TRUE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
223 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
224
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
225 if (memcmp(data, "Nikon\x00\x02\x00\x00\x00", 10) == 0 ||
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
226 memcmp(data, "Nikon\x00\x02\x10\x00\x00", 10) == 0)
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
227 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
228 guint tiff_header;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
229
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
230 tiff_header = offset + 10;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
231 if (exif_parse_TIFF(exif, tiff + tiff_header, size - tiff_header,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
232 NikonExifMarkersList2) != 0)
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
233 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
234 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
235 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
236 return TRUE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
237 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
238
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
239 /* fixme: support E990 and D1 */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
240 if (exif_parse_IFD_table(exif, tiff, offset, size,
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
241 byte_order, NikonExifMarkersList2) != 0)
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
242 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
243 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
244 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
245
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
246 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
247 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
248