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