source: josm/trunk/src/com/drew/metadata/exif/NikonType1MakernoteDescriptor.java@ 6209

Last change on this file since 6209 was 6127, checked in by bastiK, 11 years ago

applied #8895 - Upgrade metadata-extractor to v. 2.6.4 (patch by ebourg)

File size: 7.4 KB
Line 
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 */
21package com.drew.metadata.exif;
22
23import com.drew.lang.Rational;
24import com.drew.lang.annotations.NotNull;
25import com.drew.lang.annotations.Nullable;
26import com.drew.metadata.TagDescriptor;
27
28/**
29 * Provides human-readable string representations of tag values stored in a <code>NikonType1MakernoteDirectory</code>.
30 * <p/>
31 * Type-1 is for E-Series cameras prior to (not including) E990. For example: E700, E800, E900,
32 * E900S, E910, E950.
33 * <p/>
34 * MakerNote starts from ASCII string "Nikon". Data format is the same as IFD, but it starts from
35 * offset 0x08. This is the same as Olympus except start string. Example of actual data
36 * structure is shown below.
37 * <pre><code>
38 * :0000: 4E 69 6B 6F 6E 00 01 00-05 00 02 00 02 00 06 00 Nikon...........
39 * :0010: 00 00 EC 02 00 00 03 00-03 00 01 00 00 00 06 00 ................
40 * </code></pre>
41 *
42 * @author Drew Noakes http://drewnoakes.com
43 */
44public class NikonType1MakernoteDescriptor extends TagDescriptor<NikonType1MakernoteDirectory>
45{
46 public NikonType1MakernoteDescriptor(@NotNull NikonType1MakernoteDirectory directory)
47 {
48 super(directory);
49 }
50
51 @Nullable
52 public String getDescription(int tagType)
53 {
54 switch (tagType) {
55 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_QUALITY:
56 return getQualityDescription();
57 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_COLOR_MODE:
58 return getColorModeDescription();
59 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_IMAGE_ADJUSTMENT:
60 return getImageAdjustmentDescription();
61 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_CCD_SENSITIVITY:
62 return getCcdSensitivityDescription();
63 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_WHITE_BALANCE:
64 return getWhiteBalanceDescription();
65 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_FOCUS:
66 return getFocusDescription();
67 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_DIGITAL_ZOOM:
68 return getDigitalZoomDescription();
69 case NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_CONVERTER:
70 return getConverterDescription();
71 default:
72 return super.getDescription(tagType);
73 }
74 }
75
76 @Nullable
77 public String getConverterDescription()
78 {
79 Integer value = _directory.getInteger(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_CONVERTER);
80 if (value == null)
81 return null;
82 switch (value) {
83 case 0:
84 return "None";
85 case 1:
86 return "Fisheye converter";
87 default:
88 return "Unknown (" + value + ")";
89 }
90 }
91
92 @Nullable
93 public String getDigitalZoomDescription()
94 {
95 Rational value = _directory.getRational(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_DIGITAL_ZOOM);
96 if (value == null)
97 return null;
98 if (value.getNumerator() == 0) {
99 return "No digital zoom";
100 }
101 return value.toSimpleString(true) + "x digital zoom";
102 }
103
104 @Nullable
105 public String getFocusDescription()
106 {
107 Rational value = _directory.getRational(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_FOCUS);
108 if (value == null)
109 return null;
110 if (value.getNumerator() == 1 && value.getDenominator() == 0) {
111 return "Infinite";
112 }
113 return value.toSimpleString(true);
114 }
115
116 @Nullable
117 public String getWhiteBalanceDescription()
118 {
119 Integer value = _directory.getInteger(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_WHITE_BALANCE);
120 if (value == null)
121 return null;
122 switch (value) {
123 case 0:
124 return "Auto";
125 case 1:
126 return "Preset";
127 case 2:
128 return "Daylight";
129 case 3:
130 return "Incandescence";
131 case 4:
132 return "Florescence";
133 case 5:
134 return "Cloudy";
135 case 6:
136 return "SpeedLight";
137 default:
138 return "Unknown (" + value + ")";
139 }
140 }
141
142 @Nullable
143 public String getCcdSensitivityDescription()
144 {
145 Integer value = _directory.getInteger(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_CCD_SENSITIVITY);
146 if (value == null)
147 return null;
148 switch (value) {
149 case 0:
150 return "ISO80";
151 case 2:
152 return "ISO160";
153 case 4:
154 return "ISO320";
155 case 5:
156 return "ISO100";
157 default:
158 return "Unknown (" + value + ")";
159 }
160 }
161
162 @Nullable
163 public String getImageAdjustmentDescription()
164 {
165 Integer value = _directory.getInteger(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_IMAGE_ADJUSTMENT);
166 if (value == null)
167 return null;
168 switch (value) {
169 case 0:
170 return "Normal";
171 case 1:
172 return "Bright +";
173 case 2:
174 return "Bright -";
175 case 3:
176 return "Contrast +";
177 case 4:
178 return "Contrast -";
179 default:
180 return "Unknown (" + value + ")";
181 }
182 }
183
184 @Nullable
185 public String getColorModeDescription()
186 {
187 Integer value = _directory.getInteger(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_COLOR_MODE);
188 if (value == null)
189 return null;
190 switch (value) {
191 case 1:
192 return "Color";
193 case 2:
194 return "Monochrome";
195 default:
196 return "Unknown (" + value + ")";
197 }
198 }
199
200 @Nullable
201 public String getQualityDescription()
202 {
203 Integer value = _directory.getInteger(NikonType1MakernoteDirectory.TAG_NIKON_TYPE1_QUALITY);
204 if (value == null)
205 return null;
206 switch (value) {
207 case 1:
208 return "VGA Basic";
209 case 2:
210 return "VGA Normal";
211 case 3:
212 return "VGA Fine";
213 case 4:
214 return "SXGA Basic";
215 case 5:
216 return "SXGA Normal";
217 case 6:
218 return "SXGA Fine";
219 default:
220 return "Unknown (" + value + ")";
221 }
222 }
223}
Note: See TracBrowser for help on using the repository browser.