1 | /*
|
---|
2 | * Copyright 2002-2012 Drew Noakes
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | * More information about this project is available at:
|
---|
17 | *
|
---|
18 | * http://drewnoakes.com/code/exif/
|
---|
19 | * http://code.google.com/p/metadata-extractor/
|
---|
20 | */
|
---|
21 | package com.drew.metadata.exif;
|
---|
22 |
|
---|
23 | import com.drew.lang.BufferBoundsException;
|
---|
24 | import com.drew.lang.BufferReader;
|
---|
25 | import com.drew.lang.ByteArrayReader;
|
---|
26 | import com.drew.lang.annotations.NotNull;
|
---|
27 | import com.drew.lang.annotations.Nullable;
|
---|
28 | import com.drew.metadata.Age;
|
---|
29 | import com.drew.metadata.Face;
|
---|
30 | import com.drew.metadata.TagDescriptor;
|
---|
31 |
|
---|
32 | import java.io.UnsupportedEncodingException;
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Provides human-readable string representations of tag values stored in a <code>PanasonicMakernoteDirectory</code>.
|
---|
36 | * <p/>
|
---|
37 | * Some information about this makernote taken from here:
|
---|
38 | * <ul>
|
---|
39 | * <li><a href="http://www.ozhiker.com/electronics/pjmt/jpeg_info/panasonic_mn.html">http://www.ozhiker.com/electronics/pjmt/jpeg_info/panasonic_mn.html</a></li>
|
---|
40 | * <li><a href="http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Panasonic.html">http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Panasonic.html</a></li>
|
---|
41 | * </ul>
|
---|
42 | *
|
---|
43 | * @author Drew Noakes http://drewnoakes.com, Philipp Sandhaus
|
---|
44 | */
|
---|
45 | public class PanasonicMakernoteDescriptor extends TagDescriptor<PanasonicMakernoteDirectory>
|
---|
46 | {
|
---|
47 | public PanasonicMakernoteDescriptor(@NotNull PanasonicMakernoteDirectory directory)
|
---|
48 | {
|
---|
49 | super(directory);
|
---|
50 | }
|
---|
51 |
|
---|
52 | @Nullable
|
---|
53 | public String getDescription(int tagType)
|
---|
54 | {
|
---|
55 | switch (tagType) {
|
---|
56 | case PanasonicMakernoteDirectory.TAG_QUALITY_MODE:
|
---|
57 | return getQualityModeDescription();
|
---|
58 | case PanasonicMakernoteDirectory.TAG_VERSION:
|
---|
59 | return getVersionDescription();
|
---|
60 | case PanasonicMakernoteDirectory.TAG_WHITE_BALANCE:
|
---|
61 | return getWhiteBalanceDescription();
|
---|
62 | case PanasonicMakernoteDirectory.TAG_FOCUS_MODE:
|
---|
63 | return getFocusModeDescription();
|
---|
64 | case PanasonicMakernoteDirectory.TAG_AF_AREA_MODE:
|
---|
65 | return getAfAreaModeDescription();
|
---|
66 | case PanasonicMakernoteDirectory.TAG_IMAGE_STABILIZATION:
|
---|
67 | return getImageStabilizationDescription();
|
---|
68 | case PanasonicMakernoteDirectory.TAG_MACRO_MODE:
|
---|
69 | return getMacroModeDescription();
|
---|
70 | case PanasonicMakernoteDirectory.TAG_RECORD_MODE:
|
---|
71 | return getRecordModeDescription();
|
---|
72 | case PanasonicMakernoteDirectory.TAG_AUDIO:
|
---|
73 | return getAudioDescription();
|
---|
74 | case PanasonicMakernoteDirectory.TAG_UNKNOWN_DATA_DUMP:
|
---|
75 | return getUnknownDataDumpDescription();
|
---|
76 | case PanasonicMakernoteDirectory.TAG_COLOR_EFFECT:
|
---|
77 | return getColorEffectDescription();
|
---|
78 | case PanasonicMakernoteDirectory.TAG_UPTIME:
|
---|
79 | return getUptimeDescription();
|
---|
80 | case PanasonicMakernoteDirectory.TAG_BURST_MODE:
|
---|
81 | return getBurstModeDescription();
|
---|
82 | case PanasonicMakernoteDirectory.TAG_CONTRAST_MODE:
|
---|
83 | return getContrastModeDescription();
|
---|
84 | case PanasonicMakernoteDirectory.TAG_NOISE_REDUCTION:
|
---|
85 | return getNoiseReductionDescription();
|
---|
86 | case PanasonicMakernoteDirectory.TAG_SELF_TIMER:
|
---|
87 | return getSelfTimerDescription();
|
---|
88 | case PanasonicMakernoteDirectory.TAG_ROTATION:
|
---|
89 | return getRotationDescription();
|
---|
90 | case PanasonicMakernoteDirectory.TAG_AF_ASSIST_LAMP:
|
---|
91 | return getAfAssistLampDescription();
|
---|
92 | case PanasonicMakernoteDirectory.TAG_COLOR_MODE:
|
---|
93 | return getColorModeDescription();
|
---|
94 | case PanasonicMakernoteDirectory.TAG_OPTICAL_ZOOM_MODE:
|
---|
95 | return getOpticalZoomModeDescription();
|
---|
96 | case PanasonicMakernoteDirectory.TAG_CONVERSION_LENS:
|
---|
97 | return getConversionLensDescription();
|
---|
98 | case PanasonicMakernoteDirectory.TAG_CONTRAST:
|
---|
99 | return getContrastDescription();
|
---|
100 | case PanasonicMakernoteDirectory.TAG_WORLD_TIME_LOCATION:
|
---|
101 | return getWorldTimeLocationDescription();
|
---|
102 | case PanasonicMakernoteDirectory.TAG_ADVANCED_SCENE_MODE:
|
---|
103 | return getAdvancedSceneModeDescription();
|
---|
104 | case PanasonicMakernoteDirectory.TAG_FACE_DETECTION_INFO:
|
---|
105 | return getDetectedFacesDescription();
|
---|
106 | case PanasonicMakernoteDirectory.TAG_TRANSFORM:
|
---|
107 | return getTransformDescription();
|
---|
108 | case PanasonicMakernoteDirectory.TAG_TRANSFORM_1:
|
---|
109 | return getTransform1Description();
|
---|
110 | case PanasonicMakernoteDirectory.TAG_INTELLIGENT_EXPOSURE:
|
---|
111 | return getIntelligentExposureDescription();
|
---|
112 | case PanasonicMakernoteDirectory.TAG_FLASH_WARNING:
|
---|
113 | return getFlashWarningDescription();
|
---|
114 | case PanasonicMakernoteDirectory.TAG_COUNTRY:
|
---|
115 | return getCountryDescription();
|
---|
116 | case PanasonicMakernoteDirectory.TAG_STATE:
|
---|
117 | return getStateDescription();
|
---|
118 | case PanasonicMakernoteDirectory.TAG_CITY:
|
---|
119 | return getCityDescription();
|
---|
120 | case PanasonicMakernoteDirectory.TAG_LANDMARK:
|
---|
121 | return getLandmarkDescription();
|
---|
122 | case PanasonicMakernoteDirectory.TAG_INTELLIGENT_RESOLUTION:
|
---|
123 | return getIntelligentResolutionDescription();
|
---|
124 | case PanasonicMakernoteDirectory.TAG_FACE_RECOGNITION_INFO:
|
---|
125 | return getRecognizedFacesDescription();
|
---|
126 | case PanasonicMakernoteDirectory.TAG_PRINT_IMAGE_MATCHING_INFO:
|
---|
127 | return getPrintImageMatchingInfoDescription();
|
---|
128 | case PanasonicMakernoteDirectory.TAG_SCENE_MODE:
|
---|
129 | return getSceneModeDescription();
|
---|
130 | case PanasonicMakernoteDirectory.TAG_FLASH_FIRED:
|
---|
131 | return getFlashFiredDescription();
|
---|
132 | case PanasonicMakernoteDirectory.TAG_TEXT_STAMP:
|
---|
133 | return getTextStampDescription();
|
---|
134 | case PanasonicMakernoteDirectory.TAG_TEXT_STAMP_1:
|
---|
135 | return getTextStamp1Description();
|
---|
136 | case PanasonicMakernoteDirectory.TAG_TEXT_STAMP_2:
|
---|
137 | return getTextStamp2Description();
|
---|
138 | case PanasonicMakernoteDirectory.TAG_TEXT_STAMP_3:
|
---|
139 | return getTextStamp3Description();
|
---|
140 | case PanasonicMakernoteDirectory.TAG_MAKERNOTE_VERSION:
|
---|
141 | return getMakernoteVersionDescription();
|
---|
142 | case PanasonicMakernoteDirectory.TAG_EXIF_VERSION:
|
---|
143 | return getExifVersionDescription();
|
---|
144 | case PanasonicMakernoteDirectory.TAG_INTERNAL_SERIAL_NUMBER:
|
---|
145 | return getInternalSerialNumberDescription();
|
---|
146 | case PanasonicMakernoteDirectory.TAG_TITLE:
|
---|
147 | return getTitleDescription();
|
---|
148 | case PanasonicMakernoteDirectory.TAG_BABY_NAME:
|
---|
149 | return getBabyNameDescription();
|
---|
150 | case PanasonicMakernoteDirectory.TAG_LOCATION:
|
---|
151 | return getLocationDescription();
|
---|
152 | case PanasonicMakernoteDirectory.TAG_BABY_AGE:
|
---|
153 | return getBabyAgeDescription();
|
---|
154 | case PanasonicMakernoteDirectory.TAG_BABY_AGE_1:
|
---|
155 | return getBabyAge1Description();
|
---|
156 | default:
|
---|
157 | return super.getDescription(tagType);
|
---|
158 | }
|
---|
159 | }
|
---|
160 |
|
---|
161 | @Nullable
|
---|
162 | public String getPrintImageMatchingInfoDescription()
|
---|
163 | {
|
---|
164 | byte[] values = _directory.getByteArray(PanasonicMakernoteDirectory.TAG_PRINT_IMAGE_MATCHING_INFO);
|
---|
165 | if (values == null)
|
---|
166 | return null;
|
---|
167 | return "(" + values.length + " bytes)";
|
---|
168 | }
|
---|
169 |
|
---|
170 | @Nullable
|
---|
171 | public String getTextStampDescription()
|
---|
172 | {
|
---|
173 | return getOnOffDescription(PanasonicMakernoteDirectory.TAG_TEXT_STAMP);
|
---|
174 | }
|
---|
175 |
|
---|
176 | @Nullable
|
---|
177 | public String getTextStamp1Description()
|
---|
178 | {
|
---|
179 | return getOnOffDescription(PanasonicMakernoteDirectory.TAG_TEXT_STAMP_1);
|
---|
180 | }
|
---|
181 |
|
---|
182 | @Nullable
|
---|
183 | public String getTextStamp2Description()
|
---|
184 | {
|
---|
185 | return getOnOffDescription(PanasonicMakernoteDirectory.TAG_TEXT_STAMP_2);
|
---|
186 | }
|
---|
187 |
|
---|
188 | @Nullable
|
---|
189 | public String getTextStamp3Description()
|
---|
190 | {
|
---|
191 | return getOnOffDescription(PanasonicMakernoteDirectory.TAG_TEXT_STAMP_3);
|
---|
192 | }
|
---|
193 |
|
---|
194 | @Nullable
|
---|
195 | public String getMacroModeDescription()
|
---|
196 | {
|
---|
197 | return getOnOffDescription(PanasonicMakernoteDirectory.TAG_MACRO_MODE);
|
---|
198 | }
|
---|
199 |
|
---|
200 | @Nullable
|
---|
201 | public String getFlashFiredDescription()
|
---|
202 | {
|
---|
203 | return getOnOffDescription(PanasonicMakernoteDirectory.TAG_FLASH_FIRED);
|
---|
204 | }
|
---|
205 |
|
---|
206 | @Nullable
|
---|
207 | public String getImageStabilizationDescription()
|
---|
208 | {
|
---|
209 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_IMAGE_STABILIZATION);
|
---|
210 | if (value == null)
|
---|
211 | return null;
|
---|
212 | switch (value) {
|
---|
213 | case 2:
|
---|
214 | return "On, Mode 1";
|
---|
215 | case 3:
|
---|
216 | return "Off";
|
---|
217 | case 4:
|
---|
218 | return "On, Mode 2";
|
---|
219 | default:
|
---|
220 | return "Unknown (" + value + ")";
|
---|
221 | }
|
---|
222 | }
|
---|
223 |
|
---|
224 | @Nullable
|
---|
225 | public String getAudioDescription()
|
---|
226 | {
|
---|
227 | return getOnOffDescription(PanasonicMakernoteDirectory.TAG_AUDIO);
|
---|
228 | }
|
---|
229 |
|
---|
230 | @Nullable
|
---|
231 | public String getTransformDescription()
|
---|
232 | {
|
---|
233 | return getTransformDescription(PanasonicMakernoteDirectory.TAG_TRANSFORM);
|
---|
234 | }
|
---|
235 |
|
---|
236 | @Nullable
|
---|
237 | public String getTransform1Description()
|
---|
238 | {
|
---|
239 | return getTransformDescription(PanasonicMakernoteDirectory.TAG_TRANSFORM_1);
|
---|
240 | }
|
---|
241 |
|
---|
242 | @Nullable
|
---|
243 | private String getTransformDescription(int tag)
|
---|
244 | {
|
---|
245 | byte[] values = _directory.getByteArray(tag);
|
---|
246 | if (values == null)
|
---|
247 | return null;
|
---|
248 |
|
---|
249 | BufferReader reader = new ByteArrayReader(values);
|
---|
250 |
|
---|
251 | try
|
---|
252 | {
|
---|
253 | int val1 = reader.getUInt16(0);
|
---|
254 | int val2 = reader.getUInt16(2);
|
---|
255 |
|
---|
256 | if (val1 == -1 && val2 == 1)
|
---|
257 | return "Slim Low";
|
---|
258 | if (val1 == -3 && val2 == 2)
|
---|
259 | return "Slim High";
|
---|
260 | if (val1 == 0 && val2 == 0)
|
---|
261 | return "Off";
|
---|
262 | if (val1 == 1 && val2 == 1)
|
---|
263 | return "Stretch Low";
|
---|
264 | if (val1 == 3 && val2 == 2)
|
---|
265 | return "Stretch High";
|
---|
266 |
|
---|
267 | return "Unknown (" + val1 + " " + val2 + ")";
|
---|
268 | } catch (BufferBoundsException e) {
|
---|
269 | return null ;
|
---|
270 | }
|
---|
271 | }
|
---|
272 |
|
---|
273 | @Nullable
|
---|
274 | public String getIntelligentExposureDescription()
|
---|
275 | {
|
---|
276 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_INTELLIGENT_EXPOSURE);
|
---|
277 | if (value == null)
|
---|
278 | return null;
|
---|
279 | switch (value) {
|
---|
280 | case 0:
|
---|
281 | return "Off";
|
---|
282 | case 1:
|
---|
283 | return "Low";
|
---|
284 | case 2:
|
---|
285 | return "Standard";
|
---|
286 | case 3:
|
---|
287 | return "High";
|
---|
288 |
|
---|
289 | default:
|
---|
290 | return "Unknown (" + value + ")";
|
---|
291 | }
|
---|
292 | }
|
---|
293 |
|
---|
294 | @Nullable
|
---|
295 | public String getFlashWarningDescription()
|
---|
296 | {
|
---|
297 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_FLASH_WARNING);
|
---|
298 | if (value == null)
|
---|
299 | return null;
|
---|
300 | switch (value) {
|
---|
301 | case 0:
|
---|
302 | return "No";
|
---|
303 | case 1:
|
---|
304 | return "Yes (Flash required but disabled)";
|
---|
305 | default:
|
---|
306 | return "Unknown (" + value + ")";
|
---|
307 | }
|
---|
308 | }
|
---|
309 |
|
---|
310 | @Nullable
|
---|
311 | public String getCountryDescription()
|
---|
312 | {
|
---|
313 | return getTextDescription(PanasonicMakernoteDirectory.TAG_COUNTRY);
|
---|
314 | }
|
---|
315 |
|
---|
316 | @Nullable
|
---|
317 | public String getStateDescription()
|
---|
318 | {
|
---|
319 | return getTextDescription(PanasonicMakernoteDirectory.TAG_STATE);
|
---|
320 | }
|
---|
321 |
|
---|
322 | @Nullable
|
---|
323 | public String getCityDescription()
|
---|
324 | {
|
---|
325 | return getTextDescription(PanasonicMakernoteDirectory.TAG_CITY);
|
---|
326 | }
|
---|
327 |
|
---|
328 | @Nullable
|
---|
329 | public String getLandmarkDescription()
|
---|
330 | {
|
---|
331 | return getTextDescription(PanasonicMakernoteDirectory.TAG_LANDMARK);
|
---|
332 | }
|
---|
333 |
|
---|
334 | @Nullable
|
---|
335 | public String getTitleDescription()
|
---|
336 | {
|
---|
337 | return getTextDescription(PanasonicMakernoteDirectory.TAG_TITLE);
|
---|
338 | }
|
---|
339 |
|
---|
340 | @Nullable
|
---|
341 | public String getBabyNameDescription()
|
---|
342 | {
|
---|
343 | return getTextDescription(PanasonicMakernoteDirectory.TAG_BABY_NAME);
|
---|
344 | }
|
---|
345 |
|
---|
346 | @Nullable
|
---|
347 | public String getLocationDescription()
|
---|
348 | {
|
---|
349 | return getTextDescription(PanasonicMakernoteDirectory.TAG_LOCATION);
|
---|
350 | }
|
---|
351 |
|
---|
352 | @Nullable
|
---|
353 | public String getIntelligentResolutionDescription()
|
---|
354 | {
|
---|
355 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_INTELLIGENT_RESOLUTION);
|
---|
356 | if (value == null)
|
---|
357 | return null;
|
---|
358 | switch (value) {
|
---|
359 | case 0:
|
---|
360 | return "Off";
|
---|
361 | case 2:
|
---|
362 | return "Auto";
|
---|
363 | case 3:
|
---|
364 | return "On";
|
---|
365 | default:
|
---|
366 | return "Unknown (" + value + ")";
|
---|
367 | }
|
---|
368 | }
|
---|
369 |
|
---|
370 | @Nullable
|
---|
371 | public String getContrastDescription()
|
---|
372 | {
|
---|
373 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_CONTRAST);
|
---|
374 | if (value == null)
|
---|
375 | return null;
|
---|
376 | switch (value) {
|
---|
377 | case 0:
|
---|
378 | return "Normal";
|
---|
379 | default:
|
---|
380 | return "Unknown (" + value + ")";
|
---|
381 | }
|
---|
382 | }
|
---|
383 |
|
---|
384 | @Nullable
|
---|
385 | public String getWorldTimeLocationDescription()
|
---|
386 | {
|
---|
387 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_WORLD_TIME_LOCATION);
|
---|
388 | if (value == null)
|
---|
389 | return null;
|
---|
390 | switch (value) {
|
---|
391 | case 1:
|
---|
392 | return "Home";
|
---|
393 | case 2:
|
---|
394 | return "Destination";
|
---|
395 | default:
|
---|
396 | return "Unknown (" + value + ")";
|
---|
397 | }
|
---|
398 | }
|
---|
399 |
|
---|
400 | @Nullable
|
---|
401 | public String getAdvancedSceneModeDescription()
|
---|
402 | {
|
---|
403 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_ADVANCED_SCENE_MODE);
|
---|
404 | if (value == null)
|
---|
405 | return null;
|
---|
406 | switch (value) {
|
---|
407 | case 1:
|
---|
408 | return "Normal";
|
---|
409 | case 2:
|
---|
410 | return "Outdoor/Illuminations/Flower/HDR Art";
|
---|
411 | case 3:
|
---|
412 | return "Indoor/Architecture/Objects/HDR B&W";
|
---|
413 | case 4:
|
---|
414 | return "Creative";
|
---|
415 | case 5:
|
---|
416 | return "Auto";
|
---|
417 | case 7:
|
---|
418 | return "Expressive";
|
---|
419 | case 8:
|
---|
420 | return "Retro";
|
---|
421 | case 9:
|
---|
422 | return "Pure";
|
---|
423 | case 10:
|
---|
424 | return "Elegant";
|
---|
425 | case 12:
|
---|
426 | return "Monochrome";
|
---|
427 | case 13:
|
---|
428 | return "Dynamic Art";
|
---|
429 | case 14:
|
---|
430 | return "Silhouette";
|
---|
431 | default:
|
---|
432 | return "Unknown (" + value + ")";
|
---|
433 | }
|
---|
434 | }
|
---|
435 |
|
---|
436 | @Nullable
|
---|
437 | public String getUnknownDataDumpDescription()
|
---|
438 | {
|
---|
439 | byte[] value = _directory.getByteArray(PanasonicMakernoteDirectory.TAG_UNKNOWN_DATA_DUMP);
|
---|
440 | if (value == null)
|
---|
441 | return null;
|
---|
442 | return "[" + value.length + " bytes]";
|
---|
443 | }
|
---|
444 |
|
---|
445 | @Nullable
|
---|
446 | public String getColorEffectDescription()
|
---|
447 | {
|
---|
448 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_COLOR_EFFECT);
|
---|
449 | if (value == null)
|
---|
450 | return null;
|
---|
451 | switch (value) {
|
---|
452 | case 1:
|
---|
453 | return "Off";
|
---|
454 | case 2:
|
---|
455 | return "Warm";
|
---|
456 | case 3:
|
---|
457 | return "Cool";
|
---|
458 | case 4:
|
---|
459 | return "Black & White";
|
---|
460 | case 5:
|
---|
461 | return "Sepia";
|
---|
462 | default:
|
---|
463 | return "Unknown (" + value + ")";
|
---|
464 | }
|
---|
465 | }
|
---|
466 |
|
---|
467 | @Nullable
|
---|
468 | public String getUptimeDescription()
|
---|
469 | {
|
---|
470 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_UPTIME);
|
---|
471 | if (value == null)
|
---|
472 | return null;
|
---|
473 | return value / 100f + " s";
|
---|
474 | }
|
---|
475 |
|
---|
476 | @Nullable
|
---|
477 | public String getBurstModeDescription()
|
---|
478 | {
|
---|
479 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_BURST_MODE);
|
---|
480 | if (value == null)
|
---|
481 | return null;
|
---|
482 | switch (value) {
|
---|
483 | case 0:
|
---|
484 | return "Off";
|
---|
485 | case 1:
|
---|
486 | return "On";
|
---|
487 | case 2:
|
---|
488 | return "Infinite";
|
---|
489 | case 4:
|
---|
490 | return "Unlimited";
|
---|
491 | default:
|
---|
492 | return "Unknown (" + value + ")";
|
---|
493 | }
|
---|
494 | }
|
---|
495 |
|
---|
496 | @Nullable
|
---|
497 | public String getContrastModeDescription()
|
---|
498 | {
|
---|
499 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_CONTRAST_MODE);
|
---|
500 | if (value == null)
|
---|
501 | return null;
|
---|
502 | switch (value) {
|
---|
503 | case 0x0:
|
---|
504 | return "Normal";
|
---|
505 | case 0x1:
|
---|
506 | return "Low";
|
---|
507 | case 0x2:
|
---|
508 | return "High";
|
---|
509 | case 0x6:
|
---|
510 | return "Medium Low";
|
---|
511 | case 0x7:
|
---|
512 | return "Medium High";
|
---|
513 | case 0x100:
|
---|
514 | return "Low";
|
---|
515 | case 0x110:
|
---|
516 | return "Normal";
|
---|
517 | case 0x120:
|
---|
518 | return "High";
|
---|
519 |
|
---|
520 | default:
|
---|
521 | return "Unknown (" + value + ")";
|
---|
522 | }
|
---|
523 | }
|
---|
524 |
|
---|
525 | @Nullable
|
---|
526 | public String getNoiseReductionDescription()
|
---|
527 | {
|
---|
528 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_NOISE_REDUCTION);
|
---|
529 | if (value == null)
|
---|
530 | return null;
|
---|
531 | switch (value) {
|
---|
532 | case 0:
|
---|
533 | return "Standard (0)";
|
---|
534 | case 1:
|
---|
535 | return "Low (-1)";
|
---|
536 | case 2:
|
---|
537 | return "High (+1)";
|
---|
538 | case 3:
|
---|
539 | return "Lowest (-2)";
|
---|
540 | case 4:
|
---|
541 | return "Highest (+2)";
|
---|
542 | default:
|
---|
543 | return "Unknown (" + value + ")";
|
---|
544 | }
|
---|
545 | }
|
---|
546 |
|
---|
547 |
|
---|
548 | @Nullable
|
---|
549 | public String getSelfTimerDescription()
|
---|
550 | {
|
---|
551 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_SELF_TIMER);
|
---|
552 | if (value == null)
|
---|
553 | return null;
|
---|
554 | switch (value) {
|
---|
555 | case 1:
|
---|
556 | return "Off";
|
---|
557 | case 2:
|
---|
558 | return "10 s";
|
---|
559 | case 3:
|
---|
560 | return "2 s";
|
---|
561 | default:
|
---|
562 | return "Unknown (" + value + ")";
|
---|
563 | }
|
---|
564 | }
|
---|
565 |
|
---|
566 | @Nullable
|
---|
567 | public String getRotationDescription()
|
---|
568 | {
|
---|
569 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_ROTATION);
|
---|
570 | if (value == null)
|
---|
571 | return null;
|
---|
572 | switch (value) {
|
---|
573 | case 1:
|
---|
574 | return "Horizontal";
|
---|
575 | case 3:
|
---|
576 | return "Rotate 180";
|
---|
577 | case 6:
|
---|
578 | return "Rotate 90 CW";
|
---|
579 | case 8:
|
---|
580 | return "Rotate 270 CW";
|
---|
581 | default:
|
---|
582 | return "Unknown (" + value + ")";
|
---|
583 | }
|
---|
584 | }
|
---|
585 |
|
---|
586 | @Nullable
|
---|
587 | public String getAfAssistLampDescription()
|
---|
588 | {
|
---|
589 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_AF_ASSIST_LAMP);
|
---|
590 | if (value == null)
|
---|
591 | return null;
|
---|
592 | switch (value) {
|
---|
593 | case 1:
|
---|
594 | return "Fired";
|
---|
595 | case 2:
|
---|
596 | return "Enabled but not used";
|
---|
597 | case 3:
|
---|
598 | return "Disabled but required";
|
---|
599 | case 4:
|
---|
600 | return "Disabled and not required";
|
---|
601 | default:
|
---|
602 | return "Unknown (" + value + ")";
|
---|
603 | }
|
---|
604 | }
|
---|
605 |
|
---|
606 | @Nullable
|
---|
607 | public String getColorModeDescription()
|
---|
608 | {
|
---|
609 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_COLOR_MODE);
|
---|
610 | if (value == null)
|
---|
611 | return null;
|
---|
612 | switch (value) {
|
---|
613 | case 0:
|
---|
614 | return "Normal";
|
---|
615 | case 1:
|
---|
616 | return "Natural";
|
---|
617 | case 2:
|
---|
618 | return "Vivid";
|
---|
619 | default:
|
---|
620 | return "Unknown (" + value + ")";
|
---|
621 | }
|
---|
622 | }
|
---|
623 |
|
---|
624 | @Nullable
|
---|
625 | public String getOpticalZoomModeDescription()
|
---|
626 | {
|
---|
627 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_OPTICAL_ZOOM_MODE);
|
---|
628 | if (value == null)
|
---|
629 | return null;
|
---|
630 | switch (value) {
|
---|
631 | case 1:
|
---|
632 | return "Standard";
|
---|
633 | case 2:
|
---|
634 | return "Extended";
|
---|
635 | default:
|
---|
636 | return "Unknown (" + value + ")";
|
---|
637 | }
|
---|
638 | }
|
---|
639 |
|
---|
640 | @Nullable
|
---|
641 | public String getConversionLensDescription()
|
---|
642 | {
|
---|
643 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_CONVERSION_LENS);
|
---|
644 | if (value == null)
|
---|
645 | return null;
|
---|
646 | switch (value) {
|
---|
647 | case 1:
|
---|
648 | return "Off";
|
---|
649 | case 2:
|
---|
650 | return "Wide";
|
---|
651 | case 3:
|
---|
652 | return "Telephoto";
|
---|
653 | case 4:
|
---|
654 | return "Macro";
|
---|
655 | default:
|
---|
656 | return "Unknown (" + value + ")";
|
---|
657 | }
|
---|
658 | }
|
---|
659 |
|
---|
660 | @Nullable
|
---|
661 | public String getDetectedFacesDescription()
|
---|
662 | {
|
---|
663 | return buildFacesDescription(_directory.getDetectedFaces());
|
---|
664 | }
|
---|
665 |
|
---|
666 | @Nullable
|
---|
667 | public String getRecognizedFacesDescription()
|
---|
668 | {
|
---|
669 | return buildFacesDescription(_directory.getRecognizedFaces());
|
---|
670 | }
|
---|
671 |
|
---|
672 | @Nullable
|
---|
673 | private String buildFacesDescription(@Nullable Face[] faces)
|
---|
674 | {
|
---|
675 | if (faces == null)
|
---|
676 | return null;
|
---|
677 |
|
---|
678 | StringBuilder result = new StringBuilder();
|
---|
679 |
|
---|
680 | for (int i = 0; i < faces.length; i++)
|
---|
681 | result.append("Face ").append(i + 1).append(": ").append(faces[i].toString()).append("\n");
|
---|
682 |
|
---|
683 | if (result.length() > 0)
|
---|
684 | return result.substring(0, result.length() - 1);
|
---|
685 |
|
---|
686 | return null;
|
---|
687 | }
|
---|
688 |
|
---|
689 | @Nullable
|
---|
690 | public String getRecordModeDescription()
|
---|
691 | {
|
---|
692 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_RECORD_MODE);
|
---|
693 | if (value == null)
|
---|
694 | return null;
|
---|
695 | switch (value) {
|
---|
696 | case 1:
|
---|
697 | return "Normal";
|
---|
698 | case 2:
|
---|
699 | return "Portrait";
|
---|
700 | case 3:
|
---|
701 | return "Scenery";
|
---|
702 | case 4:
|
---|
703 | return "Sports";
|
---|
704 | case 5:
|
---|
705 | return "Night Portrait";
|
---|
706 | case 6:
|
---|
707 | return "Program";
|
---|
708 | case 7:
|
---|
709 | return "Aperture Priority";
|
---|
710 | case 8:
|
---|
711 | return "Shutter Priority";
|
---|
712 | case 9:
|
---|
713 | return "Macro";
|
---|
714 | case 10:
|
---|
715 | return "Spot";
|
---|
716 | case 11:
|
---|
717 | return "Manual";
|
---|
718 | case 12:
|
---|
719 | return "Movie Preview";
|
---|
720 | case 13:
|
---|
721 | return "Panning";
|
---|
722 | case 14:
|
---|
723 | return "Simple";
|
---|
724 | case 15:
|
---|
725 | return "Color Effects";
|
---|
726 | case 16:
|
---|
727 | return "Self Portrait";
|
---|
728 | case 17:
|
---|
729 | return "Economy";
|
---|
730 | case 18:
|
---|
731 | return "Fireworks";
|
---|
732 | case 19:
|
---|
733 | return "Party";
|
---|
734 | case 20:
|
---|
735 | return "Snow";
|
---|
736 | case 21:
|
---|
737 | return "Night Scenery";
|
---|
738 | case 22:
|
---|
739 | return "Food";
|
---|
740 | case 23:
|
---|
741 | return "Baby";
|
---|
742 | case 24:
|
---|
743 | return "Soft Skin";
|
---|
744 | case 25:
|
---|
745 | return "Candlelight";
|
---|
746 | case 26:
|
---|
747 | return "Starry Night";
|
---|
748 | case 27:
|
---|
749 | return "High Sensitivity";
|
---|
750 | case 28:
|
---|
751 | return "Panorama Assist";
|
---|
752 | case 29:
|
---|
753 | return "Underwater";
|
---|
754 | case 30:
|
---|
755 | return "Beach";
|
---|
756 | case 31:
|
---|
757 | return "Aerial Photo";
|
---|
758 | case 32:
|
---|
759 | return "Sunset";
|
---|
760 | case 33:
|
---|
761 | return "Pet";
|
---|
762 | case 34:
|
---|
763 | return "Intelligent ISO";
|
---|
764 | case 35:
|
---|
765 | return "Clipboard";
|
---|
766 | case 36:
|
---|
767 | return "High Speed Continuous Shooting";
|
---|
768 | case 37:
|
---|
769 | return "Intelligent Auto";
|
---|
770 | case 39:
|
---|
771 | return "Multi-aspect";
|
---|
772 | case 41:
|
---|
773 | return "Transform";
|
---|
774 | case 42:
|
---|
775 | return "Flash Burst";
|
---|
776 | case 43:
|
---|
777 | return "Pin Hole";
|
---|
778 | case 44:
|
---|
779 | return "Film Grain";
|
---|
780 | case 45:
|
---|
781 | return "My Color";
|
---|
782 | case 46:
|
---|
783 | return "Photo Frame";
|
---|
784 | case 51:
|
---|
785 | return "HDR";
|
---|
786 | default:
|
---|
787 | return "Unknown (" + value + ")";
|
---|
788 | }
|
---|
789 | }
|
---|
790 |
|
---|
791 | @Nullable
|
---|
792 | public String getSceneModeDescription()
|
---|
793 | {
|
---|
794 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_SCENE_MODE);
|
---|
795 | if (value == null)
|
---|
796 | return null;
|
---|
797 | switch (value) {
|
---|
798 | case 1:
|
---|
799 | return "Normal";
|
---|
800 | case 2:
|
---|
801 | return "Portrait";
|
---|
802 | case 3:
|
---|
803 | return "Scenery";
|
---|
804 | case 4:
|
---|
805 | return "Sports";
|
---|
806 | case 5:
|
---|
807 | return "Night Portrait";
|
---|
808 | case 6:
|
---|
809 | return "Program";
|
---|
810 | case 7:
|
---|
811 | return "Aperture Priority";
|
---|
812 | case 8:
|
---|
813 | return "Shutter Priority";
|
---|
814 | case 9:
|
---|
815 | return "Macro";
|
---|
816 | case 10:
|
---|
817 | return "Spot";
|
---|
818 | case 11:
|
---|
819 | return "Manual";
|
---|
820 | case 12:
|
---|
821 | return "Movie Preview";
|
---|
822 | case 13:
|
---|
823 | return "Panning";
|
---|
824 | case 14:
|
---|
825 | return "Simple";
|
---|
826 | case 15:
|
---|
827 | return "Color Effects";
|
---|
828 | case 16:
|
---|
829 | return "Self Portrait";
|
---|
830 | case 17:
|
---|
831 | return "Economy";
|
---|
832 | case 18:
|
---|
833 | return "Fireworks";
|
---|
834 | case 19:
|
---|
835 | return "Party";
|
---|
836 | case 20:
|
---|
837 | return "Snow";
|
---|
838 | case 21:
|
---|
839 | return "Night Scenery";
|
---|
840 | case 22:
|
---|
841 | return "Food";
|
---|
842 | case 23:
|
---|
843 | return "Baby";
|
---|
844 | case 24:
|
---|
845 | return "Soft Skin";
|
---|
846 | case 25:
|
---|
847 | return "Candlelight";
|
---|
848 | case 26:
|
---|
849 | return "Starry Night";
|
---|
850 | case 27:
|
---|
851 | return "High Sensitivity";
|
---|
852 | case 28:
|
---|
853 | return "Panorama Assist";
|
---|
854 | case 29:
|
---|
855 | return "Underwater";
|
---|
856 | case 30:
|
---|
857 | return "Beach";
|
---|
858 | case 31:
|
---|
859 | return "Aerial Photo";
|
---|
860 | case 32:
|
---|
861 | return "Sunset";
|
---|
862 | case 33:
|
---|
863 | return "Pet";
|
---|
864 | case 34:
|
---|
865 | return "Intelligent ISO";
|
---|
866 | case 35:
|
---|
867 | return "Clipboard";
|
---|
868 | case 36:
|
---|
869 | return "High Speed Continuous Shooting";
|
---|
870 | case 37:
|
---|
871 | return "Intelligent Auto";
|
---|
872 | case 39:
|
---|
873 | return "Multi-aspect";
|
---|
874 | case 41:
|
---|
875 | return "Transform";
|
---|
876 | case 42:
|
---|
877 | return "Flash Burst";
|
---|
878 | case 43:
|
---|
879 | return "Pin Hole";
|
---|
880 | case 44:
|
---|
881 | return "Film Grain";
|
---|
882 | case 45:
|
---|
883 | return "My Color";
|
---|
884 | case 46:
|
---|
885 | return "Photo Frame";
|
---|
886 | case 51:
|
---|
887 | return "HDR";
|
---|
888 | default:
|
---|
889 | return "Unknown (" + value + ")";
|
---|
890 | }
|
---|
891 | }
|
---|
892 |
|
---|
893 | @Nullable
|
---|
894 | public String getFocusModeDescription()
|
---|
895 | {
|
---|
896 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_FOCUS_MODE);
|
---|
897 | if (value == null)
|
---|
898 | return null;
|
---|
899 | switch (value) {
|
---|
900 | case 1:
|
---|
901 | return "Auto";
|
---|
902 | case 2:
|
---|
903 | return "Manual";
|
---|
904 | case 4:
|
---|
905 | return "Auto, Focus Button";
|
---|
906 | case 5:
|
---|
907 | return "Auto, Continuous";
|
---|
908 | default:
|
---|
909 | return "Unknown (" + value + ")";
|
---|
910 | }
|
---|
911 | }
|
---|
912 |
|
---|
913 | @Nullable
|
---|
914 | public String getAfAreaModeDescription()
|
---|
915 | {
|
---|
916 | int[] value = _directory.getIntArray(PanasonicMakernoteDirectory.TAG_AF_AREA_MODE);
|
---|
917 | if (value == null || value.length < 2)
|
---|
918 | return null;
|
---|
919 | switch (value[0]) {
|
---|
920 | case 0:
|
---|
921 | switch (value[1]) {
|
---|
922 | case 1:
|
---|
923 | return "Spot Mode On";
|
---|
924 | case 16:
|
---|
925 | return "Spot Mode Off";
|
---|
926 | default:
|
---|
927 | return "Unknown (" + value[0] + " " + value[1] + ")";
|
---|
928 | }
|
---|
929 | case 1:
|
---|
930 | switch (value[1]) {
|
---|
931 | case 0:
|
---|
932 | return "Spot Focusing";
|
---|
933 | case 1:
|
---|
934 | return "5-area";
|
---|
935 | default:
|
---|
936 | return "Unknown (" + value[0] + " " + value[1] + ")";
|
---|
937 | }
|
---|
938 | case 16:
|
---|
939 | switch (value[1]) {
|
---|
940 | case 0:
|
---|
941 | return "1-area";
|
---|
942 | case 16:
|
---|
943 | return "1-area (high speed)";
|
---|
944 | default:
|
---|
945 | return "Unknown (" + value[0] + " " + value[1] + ")";
|
---|
946 | }
|
---|
947 | case 32:
|
---|
948 | switch (value[1]) {
|
---|
949 | case 0:
|
---|
950 | return "Auto or Face Detect";
|
---|
951 | case 1:
|
---|
952 | return "3-area (left)";
|
---|
953 | case 2:
|
---|
954 | return "3-area (center)";
|
---|
955 | case 3:
|
---|
956 | return "3-area (right)";
|
---|
957 | default:
|
---|
958 | return "Unknown (" + value[0] + " " + value[1] + ")";
|
---|
959 | }
|
---|
960 | case 64:
|
---|
961 | return "Face Detect";
|
---|
962 | default:
|
---|
963 | return "Unknown (" + value[0] + " " + value[1] + ")";
|
---|
964 | }
|
---|
965 | }
|
---|
966 |
|
---|
967 | @Nullable
|
---|
968 | public String getQualityModeDescription()
|
---|
969 | {
|
---|
970 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_QUALITY_MODE);
|
---|
971 | if (value == null)
|
---|
972 | return null;
|
---|
973 | switch (value) {
|
---|
974 | case 2:
|
---|
975 | return "High";
|
---|
976 | case 3:
|
---|
977 | return "Normal";
|
---|
978 | case 6:
|
---|
979 | return "Very High";
|
---|
980 | case 7:
|
---|
981 | return "Raw";
|
---|
982 | case 9:
|
---|
983 | return "Motion Picture";
|
---|
984 | default:
|
---|
985 | return "Unknown (" + value + ")";
|
---|
986 | }
|
---|
987 | }
|
---|
988 |
|
---|
989 | @Nullable
|
---|
990 | public String getVersionDescription()
|
---|
991 | {
|
---|
992 | return convertBytesToVersionString(_directory.getIntArray(PanasonicMakernoteDirectory.TAG_VERSION), 2);
|
---|
993 | }
|
---|
994 |
|
---|
995 | @Nullable
|
---|
996 | public String getMakernoteVersionDescription()
|
---|
997 | {
|
---|
998 | return convertBytesToVersionString(_directory.getIntArray(PanasonicMakernoteDirectory.TAG_MAKERNOTE_VERSION), 2);
|
---|
999 | }
|
---|
1000 |
|
---|
1001 | @Nullable
|
---|
1002 | public String getExifVersionDescription()
|
---|
1003 | {
|
---|
1004 | return convertBytesToVersionString(_directory.getIntArray(PanasonicMakernoteDirectory.TAG_EXIF_VERSION), 2);
|
---|
1005 | }
|
---|
1006 |
|
---|
1007 | @Nullable
|
---|
1008 | public String getInternalSerialNumberDescription()
|
---|
1009 | {
|
---|
1010 | final byte[] bytes = _directory.getByteArray(PanasonicMakernoteDirectory.TAG_INTERNAL_SERIAL_NUMBER);
|
---|
1011 |
|
---|
1012 | if (bytes==null)
|
---|
1013 | return null;
|
---|
1014 |
|
---|
1015 | int length = bytes.length;
|
---|
1016 | for (int index = 0; index < bytes.length; index++) {
|
---|
1017 | int i = bytes[index] & 0xFF;
|
---|
1018 | if (i == 0 || i > 0x7F) {
|
---|
1019 | length = index;
|
---|
1020 | break;
|
---|
1021 | }
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | return new String(bytes, 0, length);
|
---|
1025 | }
|
---|
1026 |
|
---|
1027 | @Nullable
|
---|
1028 | public String getWhiteBalanceDescription()
|
---|
1029 | {
|
---|
1030 | Integer value = _directory.getInteger(PanasonicMakernoteDirectory.TAG_WHITE_BALANCE);
|
---|
1031 | if (value == null)
|
---|
1032 | return null;
|
---|
1033 | switch (value) {
|
---|
1034 | case 1:
|
---|
1035 | return "Auto";
|
---|
1036 | case 2:
|
---|
1037 | return "Daylight";
|
---|
1038 | case 3:
|
---|
1039 | return "Cloudy";
|
---|
1040 | case 4:
|
---|
1041 | return "Incandescent";
|
---|
1042 | case 5:
|
---|
1043 | return "Manual";
|
---|
1044 | case 8:
|
---|
1045 | return "Flash";
|
---|
1046 | case 10:
|
---|
1047 | return "Black & White";
|
---|
1048 | case 11:
|
---|
1049 | return "Manual";
|
---|
1050 | case 12:
|
---|
1051 | return "Shade";
|
---|
1052 | default:
|
---|
1053 | return "Unknown (" + value + ")";
|
---|
1054 | }
|
---|
1055 | }
|
---|
1056 |
|
---|
1057 | @Nullable
|
---|
1058 | public String getBabyAgeDescription()
|
---|
1059 | {
|
---|
1060 | final Age age = _directory.getAge(PanasonicMakernoteDirectory.TAG_BABY_AGE);
|
---|
1061 | if (age==null)
|
---|
1062 | return null;
|
---|
1063 | return age.toFriendlyString();
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | @Nullable
|
---|
1067 | public String getBabyAge1Description()
|
---|
1068 | {
|
---|
1069 | final Age age = _directory.getAge(PanasonicMakernoteDirectory.TAG_BABY_AGE_1);
|
---|
1070 | if (age==null)
|
---|
1071 | return null;
|
---|
1072 | return age.toFriendlyString();
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | @Nullable
|
---|
1076 | private String getTextDescription(int tag)
|
---|
1077 | {
|
---|
1078 | byte[] values = _directory.getByteArray(tag);
|
---|
1079 | if (values == null)
|
---|
1080 | return null;
|
---|
1081 | try {
|
---|
1082 | return new String(values, "ASCII").trim();
|
---|
1083 | } catch (UnsupportedEncodingException e) {
|
---|
1084 | return null;
|
---|
1085 | }
|
---|
1086 | }
|
---|
1087 |
|
---|
1088 | @Nullable
|
---|
1089 | private String getOnOffDescription(int tag)
|
---|
1090 | {
|
---|
1091 | Integer value = _directory.getInteger(tag);
|
---|
1092 | if (value == null)
|
---|
1093 | return null;
|
---|
1094 | switch (value) {
|
---|
1095 | case 1:
|
---|
1096 | return "Off";
|
---|
1097 | case 2:
|
---|
1098 | return "On";
|
---|
1099 | default:
|
---|
1100 | return "Unknown (" + value + ")";
|
---|
1101 | }
|
---|
1102 | }
|
---|
1103 | }
|
---|