3 * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
4 * Copyright © 2003 Matthieu Castet <mat-c@users.sourceforge.net>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #include "mnote-canon-entry.h"
30 #include <libexif/exif-format.h>
31 #include <libexif/exif-utils.h>
32 #include <libexif/i18n.h>
36 #define CF(format,target,v,maxlen) \
38 if (format != target) { \
39 snprintf (v, maxlen, \
40 _("Invalid format '%s', " \
42 exif_format_get_name (format), \
43 exif_format_get_name (target)); \
48 #define CC(number,target,v,maxlen) \
50 if (number != target) { \
51 snprintf (v, maxlen, \
52 _("Invalid number of components (%i, " \
53 "expected %i)."), (int) number, (int) target); \
57 #define CC2(number,t1,t2,v,maxlen) \
59 if ((number != t1) && (number != t2)) { \
60 snprintf (v, maxlen, \
61 _("Invalid number of components (%i, " \
62 "expected %i or %i)."), (int) number, \
63 (int) t1, (int) t2); \
68 #define UNDEFINED 0xFF
70 static const struct canon_entry_table_t {
74 } entries_settings_1 [] = {
76 { 0, 2, N_("Normal")},
77 { 2, 1, N_("Economy")},
78 { 2, 2, N_("Normal")},
81 { 2, 5, N_("Superfine")},
85 { 3, 3, N_("Red-eye reduction")},
86 { 3, 4, N_("Slow synchro")},
87 { 3, 5, N_("Auto + Red-eye reduction")},
88 { 3, 6, N_("On + Red-eye reduction")},
89 { 3, 16, N_("External flash")},
90 { 4, 0, N_("Single")},
91 { 4, 1, N_("Continuous")},
93 { 4, 3, N_("Continuous, speed priority")},
94 { 4, 4, N_("Continuous, low")},
95 { 4, 5, N_("Continuous, high")},
96 { 6, 0, N_("One-shot AF")},
97 { 6, 1, N_("AI servo AF")},
98 { 6, 2, N_("AI focus AF")},
99 { 6, 3, N_("Manual focus")},
100 { 6, 4, N_("Single")},
101 { 6, 5, N_("Continuous")},
102 { 6, 6, N_("Manual focus")},
103 { 6, 16, N_("Pan focus")},
105 { 8, 2, N_("CRW+THM")},
106 { 8, 3, N_("AVI+THM")},
108 { 8, 5, N_("TIF+JPEG")},
110 { 8, 7, N_("CR2+JPEG")},
111 { 9, 0, N_("Large")},
112 { 9, 1, N_("Medium")},
113 { 9, 2, N_("Small")},
114 { 9, 5, N_("Medium 1")},
115 { 9, 6, N_("Medium 2")},
116 { 9, 7, N_("Medium 3")},
117 { 9, 8, N_("Postcard")},
118 { 9, 9, N_("Widescreen")},
119 {10, 0, N_("Full auto")},
120 {10, 1, N_("Manual")},
121 {10, 2, N_("Landscape")},
122 {10, 3, N_("Fast shutter")},
123 {10, 4, N_("Slow shutter")},
124 {10, 5, N_("Night")},
125 {10, 6, N_("Grayscale")},
126 {10, 7, N_("Sepia")},
127 {10, 8, N_("Portrait")},
128 {10, 9, N_("Sports")},
129 {10, 10, N_("Macro")},
130 {10, 11, N_("Black & white")},
131 {10, 12, N_("Pan focus")},
132 {10, 13, N_("Vivid")},
133 {10, 14, N_("Neutral")},
134 {10, 15, N_("Flash off")},
135 {10, 16, N_("Long shutter")},
136 {10, 17, N_("Super macro")},
137 {10, 18, N_("Foliage")},
138 {10, 19, N_("Indoor")},
139 {10, 20, N_("Fireworks")},
140 {10, 21, N_("Beach")},
141 {10, 22, N_("Underwater")},
142 {10, 23, N_("Snow")},
143 {10, 24, N_("Kids & pets")},
144 {10, 25, N_("Night snapshot")},
145 {10, 26, N_("Digital macro")},
146 {10, 27, N_("My colors")},
147 {10, 28, N_("Still image")},
148 {10, 30, N_("Color accent")},
149 {10, 31, N_("Color swap")},
150 {10, 32, N_("Aquarium")},
151 {10, 33, N_("ISO 3200")},
155 {11, 3, N_("Other")},
156 {12, 0x0000, N_("Normal")},
157 {12, 0x0001, N_("High")},
158 {12, 0xffff, N_("Low")},
159 {13, 0x0000, N_("Normal")},
160 {13, 0x0001, N_("High")},
161 {13, 0xffff, N_("Low")},
162 {14, 0x0000, N_("Normal")},
163 {14, 0x0001, N_("High")},
164 {14, 0xffff, N_("Low")},
165 {15, 14, N_("Auto high")},
166 {15, 15, N_("Auto")},
172 {16, 0, N_("Default")},
174 {16, 2, N_("Average")},
175 {16, 3, N_("Evaluative")},
176 {16, 4, N_("Partial")},
177 {16, 5, N_("Center-weighted average")},
178 {17, 0, N_("Manual")},
180 {17, 2, N_("Not known")},
181 {17, 3, N_("Macro")},
182 {17, 4, N_("Very close")},
183 {17, 5, N_("Close")},
184 {17, 6, N_("Middle range")},
185 {17, 7, N_("Far range")},
186 {17, 8, N_("Pan focus")},
187 {17, 9, N_("Super macro")},
188 {17, 10, N_("Infinity")},
189 {18, 0x2005, N_("Manual AF point selection")},
190 {18, 0x3000, N_("None (MF)")},
191 {18, 0x3001, N_("Auto-selected")},
192 {18, 0x3002, N_("Right")},
193 {18, 0x3003, N_("Center")},
194 {18, 0x3004, N_("Left")},
195 {18, 0x4001, N_("Auto AF point selection")},
196 {19, 0, N_("Easy shooting")},
197 {19, 1, N_("Program")},
198 {19, 2, N_("Tv-priority")},
199 {19, 3, N_("Av-priority")},
200 {19, 4, N_("Manual")},
201 {19, 5, N_("A-DEP")},
202 {19, 6, N_("M-DEP")},
203 {21, 1, N_("Canon EF 50mm f/1.8")},
204 {21, 2, N_("Canon EF 28mm f/2.8")},
205 {21, 4, N_("Sigma UC Zoom 35-135mm f/4-5.6")},
206 {21, 6, N_("Tokina AF193-2 19-35mm f/3.5-4.5")},
207 {21, 7, N_("Canon EF 100-300mm F5.6L")},
208 {21, 10, N_("Sigma 50mm f/2.8 EX or 28mm f/1.8")},
209 {21, 11, N_("Canon EF 35mm f/2")},
210 {21, 13, N_("Canon EF 15mm f/2.8")},
211 {21, 21, N_("Canon EF 80-200mm f/2.8L")},
212 {21, 22, N_("Tokina AT-X280AF PRO 28-80mm F2.8 ASPHERICAL")},
213 {21, 26, N_("Cosina 100mm f/3.5 Macro AF")},
214 {21, 28, N_("Tamron AF Aspherical 28-200mm f/3.8-5.6")},
215 {21, 29, N_("Canon EF 50mm f/1.8 MkII")},
216 {21, 31, N_("Tamron SP AF 300mm f/2.8 LD IF")},
217 {21, 32, N_("Canon EF 24mm f/2.8 or Sigma 15mm f/2.8 EX Fisheye")},
218 {21, 39, N_("Canon EF 75-300mm f/4-5.6")},
219 {21, 40, N_("Canon EF 28-80mm f/3.5-5.6")},
220 {21, 43, N_("Canon EF 28-105mm f/4-5.6")},
221 {21, 45, N_("Canon EF-S 18-55mm f/3.5-5.6")},
222 {21, 124, N_("Canon MP-E 65mm f/2.8 1-5x Macro Photo")},
223 {21, 125, N_("Canon TS-E 24mm f/3.5L")},
224 {21, 126, N_("Canon TS-E 45mm f/2.8")},
225 {21, 127, N_("Canon TS-E 90mm f/2.8")},
226 {21, 130, N_("Canon EF 50mm f/1.0L")},
227 {21, 131, N_("Sigma 17-35mm f2.8-4 EX Aspherical HSM")},
228 {21, 134, N_("Canon EF 600mm f/4L IS")},
229 {21, 135, N_("Canon EF 200mm f/1.8L")},
230 {21, 136, N_("Canon EF 300mm f/2.8L")},
231 {21, 137, N_("Canon EF 85mm f/1.2L")},
232 {21, 139, N_("Canon EF 400mm f/2.8L")},
233 {21, 141, N_("Canon EF 500mm f/4.5L")},
234 {21, 142, N_("Canon EF 300mm f/2.8L IS")},
235 {21, 143, N_("Canon EF 500mm f/4L IS")},
236 {21, 149, N_("Canon EF 100mm f/2")},
237 {21, 150, N_("Sigma 20mm EX f/1.8")},
238 {21, 151, N_("Canon EF 200mm f/2.8L")},
239 {21, 152, N_("Sigma 10-20mm F4-5.6 or 12-24mm f/4.5-5.6 or 14mm f/2.8")},
240 {21, 153, N_("Canon EF 35-350mm f/3.5-5.6L")},
241 {21, 155, N_("Canon EF 85mm f/1.8 USM")},
242 {21, 156, N_("Canon EF 28-105mm f/3.5-4.5 USM")},
243 {21, 160, N_("Canon EF 20-35mm f/3.5-4.5 USM")},
244 {21, 161, N_("Canon EF 28-70mm f/2.8L or Sigma 24-70mm EX f/2.8")},
245 {21, 165, N_("Canon EF 70-200mm f/2.8 L")},
246 {21, 166, N_("Canon EF 70-200mm f/2.8 L + x1.4")},
247 {21, 167, N_("Canon EF 70-200mm f/2.8 L + x2")},
248 {21, 168, N_("Canon EF 28mm f/1.8 USM")},
249 {21, 169, N_("Sigma 15-30mm f/3.5-4.5 EX DG Aspherical")},
250 {21, 170, N_("Canon EF 200mm f/2.8L II")},
251 {21, 173, N_("Canon EF 180mm Macro f/3.5L or Sigma 180mm EX HSM Macro f/3.5")},
252 {21, 174, N_("Canon EF 135mm f/2L")},
253 {21, 176, N_("Canon EF 24-85mm f/3.5-4.5 USM")},
254 {21, 177, N_("Canon EF 300mm f/4L IS")},
255 {21, 178, N_("Canon EF 28-135mm f/3.5-5.6 IS")},
256 {21, 180, N_("Canon EF 35mm f/1.4L")},
257 {21, 181, N_("Canon EF 100-400mm f/4.5-5.6L IS + x1.4")},
258 {21, 182, N_("Canon EF 100-400mm f/4.5-5.6L IS + x2")},
259 {21, 183, N_("Canon EF 100-400mm f/4.5-5.6L IS")},
260 {21, 184, N_("Canon EF 400mm f/2.8L + x2")},
261 {21, 186, N_("Canon EF 70-200mm f/4L")},
262 {21, 190, N_("Canon EF 100mm f/2.8 Macro")},
263 {21, 191, N_("Canon EF 400mm f/4 DO IS")},
264 {21, 197, N_("Canon EF 75-300mm f/4-5.6 IS")},
265 {21, 198, N_("Canon EF 50mm f/1.4")},
266 {21, 202, N_("Canon EF 28-80 f/3.5-5.6 USM IV")},
267 {21, 211, N_("Canon EF 28-200mm f/3.5-5.6")},
268 {21, 213, N_("Canon EF 90-300mm f/4.5-5.6")},
269 {21, 214, N_("Canon EF-S 18-55mm f/3.5-4.5 USM")},
270 {21, 224, N_("Canon EF 70-200mm f/2.8L IS USM")},
271 {21, 225, N_("Canon EF 70-200mm f/2.8L IS USM + x1.4")},
272 {21, 226, N_("Canon EF 70-200mm f/2.8L IS USM + x2")},
273 {21, 229, N_("Canon EF 16-35mm f/2.8L")},
274 {21, 230, N_("Canon EF 24-70mm f/2.8L")},
275 {21, 231, N_("Canon EF 17-40mm f/4L")},
276 {21, 232, N_("Canon EF 70-300mm f/4.5-5.6 DO IS USM")},
277 {21, 234, N_("Canon EF-S 17-85mm f4-5.6 IS USM")},
278 {21, 235, N_("Canon EF-S10-22mm F3.5-4.5 USM")},
279 {21, 236, N_("Canon EF-S60mm F2.8 Macro USM")},
280 {21, 237, N_("Canon EF 24-105mm f/4L IS")},
281 {21, 238, N_("Canon EF 70-300mm F4-5.6 IS USM")},
282 {21, 241, N_("Canon EF 50mm F1.2L USM")},
283 {21, 242, N_("Canon EF 70-200mm f/4L IS USM")},
284 {28, 0, N_("Manual")},
286 {28, 2, N_("A-TTL")},
287 {28, 3, N_("E-TTL")},
288 {28, 4, N_("FP sync enabled")},
289 {28, 7, N_("2nd-curtain sync used")},
290 {28, 11, N_("FP sync used")},
291 {28, 13, N_("Internal")},
292 {28, 14, N_("External")},
293 {31, 0, N_("Single")},
294 {31, 1, N_("Continuous")},
295 {32, 0, N_("Normal AE")},
296 {32, 1, N_("Exposure compensation")},
297 {32, 2, N_("AE lock")},
298 {32, 3, N_("AE lock + Exposure compensation")},
299 {32, 4, N_("No AE")},
302 {33, 2, N_("On, shot only")},
304 {39, 1, N_("Vivid")},
305 {39, 2, N_("Neutral")},
306 {39, 3, N_("Smooth")},
307 {39, 4, N_("Sepia")},
308 {39, 5, N_("Black & white")},
309 {39, 6, N_("Custom")},
310 {39, 100, N_("My color data")},
312 {40, 0x0500, N_("Full")},
313 {40, 0x0502, N_("2/3")},
314 {40, 0x0504, N_("1/3")},
317 entries_focal_length [] = {
322 entries_settings_2 [] = {
324 { 6, 1, N_("Sunny")},
325 { 6, 2, N_("Cloudy")},
326 { 6, 3, N_("Tungsten")},
327 { 6, 4, N_("Fluorescent")},
328 { 6, 5, N_("Flash")},
329 { 6, 6, N_("Custom")},
330 { 6, 7, N_("Black & white")},
331 { 6, 8, N_("Shade")},
332 { 6, 9, N_("Manual temperature (Kelvin)")},
333 { 6, 10, N_("PC set 1")},
334 { 6, 11, N_("PC set 2")},
335 { 6, 12, N_("PC set 3")},
336 { 6, 14, N_("Daylight fluorescent")},
337 { 6, 15, N_("Custom 1")},
338 { 6, 16, N_("Custom 2")},
339 { 6, 17, N_("Underwater")},
341 { 7, 1, N_("Night scene")},
344 { 13, 0x3000, N_("None (MF)")},
345 { 13, 0x3001, N_("Right")},
346 { 13, 0x3002, N_("Center")},
347 { 13, 0x3003, N_("Center + Right")},
348 { 13, 0x3004, N_("Left")},
349 { 13, 0x3005, N_("Left + Right")},
350 { 13, 0x3006, N_("Left + Center")},
351 { 13, 0x3007, N_("All")},
353 { 15, 1, N_("On (shot 1)")},
354 { 15, 2, N_("On (shot 2)")},
355 { 15, 3, N_("On (shot 3)")},
356 { 15, 0xffff, N_("On")},
357 { 25, 248, N_("EOS high-end")},
358 { 25, 250, N_("Compact")},
359 { 25, 252, N_("EOS mid-range")},
360 { 26, 0, N_("None")},
361 { 26, 1, N_("Rotate 90 CW")},
362 { 26, 2, N_("Rotate 180")},
363 { 26, 3, N_("Rotate 270 CW")},
364 { 26, 0xffff, N_("Rotated by software")},
368 { 32, 0x0014, N_("1/3")},
369 { 32, 0x008c, N_("2/3")},
370 { 32, 0x07d0, N_("Full")},
373 entries_panorama [] = {
374 {0, 0, N_("Left to right")},
375 {0, 1, N_("Right to left")},
376 {0, 2, N_("Bottom to top")},
377 {0, 3, N_("Top to bottom")},
378 {0, 4, N_("2x2 matrix (clockwise)")},
381 color_information [] = {
382 {0, 0, N_("Standard")},
383 {0, 1, N_("Manual")},
384 {0, 2, N_("Custom")},
386 {2, 1, N_("Lowest")},
388 {2, 3, N_("Standard")},
390 {2, 5, N_("Highest")},
392 {7, 1, N_("Daylight")},
393 {7, 2, N_("Cloudy")},
394 {7, 3, N_("Tungsten")},
395 {7, 4, N_("Fluorescent")},
397 {7, 6, N_("Custom")},
398 {7, 7, N_("Black & White")},
400 {7, 9, N_("Manual Temperature (Kelvin)")},
401 {7, 10, N_("PC Set1")},
402 {7, 11, N_("PC Set2")},
403 {7, 12, N_("PC Set3")},
404 {7, 14, N_("Daylight Fluorescent")},
405 {7, 15, N_("Custom 1")},
406 {7, 16, N_("Custom 2")},
407 {7, 17, N_("Underwater")},
408 {9, 0x00, N_("None")},
409 {9, 0x01, N_("Standard")},
410 {9, 0x02, N_("Set 1")},
411 {9, 0x03, N_("Set 2")},
412 {9, 0x04, N_("Set 3")},
413 {9, 0x21, N_("User Def. 1")},
414 {9, 0x22, N_("User Def. 2")},
415 {9, 0x23, N_("User Def. 3")},
416 {9, 0x41, N_("External 1")},
417 {9, 0x42, N_("External 2")},
418 {9, 0x43, N_("External 3")},
419 {9, 0x81, N_("Standard")},
420 {9, 0x82, N_("Portrait")},
421 {9, 0x83, N_("Landscape")},
422 {9, 0x84, N_("Neutral")},
423 {9, 0x85, N_("Faithful")},
424 {9, 0x86, N_("Monochrome")},
428 canon_search_table_value (const struct canon_entry_table_t table[],
429 unsigned int t, ExifShort vs, char *val, unsigned int maxlen)
433 /* Search the table for the first matching subtag and value. */
434 for (j = 0; table[j].name && ((table[j].subtag < t) ||
435 ((table[j].subtag == t) && table[j].value <= vs)); j++) {
436 if ((table[j].subtag == t) && (table[j].value == vs)) {
440 if ((table[j].subtag == t) && (table[j].value == vs) && table[j].name) {
441 /* Matching subtag and value found. */
442 strncpy (val, table[j].name, maxlen);
444 /* No matching subtag and/or value found. */
445 snprintf (val, maxlen, "0x%04x", vs);
450 canon_search_table_bitfield (const struct canon_entry_table_t table[],
451 unsigned int t, ExifShort vs, char *val, unsigned int maxlen)
455 /* Search the table for the first matching subtag. */
456 for (j = 0; table[j].name && (table[j].subtag <= t); j++) {
457 if (table[j].subtag == t) {
461 if ((table[j].subtag == t) && table[j].name) {
462 unsigned int i, bit, lastbit = 0;
465 * Search the table for the last matching bit, because
466 * that one needs no additional comma appended.
468 for (i = j; table[i].name && (table[i].subtag == t); i++) {
469 bit = table[i].value;
470 if ((vs >> bit) & 1) {
474 /* Search the table for all matching bits. */
475 for (i = j; table[i].name && (table[i].subtag == t); i++) {
476 bit = table[i].value;
477 if ((vs >> bit) & 1) {
478 strncat(val, table[i].name, maxlen - strlen (val));
480 strncat (val, N_(", "), maxlen - strlen (val));
484 /* No matching subtag found. */
485 snprintf (val, maxlen, "0x%04x", vs);
490 mnote_canon_entry_count_values (const MnoteCanonEntry *entry)
494 if (!entry) return 0;
496 switch (entry->tag) {
497 case MNOTE_CANON_TAG_FOCAL_LENGTH:
498 case MNOTE_CANON_TAG_PANORAMA:
499 return entry->components;
500 case MNOTE_CANON_TAG_SETTINGS_1:
501 case MNOTE_CANON_TAG_SETTINGS_2:
502 case MNOTE_CANON_TAG_CUSTOM_FUNCS:
503 case MNOTE_CANON_TAG_COLOR_INFORMATION:
504 if (entry->format != EXIF_FORMAT_SHORT) return 0;
506 val = exif_get_short (entry->data, entry->order);
507 /* val is buffer size, i.e. # of values plus 1 */
508 return MIN (entry->size - 2, val) / 2;
515 * For reference, see Exif 2.1 specification (Appendix C),
516 * or http://en.wikipedia.org/wiki/APEX_system
519 apex_value_to_aperture (double x)
521 return pow (2, x / 2.);
525 apex_value_to_shutter_speed(double x)
527 return 1.0 / pow (2, x);
531 apex_value_to_iso_speed (double x)
533 return 3.125 * pow (2, x);
537 mnote_canon_entry_get_value (const MnoteCanonEntry *entry, unsigned int t, char *val, unsigned int maxlen)
550 memset (val, 0, maxlen);
553 switch (entry->tag) {
554 case MNOTE_CANON_TAG_SETTINGS_1:
555 CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
556 n = exif_get_short (data, entry->order) / 2;
557 if (t >= n) return NULL;
558 CC (entry->components, n, val, maxlen);
559 vs = exif_get_short (data + 2 + t * 2, entry->order);
563 strncpy(val, _("Off"), maxlen);
566 snprintf (val, maxlen, _("%i (ms)"), vs * 100);
569 if (((vs & 0xC000) == 0x4000) && (vs != 0x7FFF)) {
570 /* Canon S3 IS - directly specified value */
571 snprintf (val, maxlen, _("%i"), vs & ~0x4000);
573 /* Standard Canon - index into lookup table */
574 canon_search_table_value (entries_settings_1, t, vs, val, maxlen);
580 snprintf (val, maxlen, "%u", vs);
584 snprintf (val, maxlen, "%.2f", apex_value_to_aperture (vs / 32.0));
587 canon_search_table_bitfield(entries_settings_1, t, vs, val, maxlen);
590 snprintf (val, maxlen, "%.2f", vs / 10.0);
594 snprintf (val, maxlen, "%u", vs);
597 canon_search_table_value (entries_settings_1, t, vs, val, maxlen);
601 case MNOTE_CANON_TAG_FOCAL_LENGTH:
602 CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
603 vs = exif_get_short (data + t * 2, entry->order);
606 snprintf (val, maxlen, "%u", vs);
610 snprintf (val, maxlen, _("%.2f mm"), vs * 25.4 / 1000);
613 canon_search_table_value (entries_focal_length, t, vs, val, maxlen);
617 case MNOTE_CANON_TAG_SETTINGS_2:
618 CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
619 n = exif_get_short (data, entry->order) / 2;
620 if (t >= n) return NULL;
621 CC (entry->components, n, val, maxlen);
622 vs = exif_get_short (data + 2 + t * 2, entry->order);
626 snprintf (val, maxlen, "%.0f", apex_value_to_iso_speed(vs / 32.0));
632 snprintf (val, maxlen, _("%.2f EV"), vs / 32.0);
636 snprintf (val, maxlen, "%.2f", apex_value_to_aperture (vs / 32.0));
640 d = apex_value_to_shutter_speed(vs / 32.0);
642 snprintf (val, maxlen, _("1/%d"),(int)(1.0 / d));
644 snprintf (val, maxlen, _("%d"), (int) d);
647 snprintf (val, maxlen, "%u", vs);
650 snprintf (val, maxlen, "%.2f", vs / 32.0);
654 snprintf (val, maxlen, _("%u mm"), vs);
658 strncpy(val, _("Off"), maxlen);
661 snprintf (val, maxlen, _("%i (ms)"), vs * 100);
664 canon_search_table_value (entries_settings_2, t, vs, val, maxlen);
668 case MNOTE_CANON_TAG_PANORAMA:
669 CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
670 vs = exif_get_short (data + t * 2, entry->order);
671 canon_search_table_value (entries_panorama, t, vs, val, maxlen);
674 case MNOTE_CANON_TAG_OWNER:
675 CC (entry->components, 32, val, maxlen);
676 /* Fall through; ImageType can have many sizes */
677 case MNOTE_CANON_TAG_IMAGE_TYPE:
678 CF (entry->format, EXIF_FORMAT_ASCII, val, maxlen);
679 strncpy (val, (char *)data, MIN (entry->size, maxlen));
682 case MNOTE_CANON_TAG_FIRMWARE:
683 CF (entry->format, EXIF_FORMAT_ASCII, val, maxlen);
684 /* CC2 (entry->components, 24, 32, val, maxlen); Can also be 22 */
685 strncpy (val, (char *)data, MIN (entry->size, maxlen));
688 case MNOTE_CANON_TAG_IMAGE_NUMBER:
689 CF (entry->format, EXIF_FORMAT_LONG, val, maxlen);
690 CC (entry->components, 1, val, maxlen);
691 vl = exif_get_long (data, entry->order);
692 snprintf (val, maxlen, "%03lu-%04lu",
693 (unsigned long) vl/10000,
694 (unsigned long) vl%10000);
697 case MNOTE_CANON_TAG_SERIAL_NUMBER:
698 CF (entry->format, EXIF_FORMAT_LONG, val, maxlen);
699 CC (entry->components, 1, val, maxlen);
700 vl = exif_get_long (data, entry->order);
701 snprintf (val, maxlen, "%04X-%05d", (int)vl>>16,(int)vl&0xffff);
704 case MNOTE_CANON_TAG_CUSTOM_FUNCS:
705 CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
706 n = exif_get_short (data, entry->order) / 2;
707 if (t >= n) return NULL;
708 CC (entry->components, n, val, maxlen);
709 vs = exif_get_short (data + 2 + t * 2, entry->order);
710 snprintf (buf, sizeof (buf), "%u", vs);
711 strncat (val, buf, maxlen - strlen (val));
714 case MNOTE_CANON_TAG_COLOR_INFORMATION:
715 CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
716 n = exif_get_short (data, entry->order) / 2;
717 if (t >= n) return NULL;
718 CC (entry->components, n, val, maxlen);
719 vs = exif_get_short (data + 2 + t * 2, entry->order);
720 canon_search_table_value (color_information, t, vs, val, maxlen);
727 if (entry->format == EXIF_FORMAT_SHORT)
728 for(i=0;i<entry->components;i++) {
729 vs = exif_get_short (data, entry->order);
731 printf ("Value%d=%d\n", i, vs);
733 else if (entry->format == EXIF_FORMAT_LONG)
734 for(i=0;i<entry->components;i++) {
735 vl = exif_get_long (data, entry->order);
737 printf ("Value%d=%d\n", i, vs);
739 else if (entry->format == EXIF_FORMAT_ASCII)
740 strncpy (val, data, MIN (entry->size, maxlen));