source: josm/trunk/src/com/drew/metadata/exif/makernotes/SonyType1MakernoteDescriptor.java@ 13061

Last change on this file since 13061 was 13061, checked in by Don-vip, 6 years ago

fix #15505 - update to metadata-extractor 2.10.1

File size: 23.1 KB
Line 
1/*
2 * Copyright 2002-2017 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 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21package com.drew.metadata.exif.makernotes;
22
23import com.drew.lang.annotations.NotNull;
24import com.drew.lang.annotations.Nullable;
25import com.drew.metadata.TagDescriptor;
26
27import static com.drew.metadata.exif.makernotes.SonyType1MakernoteDirectory.*;
28
29/**
30 * Provides human-readable string representations of tag values stored in a {@link SonyType1MakernoteDirectory}.
31 * Thanks to David Carson for the initial version of this class.
32 *
33 * @author Drew Noakes https://drewnoakes.com
34 */
35@SuppressWarnings("WeakerAccess")
36public class SonyType1MakernoteDescriptor extends TagDescriptor<SonyType1MakernoteDirectory>
37{
38 public SonyType1MakernoteDescriptor(@NotNull SonyType1MakernoteDirectory directory)
39 {
40 super(directory);
41 }
42
43 @Override
44 @Nullable
45 public String getDescription(int tagType)
46 {
47 switch (tagType) {
48 case TAG_IMAGE_QUALITY:
49 return getImageQualityDescription();
50 case TAG_FLASH_EXPOSURE_COMP:
51 return getFlashExposureCompensationDescription();
52 case TAG_TELECONVERTER:
53 return getTeleconverterDescription();
54 case TAG_WHITE_BALANCE:
55 return getWhiteBalanceDescription();
56 case TAG_COLOR_TEMPERATURE:
57 return getColorTemperatureDescription();
58 case TAG_SCENE_MODE:
59 return getSceneModeDescription();
60 case TAG_ZONE_MATCHING:
61 return getZoneMatchingDescription();
62 case TAG_DYNAMIC_RANGE_OPTIMISER:
63 return getDynamicRangeOptimizerDescription();
64 case TAG_IMAGE_STABILISATION:
65 return getImageStabilizationDescription();
66 // Unfortunately it seems that there is no definite mapping between a lens ID and a lens model
67 // http://gvsoft.homedns.org/exif/makernote-sony-type1.html#0xb027
68// case TAG_LENS_ID:
69// return getLensIDDescription();
70 case TAG_COLOR_MODE:
71 return getColorModeDescription();
72 case TAG_MACRO:
73 return getMacroDescription();
74 case TAG_EXPOSURE_MODE:
75 return getExposureModeDescription();
76 case TAG_JPEG_QUALITY:
77 return getJpegQualityDescription();
78 case TAG_ANTI_BLUR:
79 return getAntiBlurDescription();
80 case TAG_LONG_EXPOSURE_NOISE_REDUCTION_OR_FOCUS_MODE:
81 return getLongExposureNoiseReductionDescription();
82 case TAG_HIGH_ISO_NOISE_REDUCTION:
83 return getHighIsoNoiseReductionDescription();
84 case TAG_PICTURE_EFFECT:
85 return getPictureEffectDescription();
86 case TAG_SOFT_SKIN_EFFECT:
87 return getSoftSkinEffectDescription();
88 case TAG_VIGNETTING_CORRECTION:
89 return getVignettingCorrectionDescription();
90 case TAG_LATERAL_CHROMATIC_ABERRATION:
91 return getLateralChromaticAberrationDescription();
92 case TAG_DISTORTION_CORRECTION:
93 return getDistortionCorrectionDescription();
94 case TAG_AUTO_PORTRAIT_FRAMED:
95 return getAutoPortraitFramedDescription();
96 case TAG_FOCUS_MODE:
97 return getFocusModeDescription();
98 case TAG_AF_POINT_SELECTED:
99 return getAFPointSelectedDescription();
100 case TAG_SONY_MODEL_ID:
101 return getSonyModelIdDescription();
102 case TAG_AF_MODE:
103 return getAFModeDescription();
104 case TAG_AF_ILLUMINATOR:
105 return getAFIlluminatorDescription();
106 case TAG_FLASH_LEVEL:
107 return getFlashLevelDescription();
108 case TAG_RELEASE_MODE:
109 return getReleaseModeDescription();
110 case TAG_SEQUENCE_NUMBER:
111 return getSequenceNumberDescription();
112 default:
113 return super.getDescription(tagType);
114 }
115 }
116
117 @Nullable
118 public String getImageQualityDescription()
119 {
120 return getIndexedDescription(TAG_IMAGE_QUALITY,
121 "RAW",
122 "Super Fine",
123 "Fine",
124 "Standard",
125 "Economy",
126 "Extra Fine",
127 "RAW + JPEG",
128 "Compressed RAW",
129 "Compressed RAW + JPEG");
130 }
131
132 @Nullable
133 public String getFlashExposureCompensationDescription()
134 {
135 return getFormattedInt(TAG_FLASH_EXPOSURE_COMP, "%d EV");
136 }
137
138 @Nullable
139 public String getTeleconverterDescription()
140 {
141 Integer value = _directory.getInteger(TAG_TELECONVERTER);
142 if (value == null)
143 return null;
144 switch (value) {
145 case 0x00: return "None";
146 case 0x48: return "Minolta/Sony AF 2x APO (D)";
147 case 0x50: return "Minolta AF 2x APO II";
148 case 0x60: return "Minolta AF 2x APO";
149 case 0x88: return "Minolta/Sony AF 1.4x APO (D)";
150 case 0x90: return "Minolta AF 1.4x APO II";
151 case 0xa0: return "Minolta AF 1.4x APO";
152 default:
153 return "Unknown (" + value + ")";
154 }
155 }
156
157 @Nullable
158 public String getWhiteBalanceDescription()
159 {
160 Integer value = _directory.getInteger(TAG_WHITE_BALANCE);
161 if (value == null)
162 return null;
163 switch (value) {
164 case 0x00: return "Auto";
165 case 0x01: return "Color Temperature/Color Filter";
166 case 0x10: return "Daylight";
167 case 0x20: return "Cloudy";
168 case 0x30: return "Shade";
169 case 0x40: return "Tungsten";
170 case 0x50: return "Flash";
171 case 0x60: return "Fluorescent";
172 case 0x70: return "Custom";
173 default:
174 return "Unknown (" + value + ")";
175 }
176 }
177
178 @Nullable
179 public String getColorTemperatureDescription()
180 {
181 Integer value = _directory.getInteger(TAG_COLOR_TEMPERATURE);
182 if (value == null)
183 return null;
184 if (value == 0)
185 return "Auto";
186 int kelvin = ((value & 0x00FF0000) >> 8) | ((value & 0xFF000000) >> 24);
187 return String.format("%d K", kelvin);
188 }
189
190 @Nullable
191 public String getZoneMatchingDescription()
192 {
193 return getIndexedDescription(TAG_ZONE_MATCHING,
194 "ISO Setting Used", "High Key", "Low Key");
195 }
196
197 @Nullable
198 public String getDynamicRangeOptimizerDescription()
199 {
200 Integer value = _directory.getInteger(TAG_DYNAMIC_RANGE_OPTIMISER);
201 if (value == null)
202 return null;
203 switch (value) {
204 case 0: return "Off";
205 case 1: return "Standard";
206 case 2: return "Advanced Auto";
207 case 3: return "Auto";
208 case 8: return "Advanced LV1";
209 case 9: return "Advanced LV2";
210 case 10: return "Advanced LV3";
211 case 11: return "Advanced LV4";
212 case 12: return "Advanced LV5";
213 case 16: return "LV1";
214 case 17: return "LV2";
215 case 18: return "LV3";
216 case 19: return "LV4";
217 case 20: return "LV5";
218 default: return String.format("Unknown (%d)", value);
219 }
220 }
221
222 @Nullable
223 public String getImageStabilizationDescription()
224 {
225 Integer value = _directory.getInteger(TAG_IMAGE_STABILISATION);
226 if (value == null)
227 return null;
228 switch (value) {
229 case 0: return "Off";
230 case 1: return "On";
231 default: return "N/A";
232 }
233 }
234
235 @Nullable
236 public String getColorModeDescription()
237 {
238 Integer value = _directory.getInteger(TAG_COLOR_MODE);
239 if (value == null)
240 return null;
241 switch (value) {
242 case 0: return "Standard";
243 case 1: return "Vivid";
244 case 2: return "Portrait";
245 case 3: return "Landscape";
246 case 4: return "Sunset";
247 case 5: return "Night Portrait";
248 case 6: return "Black & White";
249 case 7: return "Adobe RGB";
250 case 12: case 100: return "Neutral";
251 case 13: case 101: return "Clear";
252 case 14: case 102: return "Deep";
253 case 15: case 103: return "Light";
254 case 16: return "Autumn";
255 case 17: return "Sepia";
256 case 104: return "Night View";
257 case 105: return "Autumn Leaves";
258 default: return String.format("Unknown (%d)", value);
259 }
260 }
261
262 @Nullable
263 public String getMacroDescription()
264 {
265 Integer value = _directory.getInteger(TAG_MACRO);
266 if (value == null)
267 return null;
268 switch (value) {
269 case 0: return "Off";
270 case 1: return "On";
271 case 2: return "Magnifying Glass/Super Macro";
272 case 0xFFFF: return "N/A";
273 default: return String.format("Unknown (%d)", value);
274 }
275 }
276
277 @Nullable
278 public String getExposureModeDescription()
279 {
280 Integer value = _directory.getInteger(TAG_EXPOSURE_MODE);
281 if (value == null)
282 return null;
283 switch (value) {
284 case 0: return "Program";
285 case 1: return "Portrait";
286 case 2: return "Beach";
287 case 3: return "Sports";
288 case 4: return "Snow";
289 case 5: return "Landscape";
290 case 6: return "Auto";
291 case 7: return "Aperture Priority";
292 case 8: return "Shutter Priority";
293 case 9: return "Night Scene / Twilight";
294 case 10: return "Hi-Speed Shutter";
295 case 11: return "Twilight Portrait";
296 case 12: return "Soft Snap/Portrait";
297 case 13: return "Fireworks";
298 case 14: return "Smile Shutter";
299 case 15: return "Manual";
300 case 18: return "High Sensitivity";
301 case 19: return "Macro";
302 case 20: return "Advanced Sports Shooting";
303 case 29: return "Underwater";
304 case 33: return "Food";
305 case 34: return "Panorama";
306 case 35: return "Handheld Night Shot";
307 case 36: return "Anti Motion Blur";
308 case 37: return "Pet";
309 case 38: return "Backlight Correction HDR";
310 case 39: return "Superior Auto";
311 case 40: return "Background Defocus";
312 case 41: return "Soft Skin";
313 case 42: return "3D Image";
314 case 0xFFFF: return "N/A";
315 default: return String.format("Unknown (%d)", value);
316 }
317 }
318
319 @Nullable
320 public String getJpegQualityDescription()
321 {
322 Integer value = _directory.getInteger(TAG_JPEG_QUALITY);
323 if (value == null)
324 return null;
325 switch (value) {
326 case 0: return "Normal";
327 case 1: return "Fine";
328 case 2: return "Extra Fine";
329 case 0xFFFF: return "N/A";
330 default: return String.format("Unknown (%d)", value);
331 }
332 }
333
334 @Nullable
335 public String getAntiBlurDescription()
336 {
337 Integer value = _directory.getInteger(TAG_ANTI_BLUR);
338 if (value == null)
339 return null;
340 switch (value) {
341 case 0: return "Off";
342 case 1: return "On (Continuous)";
343 case 2: return "On (Shooting)";
344 case 0xFFFF: return "N/A";
345 default: return String.format("Unknown (%d)", value);
346 }
347 }
348
349 @Nullable
350 public String getLongExposureNoiseReductionDescription()
351 {
352 Integer value = _directory.getInteger(TAG_LONG_EXPOSURE_NOISE_REDUCTION_OR_FOCUS_MODE);
353 if (value == null)
354 return null;
355 switch (value) {
356 case 0: return "Off";
357 case 1: return "On";
358 case 0xFFFF: return "N/A";
359 default: return String.format("Unknown (%d)", value);
360 }
361 }
362
363 @Nullable
364 public String getHighIsoNoiseReductionDescription()
365 {
366 Integer value = _directory.getInteger(TAG_HIGH_ISO_NOISE_REDUCTION);
367 if (value == null)
368 return null;
369 switch (value) {
370 case 0: return "Off";
371 case 1: return "On";
372 case 2: return "Normal";
373 case 3: return "High";
374 case 0x100: return "Auto";
375 case 0xffff: return "N/A";
376 default: return String.format("Unknown (%d)", value);
377 }
378 }
379
380 @Nullable
381 public String getPictureEffectDescription()
382 {
383 Integer value = _directory.getInteger(TAG_PICTURE_EFFECT);
384 if (value == null)
385 return null;
386 switch (value) {
387 case 0: return "Off";
388 case 1: return "Toy Camera";
389 case 2: return "Pop Color";
390 case 3: return "Posterization";
391 case 4: return "Posterization B/W";
392 case 5: return "Retro Photo";
393 case 6: return "Soft High Key";
394 case 7: return "Partial Color (red)";
395 case 8: return "Partial Color (green)";
396 case 9: return "Partial Color (blue)";
397 case 10: return "Partial Color (yellow)";
398 case 13: return "High Contrast Monochrome";
399 case 16: return "Toy Camera (normal)";
400 case 17: return "Toy Camera (cool)";
401 case 18: return "Toy Camera (warm)";
402 case 19: return "Toy Camera (green)";
403 case 20: return "Toy Camera (magenta)";
404 case 32: return "Soft Focus (low)";
405 case 33: return "Soft Focus";
406 case 34: return "Soft Focus (high)";
407 case 48: return "Miniature (auto)";
408 case 49: return "Miniature (top)";
409 case 50: return "Miniature (middle horizontal)";
410 case 51: return "Miniature (bottom)";
411 case 52: return "Miniature (left)";
412 case 53: return "Miniature (middle vertical)";
413 case 54: return "Miniature (right)";
414 case 64: return "HDR Painting (low)";
415 case 65: return "HDR Painting";
416 case 66: return "HDR Painting (high)";
417 case 80: return "Rich-tone Monochrome";
418 case 97: return "Water Color";
419 case 98: return "Water Color 2";
420 case 112: return "Illustration (low)";
421 case 113: return "Illustration";
422 case 114: return "Illustration (high)";
423 default: return String.format("Unknown (%d)", value);
424 }
425 }
426
427 @Nullable
428 public String getSoftSkinEffectDescription()
429 {
430 return getIndexedDescription(TAG_SOFT_SKIN_EFFECT, "Off", "Low", "Mid", "High");
431 }
432
433 @Nullable
434 public String getVignettingCorrectionDescription()
435 {
436 Integer value = _directory.getInteger(TAG_VIGNETTING_CORRECTION);
437 if (value == null)
438 return null;
439 switch (value) {
440 case 0: return "Off";
441 case 2: return "Auto";
442 case 0xffffffff: return "N/A";
443 default: return String.format("Unknown (%d)", value);
444 }
445 }
446
447 @Nullable
448 public String getLateralChromaticAberrationDescription()
449 {
450 Integer value = _directory.getInteger(TAG_LATERAL_CHROMATIC_ABERRATION);
451 if (value == null)
452 return null;
453 switch (value) {
454 case 0: return "Off";
455 case 2: return "Auto";
456 case 0xffffffff: return "N/A";
457 default: return String.format("Unknown (%d)", value);
458 }
459 }
460
461 @Nullable
462 public String getDistortionCorrectionDescription()
463 {
464 Integer value = _directory.getInteger(TAG_DISTORTION_CORRECTION);
465 if (value == null)
466 return null;
467 switch (value) {
468 case 0: return "Off";
469 case 2: return "Auto";
470 case 0xffffffff: return "N/A";
471 default: return String.format("Unknown (%d)", value);
472 }
473 }
474
475 @Nullable
476 public String getAutoPortraitFramedDescription()
477 {
478 return getIndexedDescription(TAG_AUTO_PORTRAIT_FRAMED, "No", "Yes");
479 }
480
481 @Nullable
482 public String getFocusModeDescription()
483 {
484 return getIndexedDescription(TAG_FOCUS_MODE,
485 "Manual", null, "AF-A", "AF-C", "AF-S", null, "DMF", "AF-D");
486 }
487
488 @Nullable
489 public String getAFPointSelectedDescription()
490 {
491 return getIndexedDescription(TAG_AF_POINT_SELECTED,
492 "Auto", // 0
493 "Center", // 1
494 "Top", // 2
495 "Upper-right", // 3
496 "Right", // 4
497 "Lower-right", // 5
498 "Bottom", // 6
499 "Lower-left", // 7
500 "Left", // 8
501 "Upper-left ", // 9
502 "Far Right", // 10
503 "Far Left", // 11
504 "Upper-middle", // 12
505 "Near Right", // 13
506 "Lower-middle", // 14
507 "Near Left", // 15
508 "Upper Far Right", // 16
509 "Lower Far Right", // 17
510 "Lower Far Left", // 18
511 "Upper Far Left" // 19
512 );
513 }
514
515 @Nullable
516 public String getSonyModelIdDescription()
517 {
518 Integer value = _directory.getInteger(TAG_SONY_MODEL_ID);
519
520 if (value == null)
521 return null;
522
523 switch (value) {
524 case 2: return "DSC-R1";
525 case 256: return "DSLR-A100";
526 case 257: return "DSLR-A900";
527 case 258: return "DSLR-A700";
528 case 259: return "DSLR-A200";
529 case 260: return "DSLR-A350";
530 case 261: return "DSLR-A300";
531 case 262: return "DSLR-A900 (APS-C mode)";
532 case 263: return "DSLR-A380/A390";
533 case 264: return "DSLR-A330";
534 case 265: return "DSLR-A230";
535 case 266: return "DSLR-A290";
536 case 269: return "DSLR-A850";
537 case 270: return "DSLR-A850 (APS-C mode)";
538 case 273: return "DSLR-A550";
539 case 274: return "DSLR-A500";
540 case 275: return "DSLR-A450";
541 case 278: return "NEX-5";
542 case 279: return "NEX-3";
543 case 280: return "SLT-A33";
544 case 281: return "SLT-A55V";
545 case 282: return "DSLR-A560";
546 case 283: return "DSLR-A580";
547 case 284: return "NEX-C3";
548 case 285: return "SLT-A35";
549 case 286: return "SLT-A65V";
550 case 287: return "SLT-A77V";
551 case 288: return "NEX-5N";
552 case 289: return "NEX-7";
553 case 290: return "NEX-VG20E";
554 case 291: return "SLT-A37";
555 case 292: return "SLT-A57";
556 case 293: return "NEX-F3";
557 case 294: return "SLT-A99V";
558 case 295: return "NEX-6";
559 case 296: return "NEX-5R";
560 case 297: return "DSC-RX100";
561 case 298: return "DSC-RX1";
562 default:
563 return "Unknown (" + value + ")";
564 }
565 }
566
567 @Nullable
568 public String getSceneModeDescription()
569 {
570 Integer value = _directory.getInteger(TAG_SCENE_MODE);
571
572 if (value == null)
573 return null;
574
575 switch (value) {
576 case 0: return "Standard";
577 case 1: return "Portrait";
578 case 2: return "Text";
579 case 3: return "Night Scene";
580 case 4: return "Sunset";
581 case 5: return "Sports";
582 case 6: return "Landscape";
583 case 7: return "Night Portrait";
584 case 8: return "Macro";
585 case 9: return "Super Macro";
586 case 16: return "Auto";
587 case 17: return "Night View/Portrait";
588 case 18: return "Sweep Panorama";
589 case 19: return "Handheld Night Shot";
590 case 20: return "Anti Motion Blur";
591 case 21: return "Cont. Priority AE";
592 case 22: return "Auto+";
593 case 23: return "3D Sweep Panorama";
594 case 24: return "Superior Auto";
595 case 25: return "High Sensitivity";
596 case 26: return "Fireworks";
597 case 27: return "Food";
598 case 28: return "Pet";
599 default:
600 return "Unknown (" + value + ")";
601 }
602 }
603
604 @Nullable
605 public String getAFModeDescription()
606 {
607 Integer value = _directory.getInteger(TAG_AF_MODE);
608
609 if (value == null)
610 return null;
611
612 switch (value) {
613 case 0: return "Default";
614 case 1: return "Multi";
615 case 2: return "Center";
616 case 3: return "Spot";
617 case 4: return "Flexible Spot";
618 case 6: return "Touch";
619 case 14: return "Manual Focus";
620 case 15: return "Face Detected";
621 case 0xffff: return "n/a";
622 default:
623 return "Unknown (" + value + ")";
624 }
625 }
626
627 @Nullable
628 public String getAFIlluminatorDescription()
629 {
630 Integer value = _directory.getInteger(TAG_AF_ILLUMINATOR);
631
632 if (value == null)
633 return null;
634
635 switch (value) {
636 case 0: return "Off";
637 case 1: return "Auto";
638 case 0xffff: return "n/a";
639 default:
640 return "Unknown (" + value + ")";
641 }
642 }
643
644 @Nullable
645 public String getFlashLevelDescription()
646 {
647 Integer value = _directory.getInteger(TAG_FLASH_LEVEL);
648
649 if (value == null)
650 return null;
651
652 switch (value) {
653 case -32768: return "Low";
654 case -3: return "-3/3";
655 case -2: return "-2/3";
656 case -1: return "-1/3";
657 case 0: return "Normal";
658 case 1: return "+1/3";
659 case 2: return "+2/3";
660 case 3: return "+3/3";
661 case 128: return "n/a";
662 case 32767: return "High";
663 default:
664 return "Unknown (" + value + ")";
665 }
666 }
667
668 @Nullable
669 public String getReleaseModeDescription()
670 {
671 Integer value = _directory.getInteger(TAG_RELEASE_MODE);
672
673 if (value == null)
674 return null;
675
676 switch (value) {
677 case 0: return "Normal";
678 case 2: return "Continuous";
679 case 5: return "Exposure Bracketing";
680 case 6: return "White Balance Bracketing";
681 case 65535: return "n/a";
682 default:
683 return "Unknown (" + value + ")";
684 }
685 }
686
687 @Nullable
688 public String getSequenceNumberDescription()
689 {
690 Integer value = _directory.getInteger(TAG_RELEASE_MODE);
691
692 if (value == null)
693 return null;
694
695 switch (value) {
696 case 0: return "Single";
697 case 65535: return "n/a";
698 default:
699 return value.toString();
700 }
701 }
702}
Note: See TracBrowser for help on using the repository browser.