source: josm/trunk/src/com/drew/metadata/exif/makernotes/CasioType1MakernoteDescriptor.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: 6.0 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.CasioType1MakernoteDirectory.*;
28
29/**
30 * Provides human-readable string representations of tag values stored in a {@link CasioType1MakernoteDirectory}.
31 *
32 * @author Drew Noakes https://drewnoakes.com
33 */
34@SuppressWarnings("WeakerAccess")
35public class CasioType1MakernoteDescriptor extends TagDescriptor<CasioType1MakernoteDirectory>
36{
37 public CasioType1MakernoteDescriptor(@NotNull CasioType1MakernoteDirectory directory)
38 {
39 super(directory);
40 }
41
42 @Override
43 @Nullable
44 public String getDescription(int tagType)
45 {
46 switch (tagType) {
47 case TAG_RECORDING_MODE:
48 return getRecordingModeDescription();
49 case TAG_QUALITY:
50 return getQualityDescription();
51 case TAG_FOCUSING_MODE:
52 return getFocusingModeDescription();
53 case TAG_FLASH_MODE:
54 return getFlashModeDescription();
55 case TAG_FLASH_INTENSITY:
56 return getFlashIntensityDescription();
57 case TAG_OBJECT_DISTANCE:
58 return getObjectDistanceDescription();
59 case TAG_WHITE_BALANCE:
60 return getWhiteBalanceDescription();
61 case TAG_DIGITAL_ZOOM:
62 return getDigitalZoomDescription();
63 case TAG_SHARPNESS:
64 return getSharpnessDescription();
65 case TAG_CONTRAST:
66 return getContrastDescription();
67 case TAG_SATURATION:
68 return getSaturationDescription();
69 case TAG_CCD_SENSITIVITY:
70 return getCcdSensitivityDescription();
71 default:
72 return super.getDescription(tagType);
73 }
74 }
75
76 @Nullable
77 public String getCcdSensitivityDescription()
78 {
79 Integer value = _directory.getInteger(TAG_CCD_SENSITIVITY);
80
81 if (value == null)
82 return null;
83
84 switch (value) {
85 // these four for QV3000
86 case 64: return "Normal";
87 case 125: return "+1.0";
88 case 250: return "+2.0";
89 case 244: return "+3.0";
90 // these two for QV8000/2000
91 case 80: return "Normal (ISO 80 equivalent)";
92 case 100: return "High";
93 default:
94 return "Unknown (" + value + ")";
95 }
96 }
97
98 @Nullable
99 public String getSaturationDescription()
100 {
101 return getIndexedDescription(TAG_SATURATION, "Normal", "Low", "High");
102 }
103
104 @Nullable
105 public String getContrastDescription()
106 {
107 return getIndexedDescription(TAG_CONTRAST, "Normal", "Low", "High");
108 }
109
110 @Nullable
111 public String getSharpnessDescription()
112 {
113 return getIndexedDescription(TAG_SHARPNESS, "Normal", "Soft", "Hard");
114 }
115
116 @Nullable
117 public String getDigitalZoomDescription()
118 {
119 Integer value = _directory.getInteger(TAG_DIGITAL_ZOOM);
120
121 if (value == null)
122 return null;
123
124 switch (value) {
125 case 0x10000: return "No digital zoom";
126 case 0x10001: return "2x digital zoom";
127 case 0x20000: return "2x digital zoom";
128 case 0x40000: return "4x digital zoom";
129 default:
130 return "Unknown (" + value + ")";
131 }
132 }
133
134 @Nullable
135 public String getWhiteBalanceDescription()
136 {
137 Integer value = _directory.getInteger(TAG_WHITE_BALANCE);
138
139 if (value == null)
140 return null;
141
142 switch (value) {
143 case 1: return "Auto";
144 case 2: return "Tungsten";
145 case 3: return "Daylight";
146 case 4: return "Florescent";
147 case 5: return "Shade";
148 case 129: return "Manual";
149 default:
150 return "Unknown (" + value + ")";
151 }
152 }
153
154 @Nullable
155 public String getObjectDistanceDescription()
156 {
157 Integer value = _directory.getInteger(TAG_OBJECT_DISTANCE);
158 return value == null ? null : getFocalLengthDescription(value);
159 }
160
161 @Nullable
162 public String getFlashIntensityDescription()
163 {
164 Integer value = _directory.getInteger(TAG_FLASH_INTENSITY);
165
166 if (value == null)
167 return null;
168
169 switch (value) {
170 case 11: return "Weak";
171 case 13: return "Normal";
172 case 15: return "Strong";
173 default:
174 return "Unknown (" + value + ")";
175 }
176 }
177
178 @Nullable
179 public String getFlashModeDescription()
180 {
181 return getIndexedDescription(TAG_FLASH_MODE, 1, "Auto", "On", "Off", "Red eye reduction");
182 }
183
184 @Nullable
185 public String getFocusingModeDescription()
186 {
187 return getIndexedDescription(TAG_FOCUSING_MODE, 2, "Macro", "Auto focus", "Manual focus", "Infinity");
188 }
189
190 @Nullable
191 public String getQualityDescription()
192 {
193 return getIndexedDescription(TAG_QUALITY, 1, "Economy", "Normal", "Fine");
194 }
195
196 @Nullable
197 public String getRecordingModeDescription()
198 {
199 return getIndexedDescription(TAG_RECORDING_MODE, 1, "Single shutter", "Panorama", "Night scene", "Portrait", "Landscape");
200 }
201}
Note: See TracBrowser for help on using the repository browser.