1 | /*
|
---|
2 | * This is public domain software - that is, you can do whatever you want
|
---|
3 | * with it, and include it software that is licensed under the GNU or the
|
---|
4 | * BSD license, or whatever other licence you choose, including proprietary
|
---|
5 | * closed source licenses. I do ask that you leave this header in tact.
|
---|
6 | *
|
---|
7 | * If you make modifications to this code that you think would benefit the
|
---|
8 | * wider community, please send me a copy and I'll post it on my site.
|
---|
9 | *
|
---|
10 | * If you make use of this code, I'd appreciate hearing about it.
|
---|
11 | * drew@drewnoakes.com
|
---|
12 | * Latest version of this software kept at
|
---|
13 | * http://drewnoakes.com/
|
---|
14 | *
|
---|
15 | * Created by dnoakes on 27-Nov-2002 10:12:05 using IntelliJ IDEA.
|
---|
16 | */
|
---|
17 | package com.drew.metadata.exif;
|
---|
18 |
|
---|
19 | import com.drew.lang.Rational;
|
---|
20 | import com.drew.metadata.Directory;
|
---|
21 | import com.drew.metadata.MetadataException;
|
---|
22 | import com.drew.metadata.TagDescriptor;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Fujifilm's digicam added the MakerNote tag from the Year2000's model (e.g.Finepix1400,
|
---|
26 | * Finepix4700). It uses IFD format and start from ASCII character 'FUJIFILM', and next 4
|
---|
27 | * bytes(value 0x000c) points the offset to first IFD entry. Example of actual data
|
---|
28 | * structure is shown below.
|
---|
29 | *
|
---|
30 | * :0000: 46 55 4A 49 46 49 4C 4D-0C 00 00 00 0F 00 00 00 :0000: FUJIFILM........
|
---|
31 | * :0010: 07 00 04 00 00 00 30 31-33 30 00 10 02 00 08 00 :0010: ......0130......
|
---|
32 | *
|
---|
33 | * There are two big differences to the other manufacturers.
|
---|
34 | * - Fujifilm's Exif data uses Motorola align, but MakerNote ignores it and uses Intel
|
---|
35 | * align.
|
---|
36 | * - The other manufacturer's MakerNote counts the "offset to data" from the first byte
|
---|
37 | * of TIFF header (same as the other IFD), but Fujifilm counts it from the first byte
|
---|
38 | * of MakerNote itself.
|
---|
39 | */
|
---|
40 | public class FujifilmMakernoteDescriptor extends TagDescriptor
|
---|
41 | {
|
---|
42 | public FujifilmMakernoteDescriptor(Directory directory)
|
---|
43 | {
|
---|
44 | super(directory);
|
---|
45 | }
|
---|
46 |
|
---|
47 | public String getDescription(int tagType) throws MetadataException
|
---|
48 | {
|
---|
49 | switch (tagType) {
|
---|
50 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_SHARPNESS:
|
---|
51 | return getSharpnessDescription();
|
---|
52 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_WHITE_BALANCE:
|
---|
53 | return getWhiteBalanceDescription();
|
---|
54 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR:
|
---|
55 | return getColorDescription();
|
---|
56 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_TONE:
|
---|
57 | return getToneDescription();
|
---|
58 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_MODE:
|
---|
59 | return getFlashModeDescription();
|
---|
60 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_STRENGTH:
|
---|
61 | return getFlashStrengthDescription();
|
---|
62 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_MACRO:
|
---|
63 | return getMacroDescription();
|
---|
64 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_MODE:
|
---|
65 | return getFocusModeDescription();
|
---|
66 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCHRO:
|
---|
67 | return getSlowSyncDescription();
|
---|
68 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_PICTURE_MODE:
|
---|
69 | return getPictureModeDescription();
|
---|
70 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_CONTINUOUS_TAKING_OR_AUTO_BRACKETTING:
|
---|
71 | return getContinuousTakingOrAutoBrackettingDescription();
|
---|
72 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_BLUR_WARNING:
|
---|
73 | return getBlurWarningDescription();
|
---|
74 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_WARNING:
|
---|
75 | return getFocusWarningDescription();
|
---|
76 | case FujifilmMakernoteDirectory.TAG_FUJIFILM_AE_WARNING:
|
---|
77 | return getAutoExposureWarningDescription();
|
---|
78 | default:
|
---|
79 | return _directory.getString(tagType);
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|
83 | public String getAutoExposureWarningDescription() throws MetadataException
|
---|
84 | {
|
---|
85 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_AE_WARNING)) return null;
|
---|
86 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_AE_WARNING);
|
---|
87 | switch (value) {
|
---|
88 | case 0:
|
---|
89 | return "AE good";
|
---|
90 | case 1:
|
---|
91 | return "Over exposed (>1/1000s @ F11)";
|
---|
92 | default:
|
---|
93 | return "Unknown (" + value + ")";
|
---|
94 | }
|
---|
95 | }
|
---|
96 |
|
---|
97 | public String getFocusWarningDescription() throws MetadataException
|
---|
98 | {
|
---|
99 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_WARNING)) return null;
|
---|
100 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_WARNING);
|
---|
101 | switch (value) {
|
---|
102 | case 0:
|
---|
103 | return "Auto focus good";
|
---|
104 | case 1:
|
---|
105 | return "Out of focus";
|
---|
106 | default:
|
---|
107 | return "Unknown (" + value + ")";
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | public String getBlurWarningDescription() throws MetadataException
|
---|
112 | {
|
---|
113 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_BLUR_WARNING)) return null;
|
---|
114 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_BLUR_WARNING);
|
---|
115 | switch (value) {
|
---|
116 | case 0:
|
---|
117 | return "No blur warning";
|
---|
118 | case 1:
|
---|
119 | return "Blur warning";
|
---|
120 | default:
|
---|
121 | return "Unknown (" + value + ")";
|
---|
122 | }
|
---|
123 | }
|
---|
124 |
|
---|
125 | public String getContinuousTakingOrAutoBrackettingDescription() throws MetadataException
|
---|
126 | {
|
---|
127 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_CONTINUOUS_TAKING_OR_AUTO_BRACKETTING)) return null;
|
---|
128 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_CONTINUOUS_TAKING_OR_AUTO_BRACKETTING);
|
---|
129 | switch (value) {
|
---|
130 | case 0:
|
---|
131 | return "Off";
|
---|
132 | case 1:
|
---|
133 | return "On";
|
---|
134 | default:
|
---|
135 | return "Unknown (" + value + ")";
|
---|
136 | }
|
---|
137 | }
|
---|
138 |
|
---|
139 | public String getPictureModeDescription() throws MetadataException
|
---|
140 | {
|
---|
141 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_PICTURE_MODE)) return null;
|
---|
142 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_PICTURE_MODE);
|
---|
143 | switch (value) {
|
---|
144 | case 0:
|
---|
145 | return "Auto";
|
---|
146 | case 1:
|
---|
147 | return "Portrait scene";
|
---|
148 | case 2:
|
---|
149 | return "Landscape scene";
|
---|
150 | case 4:
|
---|
151 | return "Sports scene";
|
---|
152 | case 5:
|
---|
153 | return "Night scene";
|
---|
154 | case 6:
|
---|
155 | return "Program AE";
|
---|
156 | case 256:
|
---|
157 | return "Aperture priority AE";
|
---|
158 | case 512:
|
---|
159 | return "Shutter priority AE";
|
---|
160 | case 768:
|
---|
161 | return "Manual exposure";
|
---|
162 | default:
|
---|
163 | return "Unknown (" + value + ")";
|
---|
164 | }
|
---|
165 | }
|
---|
166 |
|
---|
167 | public String getSlowSyncDescription() throws MetadataException
|
---|
168 | {
|
---|
169 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCHRO)) return null;
|
---|
170 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCHRO);
|
---|
171 | switch (value) {
|
---|
172 | case 0:
|
---|
173 | return "Off";
|
---|
174 | case 1:
|
---|
175 | return "On";
|
---|
176 | default:
|
---|
177 | return "Unknown (" + value + ")";
|
---|
178 | }
|
---|
179 | }
|
---|
180 |
|
---|
181 | public String getFocusModeDescription() throws MetadataException
|
---|
182 | {
|
---|
183 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_MODE)) return null;
|
---|
184 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_MODE);
|
---|
185 | switch (value) {
|
---|
186 | case 0:
|
---|
187 | return "Auto focus";
|
---|
188 | case 1:
|
---|
189 | return "Manual focus";
|
---|
190 | default:
|
---|
191 | return "Unknown (" + value + ")";
|
---|
192 | }
|
---|
193 | }
|
---|
194 |
|
---|
195 | public String getMacroDescription() throws MetadataException
|
---|
196 | {
|
---|
197 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_MACRO)) return null;
|
---|
198 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_MACRO);
|
---|
199 | switch (value) {
|
---|
200 | case 0:
|
---|
201 | return "Off";
|
---|
202 | case 1:
|
---|
203 | return "On";
|
---|
204 | default:
|
---|
205 | return "Unknown (" + value + ")";
|
---|
206 | }
|
---|
207 | }
|
---|
208 |
|
---|
209 | public String getFlashStrengthDescription() throws MetadataException
|
---|
210 | {
|
---|
211 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_STRENGTH)) return null;
|
---|
212 | Rational value = _directory.getRational(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_STRENGTH);
|
---|
213 | return value.toSimpleString(false) + " EV (Apex)";
|
---|
214 | }
|
---|
215 |
|
---|
216 | public String getFlashModeDescription() throws MetadataException
|
---|
217 | {
|
---|
218 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_MODE)) return null;
|
---|
219 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_MODE);
|
---|
220 | switch (value) {
|
---|
221 | case 0:
|
---|
222 | return "Auto";
|
---|
223 | case 1:
|
---|
224 | return "On";
|
---|
225 | case 2:
|
---|
226 | return "Off";
|
---|
227 | case 3:
|
---|
228 | return "Red-eye reduction";
|
---|
229 | default:
|
---|
230 | return "Unknown (" + value + ")";
|
---|
231 | }
|
---|
232 | }
|
---|
233 |
|
---|
234 | public String getToneDescription() throws MetadataException
|
---|
235 | {
|
---|
236 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_TONE)) return null;
|
---|
237 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_TONE);
|
---|
238 | switch (value) {
|
---|
239 | case 0:
|
---|
240 | return "Normal (STD)";
|
---|
241 | case 256:
|
---|
242 | return "High (HARD)";
|
---|
243 | case 512:
|
---|
244 | return "Low (ORG)";
|
---|
245 | default:
|
---|
246 | return "Unknown (" + value + ")";
|
---|
247 | }
|
---|
248 | }
|
---|
249 |
|
---|
250 | public String getColorDescription() throws MetadataException
|
---|
251 | {
|
---|
252 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR)) return null;
|
---|
253 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR);
|
---|
254 | switch (value) {
|
---|
255 | case 0:
|
---|
256 | return "Normal (STD)";
|
---|
257 | case 256:
|
---|
258 | return "High";
|
---|
259 | case 512:
|
---|
260 | return "Low (ORG)";
|
---|
261 | default:
|
---|
262 | return "Unknown (" + value + ")";
|
---|
263 | }
|
---|
264 | }
|
---|
265 |
|
---|
266 | public String getWhiteBalanceDescription() throws MetadataException
|
---|
267 | {
|
---|
268 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_WHITE_BALANCE)) return null;
|
---|
269 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_WHITE_BALANCE);
|
---|
270 | switch (value) {
|
---|
271 | case 0:
|
---|
272 | return "Auto";
|
---|
273 | case 256:
|
---|
274 | return "Daylight";
|
---|
275 | case 512:
|
---|
276 | return "Cloudy";
|
---|
277 | case 768:
|
---|
278 | return "DaylightColor-fluorescence";
|
---|
279 | case 769:
|
---|
280 | return "DaywhiteColor-fluorescence";
|
---|
281 | case 770:
|
---|
282 | return "White-fluorescence";
|
---|
283 | case 1024:
|
---|
284 | return "Incandenscense";
|
---|
285 | case 3840:
|
---|
286 | return "Custom white balance";
|
---|
287 | default:
|
---|
288 | return "Unknown (" + value + ")";
|
---|
289 | }
|
---|
290 | }
|
---|
291 |
|
---|
292 | public String getSharpnessDescription() throws MetadataException
|
---|
293 | {
|
---|
294 | if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_SHARPNESS)) return null;
|
---|
295 | int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_SHARPNESS);
|
---|
296 | switch (value) {
|
---|
297 | case 1:
|
---|
298 | return "Softest";
|
---|
299 | case 2:
|
---|
300 | return "Soft";
|
---|
301 | case 3:
|
---|
302 | return "Normal";
|
---|
303 | case 4:
|
---|
304 | return "Hard";
|
---|
305 | case 5:
|
---|
306 | return "Hardest";
|
---|
307 | default:
|
---|
308 | return "Unknown (" + value + ")";
|
---|
309 | }
|
---|
310 | }
|
---|
311 | }
|
---|