annotate src/format_nikon.c @ 1511:73cecf473802

startup path options simplified and moved to layout options
author nadvornik
date Sat, 04 Apr 2009 21:14:34 +0000
parents bc3f5c0432f6
children 956aab097ea7
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 /*
541
116346636d42 Replace GQView by Geeqie.
zas_
parents: 475
diff changeset
2 * Geeqie
116346636d42 Replace GQView by Geeqie.
zas_
parents: 475
diff changeset
3 * (C) 2005 John Ellis
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1055
diff changeset
4 * Copyright (C) 2008 - 2009 The Geeqie Team
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
5 *
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
6 * Authors:
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
7 * Raw NEF jpeg extraction based on nefextract.c by Joseph Heled,
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
8 * in addition nefextract.c is based on dcraw by Dave Coffin.
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
9 *
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
10 * 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
11 * 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
12 * 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
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 #ifdef HAVE_CONFIG_H
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
16 # include "config.h"
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
17 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
18
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 138
diff changeset
19 #ifndef HAVE_EXIV2
51
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 <stdio.h>
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
22 #include <string.h>
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
23 #include <unistd.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 <glib.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 #include "intl.h"
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
28
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 177
diff changeset
29 #include "main.h"
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
30 #include "format_nikon.h"
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 #include "exif.h"
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
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
35 /*
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
36 *-----------------------------------------------------------------------------
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
37 * Raw NEF embedded jpeg extraction for Nikon
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
38 *-----------------------------------------------------------------------------
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
39 */
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
40
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 749
diff changeset
41 static guint nikon_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
42 gint level,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
43 guint *image_offset, guint *jpeg_len);
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
44
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
45
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 749
diff changeset
46 static void nikon_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
47 gint level,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
48 guint *image_offset, guint *image_length, guint *jpeg_start, guint *jpeg_len)
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
49 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
50 guint tag;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
51 guint type;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
52 guint count;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
53 guint segment;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
54 guint seg_len;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
55
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
56 tag = exif_byte_get_int16(data + offset + EXIF_TIFD_OFFSET_TAG, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
57 type = exif_byte_get_int16(data + offset + EXIF_TIFD_OFFSET_FORMAT, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
58 count = exif_byte_get_int32(data + offset + EXIF_TIFD_OFFSET_COUNT, bo);
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
59
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
60 /* so far, we only care about tags with type long */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
61 if (type != EXIF_FORMAT_LONG_UNSIGNED && type != EXIF_FORMAT_LONG) return;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
62
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
63 seg_len = ExifFormatList[type].size * count;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
64 if (seg_len > 4)
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
65 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
66 segment = exif_byte_get_int32(data + offset + EXIF_TIFD_OFFSET_DATA, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
67 if (segment + seg_len > len) return;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
68 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
69 else
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
70 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
71 segment = offset + EXIF_TIFD_OFFSET_DATA;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
72 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
73
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
74 if (tag == 0x14a)
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
75 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
76 /* sub IFD table */
749
f606e8962329 Silent few warnings that appeared when using --disable-exiv2 configure option.
zas_
parents: 541
diff changeset
77 guint i;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
78
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
79 for (i = 0; i < count; i++)
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
80 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
81 guint subset;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
82
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
83 subset = exif_byte_get_int32(data + segment + i * 4, bo);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
84 nikon_tiff_table(data, len, subset, bo, level + 1, image_offset, image_length);
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
85 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
86
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
87 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
88 else if (tag == 0x201)
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
89 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
90 /* jpeg data start offset */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
91 *jpeg_start = exif_byte_get_int32(data + segment, bo);
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
92 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
93 else if (tag == 0x202)
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
94 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
95 /* jpeg data length */
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
96 *jpeg_len = exif_byte_get_int32(data + segment, bo);
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
97 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
98 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
99
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 749
diff changeset
100 static guint nikon_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
101 gint level,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
102 guint *image_offset, guint *image_length)
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
103 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
104 guint count;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
105 guint i;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
106 guint jpeg_start = 0;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
107 guint jpeg_len = 0;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
108
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
109 /* limit damage from infinite loops */
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
110 if (level > EXIF_TIFF_MAX_LEVELS) return 0;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
111
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
112 if (len < offset + 2) return FALSE;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
113
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
114 count = exif_byte_get_int16(data + offset, bo);
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
115 offset += 2;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
116 if (len < offset + count * EXIF_TIFD_SIZE + 4) return 0;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
117
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
118 for (i = 0; i < count; i++)
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
119 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
120 nikon_tiff_entry(data, len, offset + i * EXIF_TIFD_SIZE, bo, level,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
121 image_offset, image_length, &jpeg_start, &jpeg_len);
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
122 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
123
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
124 if (jpeg_start > 0 &&
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
125 jpeg_len > *image_length)
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
126 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
127 *image_offset = jpeg_start;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
128 *image_length = jpeg_len;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
129 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
130
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
131 return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo);
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
132 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
133
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1284
diff changeset
134 gboolean format_nikon_raw(guchar *data, const guint len,
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1284
diff changeset
135 guint *image_offset, guint *exif_offset)
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
136 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
137 guint i_off = 0;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
138 guint i_len = 0;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
139 ExifByteOrder bo;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
140 guint offset;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
141 gint level;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
142
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
143 if (!exif_tiff_directory_offset(data, len, &offset, &bo)) return FALSE;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
144
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
145 level = 0;
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
146 while (offset && level < EXIF_TIFF_MAX_LEVELS)
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
147 {
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
148 offset = nikon_tiff_table(data, len, offset, bo, 0, &i_off, &i_len);
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
149 level++;
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
150 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
151
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
152 if (i_off != 0)
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
153 {
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
154 if (image_offset) *image_offset = i_off;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
155 return TRUE;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
156 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
157
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
158 return FALSE;
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
159 }
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
160
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
161
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
162 /*
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
163 *-----------------------------------------------------------------------------
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
164 * EXIF Makernote for Nikon
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
165 *-----------------------------------------------------------------------------
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
166 */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
167
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
168 static ExifTextList NikonTagQuality[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
169 { 1, "VGA basic" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
170 { 2, "VGA normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
171 { 3, "VGA fine" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
172 { 4, "SXGA basic" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
173 { 5, "SXGA normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
174 { 6, "SXGA fine" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
175 { 7, "XGA basic (?)" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
176 { 8, "XGA normal (?)" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
177 { 9, "XGA fine (?)" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
178 { 10, "UXGA basic" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
179 { 11, "UXGA normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
180 { 12, "UXGA fine" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
181 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
182 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
183
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
184 static ExifTextList NikonTagColorMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
185 { 1, "color" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
186 { 2, "monochrome" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
187 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
188 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
189
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
190 static ExifTextList NikonTagImgAdjust[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
191 { 0, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
192 { 1, "bright+" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
193 { 2, "bright-" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
194 { 3, "contrast+" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
195 { 4, "contrast-" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
196 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
197 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
198
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
199 static ExifTextList NikonTagISOSensitivity[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
200 { 0, "80" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
201 { 2, "160" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
202 { 4, "320" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
203 { 5, "100" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
204 EXIF_TEXT_LIST_END
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 static ExifTextList NikonTagWhiteBalance[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
208 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
209 { 1, "preset" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
210 { 2, "daylight" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
211 { 3, "incandescent" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
212 { 4, "fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
213 { 5, "cloudy" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
214 { 6, "speedlight" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
215 EXIF_TEXT_LIST_END
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
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
218 static ExifTextList NikonTagConverter[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
219 { 0, "none" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
220 { 1, "Fisheye" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
221 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
222 };
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 #if 0
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
225 static ExifTextList NikonTag[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
226 { , "" },
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 EXIF_TEXT_LIST_END
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 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
231
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
232 static ExifMarker NikonExifMarkersList1[] = {
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
233 { 0x0002, EXIF_FORMAT_STRING, 6, "Nikon.unknown", NULL, NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
234 { 0x0003, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.Quality", "Quality", NikonTagQuality },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
235 { 0x0004, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.ColorMode", "Color mode", NikonTagColorMode },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
236 { 0x0005, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.ImageAdjustment",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
237 "Image adjustment", NikonTagImgAdjust },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
238 { 0x0006, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.ISOSensitivity",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
239 "ISO sensitivity", NikonTagISOSensitivity },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
240 { 0x0007, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.WhiteBalance", "White balance",NikonTagWhiteBalance },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
241 { 0x0008, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Nikon.Focus", "Focus", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
242 { 0x000a, EXIF_FORMAT_RATIONAL_UNSIGNED, 1, "Nikon.DigitalZoom", "Digital zoom", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
243 { 0x000b, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.Converter", "Converter", NikonTagConverter },
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
244 EXIF_MARKER_LIST_END
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
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
247 static ExifTextList NikonTag2FlashComp[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
248 { 0x06, "+1.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
249 { 0x04, "+0.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
250 { 0x03, "+0.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
251 { 0x02, "+0.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
252 { 0x00, "0.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
253 { 0xfe, "-0.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
254 { 0xfd, "-0.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
255 { 0xfc, "-0.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
256 { 0xfa, "-1.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
257 { 0xf8, "-1.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
258 { 0xf7, "-1.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
259 { 0xf6, "-1.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
260 { 0xf4, "-2.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
261 { 0xf2, "-2.3 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
262 { 0xf1, "-2.5 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
263 { 0xf0, "-2.7 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
264 { 0xee, "-3.0 EV" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
265 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
266 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
267
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
268 static ExifTextList NikonTag2LensType[]= {
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
269 { 0, "AF non D" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
270 { 1, "manual" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
271 { 2, "AF-D or AF-s" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
272 { 6, "AF-D G" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
273 { 10, "AF-D VR" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
274 EXIF_TEXT_LIST_END
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
275 };
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
276
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
277 static ExifTextList NikonTag2FlashUsed[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
278 { 0, "no" },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
279 { 4, "unit unknown" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
280 { 7, "external" },
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
281 { 9, "yes" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
282 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
283 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
284
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
285 #if 0
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
286 static ExifTextList NikonTagi2Saturation[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
287 { -3, "black and white" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
288 { -2, "-2" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
289 { -1, "-1" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
290 { 0, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
291 { 1, "+1" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
292 { 2, "+2" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
293 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
294 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
295 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
296
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
297 static ExifMarker NikonExifMarkersList2[] = {
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
298 { 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Nikon.ISOSpeed", "ISO speed", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
299 { 0x0003, EXIF_FORMAT_STRING, -1, "Nikon.ColorMode", "Color mode", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
300 { 0x0004, EXIF_FORMAT_STRING, -1, "Nikon.Quality", "Quality", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
301 { 0x0005, EXIF_FORMAT_STRING, -1, "Nikon.WhiteBalance", "White balance",NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
302 { 0x0006, EXIF_FORMAT_STRING, -1, "Nikon.Sharpening", "Sharpening", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
303 { 0x0007, EXIF_FORMAT_STRING, -1, "Nikon.FocusMode", "Focus mode", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
304 { 0x0008, EXIF_FORMAT_STRING, -1, "Nikon.FlashSetting", "Flash setting",NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
305 { 0x0009, EXIF_FORMAT_STRING, -1, "Nikon.AutoFlashMode","Auto flash mode",NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
306 { 0x000b, EXIF_FORMAT_SHORT, 1, "Nikon.WhiteBalanceBias",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
307 "White balance bias value", NULL },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
308 /* { 0x000c, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.WhiteBalanceRB",
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
309 "White balance red/blue coefficients", NULL }, */
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
310 /* { 0x000f, EXIF_FORMAT_STRING, -1, "Nikon.ISOSelect", "ISO selection",NULL }, */
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
311 { 0x0012, EXIF_FORMAT_UNDEFINED, 4, "Nikon.FlashCompensation",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
312 "Flash compensation", NikonTag2FlashComp },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
313 { 0x0013, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Nikon.ISOSpeedRequest",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
314 "ISO speed requested", NULL },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
315 { 0x0016, EXIF_FORMAT_SHORT_UNSIGNED, 4, "Nikon.CornerCoord",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
316 "Corner coordinates", NULL },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
317 { 0x0018, EXIF_FORMAT_UNDEFINED, 4, "Nikon.FlashBracketCompensation",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
318 "Flash bracket compensation", NikonTag2FlashComp },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
319 { 0x0019, EXIF_FORMAT_RATIONAL, 1, "Nikon.AEBracketCompensation",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
320 "AE bracket compensation", NULL },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
321 { 0x0080, EXIF_FORMAT_STRING, -1, "Nikon.ImageAdjustment",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
322 "Image adjustment", NULL },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
323 { 0x0081, EXIF_FORMAT_STRING, -1, "Nikon.Contrast", "Contrast", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
324 { 0x0082, EXIF_FORMAT_STRING, -1, "Nikon.AuxLens", "Aux lens adapter", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
325 { 0x0083, EXIF_FORMAT_BYTE_UNSIGNED, -1, "Nikon.LensType", "Lens type", NikonTag2LensType },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
326 { 0x0084, EXIF_FORMAT_RATIONAL_UNSIGNED, -1, "Nikon.LensFocalLength",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
327 "Lens min/max focal length and aperture", NULL },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
328 { 0x0085, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.ManualFocusDistance",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
329 "Manual focus distance", NULL },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
330 { 0x0086, EXIF_FORMAT_RATIONAL, 1, "Nikon.DigitalZoomFactor",
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
331 "Digital zoom factor", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
332 { 0x0087, EXIF_FORMAT_BYTE_UNSIGNED, 1, "Nikon.FlashUsed", "Flash used", NikonTag2FlashUsed },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
333 { 0x0088, EXIF_FORMAT_UNDEFINED, 4, "Nikon.AutoFocusArea","Auto focus area",NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
334 /* { 0x0089, EXIF_FORMAT_SHORT_UNSIGNED, -1, "Nikon.Bracket/ShootingMode", NULL, NULL }, */
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
335 { 0x008d, EXIF_FORMAT_STRING, -1, "Nikon.ColorMode", "Color mode", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
336 { 0x008f, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.SceneMode", "Scene mode", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
337 { 0x0090, EXIF_FORMAT_STRING, -1, "Nikon.LightingType", "Lighting type",NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
338 { 0x0092, EXIF_FORMAT_SHORT, 1, "Nikon.HueAdjust", "Hue adjustment",NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
339 /* { 0x0094, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.Saturation", "Saturation", NikonTag2Saturation }, */
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
340 { 0x0095, EXIF_FORMAT_STRING, -1, "Nikon.NoiseReduction", "Noise reduction", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
341 { 0x00a7, EXIF_FORMAT_LONG_UNSIGNED, 1, "Nikon.ShutterCount", "Shutter release count", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
342 { 0x00a9, EXIF_FORMAT_STRING, -1, "Nikon.ImageOptimization", "Image optimization", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
343 { 0x00aa, EXIF_FORMAT_STRING, -1, "Nikon.Saturation", "Saturation", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
344 { 0x00ab, EXIF_FORMAT_STRING, -1, "Nikon.DigitalVariProg", "Digital Vari-program", NULL },
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
345 EXIF_MARKER_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
346 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
347
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
348 static ExifTextList NikonAFPoint[]= {
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
349 { 0, "center" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
350 { 1, "top" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
351 { 2, "bottom" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
352 { 3, "left" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
353 { 4, "right" },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
354 EXIF_TEXT_LIST_END
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
355 };
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
356
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
357
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1284
diff changeset
358 gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset,
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1284
diff changeset
359 guint size, ExifByteOrder bo)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
360 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 749
diff changeset
361 guchar *data;
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
362 ExifItem *item;
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
363
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
364 if (offset + 8 + 4 >= size) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
365
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
366 data = tiff + offset;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
367
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
368 /* Nikon tag format 1 */
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
369 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
370 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
371 if (exif_parse_IFD_table(exif, tiff, offset + 8, size,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
372 bo, 0, NikonExifMarkersList1) != 0)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
373 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
374 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
375 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
376 return TRUE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
377 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
378
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
379 /* Nikon tag format 2 uses Embedded tiff header */
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
380 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
381 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
382 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
383 guint tiff_header;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
384
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
385 tiff_header = offset + 10;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
386 if (exif_tiff_parse(exif, tiff + tiff_header, size - tiff_header,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
387 NikonExifMarkersList2) != 0)
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
388 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
389 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
390 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
391 }
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
392 /* Nikon tag format 3 uses format 2 tags without "Nikon" and tiff header */
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
393 else if (exif_parse_IFD_table(exif, tiff, offset, size,
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
394 bo, 0, NikonExifMarkersList2) != 0)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
395 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
396 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
397 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
398
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
399 item = exif_get_item(exif, "Nikon.AutoFocusArea");
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
400 if (item && item->data_len == 4 * sizeof(guchar))
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
401 {
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
402 static ExifMarker marker = { 0x0088, EXIF_FORMAT_STRING, -1,
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
403 "Nikon.AutoFocusPoint", "Auto focus point", NULL };
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
404 guchar *array = item->data;
58
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
405 gchar *text;
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
406 gint l;
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
407
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
408 text = exif_text_list_find_value(NikonAFPoint, (gint)array[1]);
58
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
409 l = strlen(text) + 1;
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
410
58
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
411 item = exif_item_new(marker.format, marker.tag, l, &marker);
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
412 memcpy(item->data, text, l);
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
413
58
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
414 g_free(text);
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
415
df73b94154e4 Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
416 exif->items = g_list_prepend(exif->items, item);
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
417 }
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
418
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
419 item = exif_get_item(exif, "Nikon.ISOSpeed");
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
420 if (item && item->data_len == 2 * 2)
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
421 {
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
422 static ExifMarker marker = { 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 1,
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
423 "ISOSpeedRatings", "ISO speed", NULL };
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
424 ExifItem *shadow;
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
425
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
426 shadow = exif_item_new(marker.format, marker.tag, 1, &marker);
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
427 memcpy(shadow->data, item->data + 2, 2);
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
428
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
429 exif->items = g_list_prepend(exif->items, shadow);
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
430 }
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
431
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
432 item = exif_get_item(exif, "Nikon.WhiteBalance");
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
433 if (item && item->format == EXIF_FORMAT_STRING)
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
434 {
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
435 static ExifMarker marker = { 0x0005, EXIF_FORMAT_STRING, -1,
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
436 "LightSource", "Light source", NULL };
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
437 ExifItem *shadow;
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
438
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
439 shadow = exif_item_new(marker.format, marker.tag, item->data_len, &marker);
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
440 memcpy(shadow->data, item->data, item->data_len);
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
441
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
442 exif->items = g_list_prepend(exif->items, shadow);
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
443 }
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
444
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
445 return TRUE;
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
446 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
447
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 281
diff changeset
448 #endif
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 138
diff changeset
449 /* not HAVE_EXIV2 */
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1000
diff changeset
450 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */