annotate src/format_fuji.c @ 138:71e1ebee420e

replaced gchar* path with FileData *fd
author nadvornik
date Tue, 11 Sep 2007 20:06:29 +0000
parents 9c355d5c8619
children 0ca3b4c8ffae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
1 /*
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
2 * GQView
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
3 * (C) 2005 John Ellis
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
4 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
5 * Authors:
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
6 * Original version 2005 Lars Ellenberg, base on dcraw by David coffin.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
7 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
11 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
12
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
13 #ifdef HAVE_CONFIG_H
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
14 # include "config.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
15 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
16
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
17
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
18 #include <stdio.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
19 #include <string.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
20 #include <unistd.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
21
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
22 #include <glib.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
23
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
24 #include "intl.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
25
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 108
diff changeset
26 #include "gqview.h"
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
27 #include "format_fuji.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
28 #include "format_raw.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
29
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
30 #include "exif.h"
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
31
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
32
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
33 /*
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
34 *-----------------------------------------------------------------------------
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
35 * Raw (RAF) embedded jpeg extraction for Fujifilm
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
36 *-----------------------------------------------------------------------------
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
37 */
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
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
40 gint format_fuji_raw(unsigned char *data, const guint len,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
41 guint *image_offset, guint *exif_offset)
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
42 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
43 guint io;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
44 guint eo;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
46 if (len < 128 ||
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
47 memcmp(data, "FUJIFILM", 8) != 0)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
48 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
49 return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
50 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
51
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
52 /* offset to jpeg is embedded at bytes 84-87 */
108
9c355d5c8619 Fri Nov 10 16:11:28 2006 John Ellis <johne@verizon.net>
gqview
parents: 101
diff changeset
53 io = exif_byte_get_int32(data + 84, EXIF_BYTE_ORDER_MOTOROLA);
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
54 if (io + 4 > len) return FALSE;
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
55
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
56 /* verify jpeg marker */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
57 if (memcmp(data + io, "\xff\xd8\xff\xe1", 4) != 0)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
58 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
59 return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
60 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
61
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
62 /* Exif is stored in the jpeg, so use the same offset */
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
63 eo=io;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
64
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
65 if (image_offset) *image_offset = io;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
66 if (exif_offset) *exif_offset = eo;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
67
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
68 return TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
69 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
70
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
71
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
72 /*
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
73 *-----------------------------------------------------------------------------
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
74 * EXIF Makernote for Fujifilm
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
75 *-----------------------------------------------------------------------------
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
76 */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
77
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
78 static ExifTextList FujiTagSharpness[] = {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
79 { 1, "soft" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
80 { 2, "soft" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
81 { 3, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
82 { 4, "hard" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
83 { 5, "hard" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
84 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
85 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
86
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
87 static ExifTextList FujiTagWhiteBalance[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
88 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
89 { 256, "daylight" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
90 { 512, "cloudy" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
91 { 768, "daylight color-fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
92 { 769, "daywhite color-fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
93 { 770, "white-fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
94 { 1024, "incandescent" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
95 { 3840, "custom" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
96 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
97 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
98
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
99 static ExifTextList FujiTagColorTone[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
100 { 0, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
101 { 256, "high" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
102 { 512, "low" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
103 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
104 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
105
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
106 static ExifTextList FujiTagFlashMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
107 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
108 { 1, "on" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
109 { 2, "off" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
110 { 3, "red-eye reduction" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
111 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
112 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
113
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
114 static ExifTextList FujiTagOffOn[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
115 { 0, "off" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
116 { 1, "on" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
117 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
118 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
119
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
120 static ExifTextList FujiTagFocusMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
121 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
122 { 1, "manual" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
123 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
124 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
125
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
126 static ExifTextList FujiTagPictureMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
127 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
128 { 1, "portrait" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
129 { 2, "landscape" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
130 { 4, "sports" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
131 { 5, "night" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
132 { 6, "program AE" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
133 { 256, "aperture priority AE" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
134 { 512, "shutter priority AE" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
135 { 768, "manual" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
136 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
137 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
138
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
139 static ExifTextList FujiTagNoYes[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
140 { 0, "no" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
141 { 1, "yes" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
142 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
143 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
144
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
145 #if 0
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
146 static ExifTextList FujiTag[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
147 { , "" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
148 { , "" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
149 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
150 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
151 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
152
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
153
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
154 static ExifMarker FujiExifMarkersList[] = {
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
155 { 0x1000, EXIF_FORMAT_STRING, 8, "Fuji.Quality", "Quality", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
156 { 0x1001, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Sharpness", "Sharpness", FujiTagSharpness },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
157 { 0x1002, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.WhiteBalance", "White balance",FujiTagWhiteBalance },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
158 { 0x1003, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Color", "Color", FujiTagColorTone },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
159 { 0x1004, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Tone", "Tone", FujiTagColorTone },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
160 { 0x1010, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.FlashMode", "Flash mode", FujiTagFlashMode },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
161 { 0x1011, EXIF_FORMAT_RATIONAL, 1, "Fuji.FlashStrength", "Flash strength", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
162 { 0x1020, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Macro", "Macro", FujiTagOffOn },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
163 { 0x1021, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.FocusMode", "Focus mode", FujiTagFocusMode },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
164 { 0x1030, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.SlowSync", "Slow synchro", FujiTagOffOn },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
165 { 0x1031, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.PictureMode", "Picture mode", FujiTagPictureMode },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
166 { 0x1100, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.ContTake/Bracket",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
167 "Continuous / Auto bracket", FujiTagOffOn },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
168 { 0x1300, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.BlurWarning", "Blue warning", FujiTagNoYes },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
169 { 0x1301, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.FocusWarning", "Focus warning",FujiTagNoYes },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
170 { 0x1302, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.AEWarning", "AE warning", FujiTagNoYes },
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
171 EXIF_MARKER_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
172 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
173
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
174
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
175
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
176 gint format_fuji_makernote(ExifData *exif, unsigned char *tiff, guint offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
177 guint size, ExifByteOrder bo)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
178 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
179 unsigned char *data;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
180 guint ifdstart;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
181
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
182 if (offset + 8 + 4 >= size) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
183
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
184 data = tiff + offset;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
185
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
186 /* Fuji tag format starts with "FUJIFILM",
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
187 * followed by 4 bytes indicating offset to IFD directory using Fuji tags,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
188 * byte order is always little endian (II).
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
189 */
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
190 if (memcmp(data, "FUJIFILM", 8) != 0) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
191
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
192 ifdstart = exif_byte_get_int32(data + 8, EXIF_BYTE_ORDER_INTEL);
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
193 if (offset + ifdstart >= size) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
194
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
195 if (exif_parse_IFD_table(exif, tiff + offset, ifdstart, size - offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
196 EXIF_BYTE_ORDER_INTEL, 0, FujiExifMarkersList) != 0)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
197 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
198 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
199 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
200
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
201 return TRUE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
202 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
203