Mercurial > geeqie.yaz
comparison src/format_fuji.c @ 51:276ea4c98d33
Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
* exif.[ch]: Use glib provided data types and byte order functions for
consistency with rest of application. Made several more functions
available in the header. Use MakerNote parsing from format_raw.c.
* format_canon.[ch]: Changes to match exif.h and format_raw.h.
* format_fuji.[ch]: Add support for Fuji EXIF MakerNote.
* format_nikon.[ch]: New files, add support for Nikon EXIF MakerNote.
* format_raw.[ch]: Add EXIF MakerNote parser functions to gather all
camera formats here (similar to existing raw format list).
* src/Makefile.am: Add format_nikon.[ch].
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
##### an offical release when making enhancements and translation updates. #####
author | gqview |
---|---|
date | Sun, 05 Jun 2005 02:48:54 +0000 |
parents | 7cfa60beda76 |
children | 00843150f7c8 |
comparison
equal
deleted
inserted
replaced
50:3b83fb81afc4 | 51:276ea4c98d33 |
---|---|
24 #include "intl.h" | 24 #include "intl.h" |
25 | 25 |
26 #include "format_fuji.h" | 26 #include "format_fuji.h" |
27 #include "format_raw.h" | 27 #include "format_raw.h" |
28 | 28 |
29 #include "exif.h" | |
29 | 30 |
30 gint format_raw_test_fuji(const void *data, const guint len, | 31 |
31 guint *image_offset, guint *exif_offset) | 32 gint format_fuji_raw(const void *data, const guint len, |
33 guint *image_offset, guint *exif_offset) | |
32 { | 34 { |
33 guint io; | 35 guint io; |
34 guint eo; | 36 guint eo; |
35 | 37 |
36 if (len < 128 || | 38 if (len < 128 || |
55 | 57 |
56 return TRUE; | 58 return TRUE; |
57 } | 59 } |
58 | 60 |
59 | 61 |
62 /* | |
63 *----------------------------------------------------------------------------- | |
64 * EXIF Makernote for Fujifilm | |
65 *----------------------------------------------------------------------------- | |
66 */ | |
67 | |
68 static ExifTextList FujiTagSharpness[] = { | |
69 { 1, "soft" }, | |
70 { 2, "soft" }, | |
71 { 3, "normal" }, | |
72 { 4, "hard" }, | |
73 { 5, "hard" }, | |
74 EXIF_TEXT_LIST_END | |
75 }; | |
76 | |
77 static ExifTextList FujiTagWhiteBalance[]= { | |
78 { 0, "auto" }, | |
79 { 256, "daylight" }, | |
80 { 512, "cloudy" }, | |
81 { 768, "daylight color-fluorescence" }, | |
82 { 769, "daywhite color-fluorescence" }, | |
83 { 770, "white-fluorescence" }, | |
84 { 1024, "incandescent" }, | |
85 { 3840, "custom" }, | |
86 EXIF_TEXT_LIST_END | |
87 }; | |
88 | |
89 static ExifTextList FujiTagColorTone[]= { | |
90 { 0, "normal" }, | |
91 { 256, "high" }, | |
92 { 512, "low" }, | |
93 EXIF_TEXT_LIST_END | |
94 }; | |
95 | |
96 static ExifTextList FujiTagFlashMode[]= { | |
97 { 0, "auto" }, | |
98 { 1, "on" }, | |
99 { 2, "off" }, | |
100 { 3, "red-eye reduction" }, | |
101 EXIF_TEXT_LIST_END | |
102 }; | |
103 | |
104 static ExifTextList FujiTagOffOn[]= { | |
105 { 0, "off" }, | |
106 { 1, "on" }, | |
107 EXIF_TEXT_LIST_END | |
108 }; | |
109 | |
110 static ExifTextList FujiTagFocusMode[]= { | |
111 { 0, "auto" }, | |
112 { 1, "manual" }, | |
113 EXIF_TEXT_LIST_END | |
114 }; | |
115 | |
116 static ExifTextList FujiTagPictureMode[]= { | |
117 { 0, "auto" }, | |
118 { 1, "portrait" }, | |
119 { 2, "landscape" }, | |
120 { 4, "sports" }, | |
121 { 5, "night" }, | |
122 { 6, "program AE" }, | |
123 { 256, "aperture priority AE" }, | |
124 { 512, "shutter priority AE" }, | |
125 { 768, "manual" }, | |
126 EXIF_TEXT_LIST_END | |
127 }; | |
128 | |
129 static ExifTextList FujiTagNoYes[]= { | |
130 { 0, "no" }, | |
131 { 1, "yes" }, | |
132 EXIF_TEXT_LIST_END | |
133 }; | |
134 | |
135 #if 0 | |
136 static ExifTextList FujiTag[]= { | |
137 { , "" }, | |
138 { , "" }, | |
139 EXIF_TEXT_LIST_END | |
140 }; | |
141 #endif | |
142 | |
143 | |
144 static ExifMarker FujiExifMarkersList[] = { | |
145 { 0x1000, EXIF_FORMAT_STRING, 8, "MkN.Fuji.Quality", "Quality", NULL }, | |
146 { 0x1001, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.Sharpness", "Sharpness", FujiTagSharpness }, | |
147 { 0x1002, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.WhiteBalance","White balance",FujiTagWhiteBalance }, | |
148 { 0x1003, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.Color", "Color", FujiTagColorTone }, | |
149 { 0x1004, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.Tone", "Tone", FujiTagColorTone }, | |
150 { 0x1010, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.FlashMode", "Flash mode", FujiTagFlashMode }, | |
151 { 0x1011, EXIF_FORMAT_RATIONAL, 1, "MkN.Fuji.FlashStrength", "Flash strength", NULL }, | |
152 { 0x1020, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.Macro", "Macro", FujiTagOffOn }, | |
153 { 0x1021, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.FocusMode", "Focus mode", FujiTagFocusMode }, | |
154 { 0x1030, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.SlowSync", "Slow synchro", FujiTagOffOn }, | |
155 { 0x1031, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.PictureMode", "Picture mode", FujiTagPictureMode }, | |
156 { 0x1100, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.ContTake/Bracket", | |
157 "Continuous / Auto bracket", FujiTagOffOn }, | |
158 { 0x1300, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.BlurWarning", "Blue warning", FujiTagNoYes }, | |
159 { 0x1301, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.FocusWarning","Focus warning",FujiTagNoYes }, | |
160 { 0x1302, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Fuji.AEWarning", "AE warning", FujiTagNoYes }, | |
161 EXIF_MARKER_LIST_END | |
162 }; | |
163 | |
164 | |
165 | |
166 gint format_fuji_makernote(ExifData *exif, unsigned char *tiff, guint offset, | |
167 guint size, ExifByteOrder byte_order) | |
168 { | |
169 unsigned char *data; | |
170 guint ifdstart; | |
171 | |
172 if (offset + 8 + 4 >= size) return FALSE; | |
173 | |
174 data = tiff + offset; | |
175 if (memcmp(data, "FUJIFILM", 8) != 0) return FALSE; | |
176 | |
177 ifdstart = exif_byte_get_int32(data + 8, EXIF_BYTE_ORDER_INTEL); | |
178 if (offset + ifdstart >= size) return FALSE; | |
179 | |
180 if (exif_parse_IFD_table(exif, tiff + offset, ifdstart, size - offset, | |
181 EXIF_BYTE_ORDER_INTEL, FujiExifMarkersList) != 0) | |
182 { | |
183 return FALSE; | |
184 } | |
185 | |
186 return TRUE; | |
187 } | |
188 |