source: josm/trunk/src/com/drew/metadata/exif/makernotes/SanyoMakernoteDescriptor.java@ 8564

Last change on this file since 8564 was 8132, checked in by Don-vip, 11 years ago

fix #11162 - update to metadata-extractor 2.7.2

File size: 7.3 KB
Line 
1/*
2 * Copyright 2002-2015 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 */
21
22package com.drew.metadata.exif.makernotes;
23
24import com.drew.lang.annotations.NotNull;
25import com.drew.lang.annotations.Nullable;
26import com.drew.metadata.TagDescriptor;
27
28import static com.drew.metadata.exif.makernotes.SanyoMakernoteDirectory.*;
29
30/**
31 * Provides human-readable string representations of tag values stored in a {@link com.drew.metadata.exif.makernotes.SonyType6MakernoteDirectory}.
32 *
33 * @author Drew Noakes https://drewnoakes.com
34 */
35public class SanyoMakernoteDescriptor extends TagDescriptor<SanyoMakernoteDirectory>
36{
37 public SanyoMakernoteDescriptor(@NotNull SanyoMakernoteDirectory directory)
38 {
39 super(directory);
40 }
41
42 @Override
43 @Nullable
44 public String getDescription(int tagType)
45 {
46 switch (tagType) {
47 case TAG_SANYO_QUALITY:
48 return getSanyoQualityDescription();
49 case TAG_MACRO:
50 return getMacroDescription();
51 case TAG_DIGITAL_ZOOM:
52 return getDigitalZoomDescription();
53 case TAG_SEQUENTIAL_SHOT:
54 return getSequentialShotDescription();
55 case TAG_WIDE_RANGE:
56 return getWideRangeDescription();
57 case TAG_COLOR_ADJUSTMENT_MODE:
58 return getColorAdjustmentModeDescription();
59 case TAG_QUICK_SHOT:
60 return getQuickShotDescription();
61 case TAG_SELF_TIMER:
62 return getSelfTimerDescription();
63 case TAG_VOICE_MEMO:
64 return getVoiceMemoDescription();
65 case TAG_RECORD_SHUTTER_RELEASE:
66 return getRecordShutterDescription();
67 case TAG_FLICKER_REDUCE:
68 return getFlickerReduceDescription();
69 case TAG_OPTICAL_ZOOM_ON:
70 return getOptimalZoomOnDescription();
71 case TAG_DIGITAL_ZOOM_ON:
72 return getDigitalZoomOnDescription();
73 case TAG_LIGHT_SOURCE_SPECIAL:
74 return getLightSourceSpecialDescription();
75 case TAG_RESAVED:
76 return getResavedDescription();
77 case TAG_SCENE_SELECT:
78 return getSceneSelectDescription();
79 case TAG_SEQUENCE_SHOT_INTERVAL:
80 return getSequenceShotIntervalDescription();
81 case TAG_FLASH_MODE:
82 return getFlashModeDescription();
83 default:
84 return super.getDescription(tagType);
85 }
86 }
87
88 @Nullable
89 public String getSanyoQualityDescription()
90 {
91 Integer value = _directory.getInteger(TAG_SANYO_QUALITY);
92 if (value == null)
93 return null;
94 switch (value) {
95 case 0x0: return "Normal/Very Low";
96 case 0x1: return "Normal/Low";
97 case 0x2: return "Normal/Medium Low";
98 case 0x3: return "Normal/Medium";
99 case 0x4: return "Normal/Medium High";
100 case 0x5: return "Normal/High";
101 case 0x6: return "Normal/Very High";
102 case 0x7: return "Normal/Super High";
103 case 0x100: return "Fine/Very Low";
104 case 0x101: return "Fine/Low";
105 case 0x102: return "Fine/Medium Low";
106 case 0x103: return "Fine/Medium";
107 case 0x104: return "Fine/Medium High";
108 case 0x105: return "Fine/High";
109 case 0x106: return "Fine/Very High";
110 case 0x107: return "Fine/Super High";
111 case 0x200: return "Super Fine/Very Low";
112 case 0x201: return "Super Fine/Low";
113 case 0x202: return "Super Fine/Medium Low";
114 case 0x203: return "Super Fine/Medium";
115 case 0x204: return "Super Fine/Medium High";
116 case 0x205: return "Super Fine/High";
117 case 0x206: return "Super Fine/Very High";
118 case 0x207: return "Super Fine/Super High";
119 default:
120 return "Unknown (" + value + ")";
121 }
122 }
123
124 @Nullable
125 private String getMacroDescription()
126 {
127 return getIndexedDescription(TAG_MACRO, "Normal", "Macro", "View", "Manual");
128 }
129
130 @Nullable
131 private String getDigitalZoomDescription()
132 {
133 return getDecimalRational(TAG_DIGITAL_ZOOM, 3);
134 }
135
136 @Nullable
137 private String getSequentialShotDescription()
138 {
139 return getIndexedDescription(TAG_SEQUENTIAL_SHOT, "None", "Standard", "Best", "Adjust Exposure");
140 }
141
142 @Nullable
143 private String getWideRangeDescription()
144 {
145 return getIndexedDescription(TAG_WIDE_RANGE, "Off", "On");
146 }
147
148 @Nullable
149 private String getColorAdjustmentModeDescription()
150 {
151 return getIndexedDescription(TAG_COLOR_ADJUSTMENT_MODE, "Off", "On");
152 }
153
154 @Nullable
155 private String getQuickShotDescription()
156 {
157 return getIndexedDescription(TAG_QUICK_SHOT, "Off", "On");
158 }
159
160 @Nullable
161 private String getSelfTimerDescription()
162 {
163 return getIndexedDescription(TAG_SELF_TIMER, "Off", "On");
164 }
165
166 @Nullable
167 private String getVoiceMemoDescription()
168 {
169 return getIndexedDescription(TAG_VOICE_MEMO, "Off", "On");
170 }
171
172 @Nullable
173 private String getRecordShutterDescription()
174 {
175 return getIndexedDescription(TAG_RECORD_SHUTTER_RELEASE, "Record while down", "Press start, press stop");
176 }
177
178 @Nullable
179 private String getFlickerReduceDescription()
180 {
181 return getIndexedDescription(TAG_FLICKER_REDUCE, "Off", "On");
182 }
183
184 @Nullable
185 private String getOptimalZoomOnDescription()
186 {
187 return getIndexedDescription(TAG_OPTICAL_ZOOM_ON, "Off", "On");
188 }
189
190 @Nullable
191 private String getDigitalZoomOnDescription()
192 {
193 return getIndexedDescription(TAG_DIGITAL_ZOOM_ON, "Off", "On");
194 }
195
196 @Nullable
197 private String getLightSourceSpecialDescription()
198 {
199 return getIndexedDescription(TAG_LIGHT_SOURCE_SPECIAL, "Off", "On");
200 }
201
202 @Nullable
203 private String getResavedDescription()
204 {
205 return getIndexedDescription(TAG_RESAVED, "No", "Yes");
206 }
207
208 @Nullable
209 private String getSceneSelectDescription()
210 {
211 return getIndexedDescription(TAG_SCENE_SELECT,
212 "Off", "Sport", "TV", "Night", "User 1", "User 2", "Lamp");
213 }
214
215 @Nullable
216 private String getSequenceShotIntervalDescription()
217 {
218 return getIndexedDescription(TAG_SEQUENCE_SHOT_INTERVAL,
219 "5 frames/sec", "10 frames/sec", "15 frames/sec", "20 frames/sec");
220 }
221
222 @Nullable
223 private String getFlashModeDescription()
224 {
225 return getIndexedDescription(TAG_FLASH_MODE,
226 "Auto", "Force", "Disabled", "Red eye");
227 }
228}
Note: See TracBrowser for help on using the repository browser.