5 * This software is released under the GNU General Public License (GNU GPL).
6 * Please read the included file COPYING for more information.
7 * This software comes with no warranty of any kind, use at your own risk!
23 #include "format_nikon.h"
29 *-----------------------------------------------------------------------------
30 * EXIF Makernote for Nikon
31 *-----------------------------------------------------------------------------
34 static ExifTextList NikonTagQuality[]= {
41 { 7, "XGA basic (?)" },
42 { 8, "XGA normal (?)" },
43 { 9, "XGA fine (?)" },
45 { 11, "UXGA normal" },
50 static ExifTextList NikonTagColorMode[]= {
56 static ExifTextList NikonTagImgAdjust[]= {
65 static ExifTextList NikonTagISOSensitivity[]= {
73 static ExifTextList NikonTagWhiteBalance[]= {
77 { 3, "incandescent" },
78 { 4, "fluorescence" },
84 static ExifTextList NikonTagConverter[]= {
91 static ExifTextList NikonTag[]= {
98 static ExifMarker NikonExifMarkersList1[] = {
99 { 0x0002, EXIF_FORMAT_STRING, 6, "MkN.Nikon.unknown", NULL, NULL },
100 { 0x0003, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.Quality", "Quality", NikonTagQuality },
101 { 0x0004, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ColorMode", "Color mode", NikonTagColorMode },
102 { 0x0005, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ImageAdjustment",
103 "Image adjustment", NikonTagImgAdjust },
104 { 0x0006, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ISOSensitivity",
105 "ISO sensitivity", NikonTagISOSensitivity },
106 { 0x0007, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.WhiteBalance",
107 "White balance", NikonTagWhiteBalance },
108 { 0x0008, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "MkN.Nikon.Focus", "Focus", NULL },
109 { 0x000a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "MkN.Nikon.DigitalZoom","Digital zoom", NULL },
110 { 0x000b, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.Converter", "Converter", NikonTagConverter },
114 static ExifTextList NikonTag2FlashComp[]= {
135 static ExifTextList NikonTag2FlashUsed[]= {
142 static ExifTextList NikonTagi2Saturation[]= {
143 { -3, "black and white" },
153 static ExifMarker NikonExifMarkersList2[] = {
154 { 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 2, "MkN.Nikon.ISOSpeed", "ISO speed", NULL },
155 { 0x0003, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ColorMode", "Color mode", NULL },
156 { 0x0004, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Quality", "Quality", NULL },
157 { 0x0005, EXIF_FORMAT_STRING, -1, "MkN.Nikon.WhiteBalance",
158 "White balance", NULL },
159 { 0x0006, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Sharpening", "Sharpening", NULL },
160 { 0x0007, EXIF_FORMAT_STRING, -1, "MkN.Nikon.FocusMode", "Focus mode", NULL },
161 { 0x0008, EXIF_FORMAT_STRING, -1, "MkN.Nikon.FlashSetting",
162 "Flash setting", NULL },
163 { 0x0009, EXIF_FORMAT_STRING, -1, "MkN.Nikon.AutoFlashMode","Auto flash mode",NULL },
164 { 0x000b, EXIF_FORMAT_SHORT, 1, "MkN.Nikon.WhiteBalanceBias",
165 "White balance bias value", NULL },
166 /* { 0x000c, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.WhiteBalanceCoeff",
167 "White balance red/blue coefficents", NULL }, */
168 /* { 0x000f, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ISOSelect", "ISO selection",NULL }, */
169 { 0x0012, EXIF_FORMAT_UNDEFINED, 4, "MkN.Nikon.FlashCompensation",
170 "Flash compensation", NikonTag2FlashComp },
171 { 0x0013, EXIF_FORMAT_SHORT_UNSIGNED, 2, "MkN.Nikon.ISOSpeedRequest",
172 "ISO speed requested", NULL },
173 { 0x0016, EXIF_FORMAT_SHORT_UNSIGNED, 4, "MkN.Nikon.CornerCoord",
174 "Corner coordinates", NULL },
175 { 0x0018, EXIF_FORMAT_UNDEFINED, 4, "MkN.Nikon.FlashBracketCompensation",
176 "Flash bracket compensation", NikonTag2FlashComp },
177 { 0x0019, EXIF_FORMAT_RATIONAL, 1, "MkN.Nikon.AEBracketCompensation",
178 "AE bracket compensation", NULL },
179 { 0x0080, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ImageAdjustment",
180 "Image adjustment", NULL },
181 { 0x0081, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Contrast", "Contrast", NULL },
182 { 0x0082, EXIF_FORMAT_STRING, -1, "MkN.Nikon.AuxLens","Aux lens adapter", NULL },
183 { 0x0083, EXIF_FORMAT_BYTE_UNSIGNED, -1, "MkN.Nikon.LensType", "Lens type", NULL },
184 { 0x0084, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "MkN.Nikon.LensFocalLength",
185 "Lens min/max focal length and aperture", NULL },
186 { 0x0085, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.ManualFocusDistance",
187 "Manual focus distance", NULL },
188 { 0x0086, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.DigitalZoomFactor",
189 "Digital zoom facotr", NULL },
190 { 0x0087, EXIF_FORMAT_BYTE_UNSIGNED, 1, "MkN.Nikon.FlashUsed", "Flash used", NikonTag2FlashUsed },
191 { 0x0088, EXIF_FORMAT_UNDEFINED, -1, "MkN.Nikon.AutoFocusArea", NULL, NULL },
192 /* { 0x0089, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Nikon.Bracket/ShootingMode", NULL, NULL }, */
193 { 0x008d, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ColorMode", "Color mode", NULL },
194 { 0x008f, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.SceneMode", NULL, NULL },
195 { 0x0090, EXIF_FORMAT_STRING, -1, "MkN.Nikon.LightingType", "Lighting type", NULL },
196 { 0x0092, EXIF_FORMAT_SHORT, 1, "MkN.Nikon.HueAdjust", "Hue adjustment", NULL },
197 /* { 0x0094, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Nikon.Saturation", "Saturation", NikonTag2Saturation }, */
198 { 0x0095, EXIF_FORMAT_STRING, -1, "MkN.Nikon.NoiseReduction", "Noise reduction", NULL },
199 { 0x00a7, EXIF_FORMAT_LONG_UNSIGNED, 1, "MkN.Nikon.ShutterCount", "Shutter release count", NULL },
200 { 0x00a9, EXIF_FORMAT_STRING, -1, "MkN.Nikon.ImageOptimization", "Image optimization", NULL },
201 { 0x00aa, EXIF_FORMAT_STRING, -1, "MkN.Nikon.Saturation", "Saturation", NULL },
202 { 0x00ab, EXIF_FORMAT_STRING, -1, "MkN.Nikon.DigitalVariProg", "Digital Vari-program", NULL },
207 gint format_nikon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
208 guint size, ExifByteOrder byte_order)
212 if (offset + 8 + 4 >= size) return FALSE;
214 data = tiff + offset;
215 if (memcmp(data, "Nikon\x00\x01\x00", 8) == 0)
217 if (exif_parse_IFD_table(exif, tiff, offset + 8, size,
218 byte_order, NikonExifMarkersList1) != 0)
225 if (memcmp(data, "Nikon\x00\x02\x00\x00\x00", 10) == 0 ||
226 memcmp(data, "Nikon\x00\x02\x10\x00\x00", 10) == 0)
230 tiff_header = offset + 10;
231 if (exif_parse_TIFF(exif, tiff + tiff_header, size - tiff_header,
232 NikonExifMarkersList2) != 0)
239 /* fixme: support E990 and D1 */
240 if (exif_parse_IFD_table(exif, tiff, offset, size,
241 byte_order, NikonExifMarkersList2) != 0)