source: josm/trunk/src/com/drew/metadata/exif/OlympusMakernoteDescriptor.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: 5.5 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.annotations.NotNull;
24import com.drew.lang.annotations.Nullable;
25import com.drew.metadata.TagDescriptor;
26
27/**
28 * Provides human-readable string representations of tag values stored in a <code>OlympusMakernoteDirectory</code>.
29 *
30 * @author Drew Noakes http://drewnoakes.com
31 */
32public class OlympusMakernoteDescriptor extends TagDescriptor<OlympusMakernoteDirectory>
33{
34 public OlympusMakernoteDescriptor(@NotNull OlympusMakernoteDirectory directory)
35 {
36 super(directory);
37 }
38
39 @Nullable
40 public String getDescription(int tagType)
41 {
42 switch (tagType) {
43 case OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE:
44 return getSpecialModeDescription();
45 case OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY:
46 return getJpegQualityDescription();
47 case OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE:
48 return getMacroModeDescription();
49 case OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO:
50 return getDigiZoomRatioDescription();
51 default:
52 return super.getDescription(tagType);
53 }
54 }
55
56 @Nullable
57 public String getDigiZoomRatioDescription()
58 {
59 Integer value = _directory.getInteger(OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO);
60 if (value==null)
61 return null;
62 switch (value) {
63 case 0:
64 return "Normal";
65 case 2:
66 return "Digital 2x Zoom";
67 default:
68 return "Unknown (" + value + ")";
69 }
70 }
71
72 @Nullable
73 public String getMacroModeDescription()
74 {
75 Integer value = _directory.getInteger(OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE);
76 if (value==null)
77 return null;
78 switch (value) {
79 case 0:
80 return "Normal (no macro)";
81 case 1:
82 return "Macro";
83 default:
84 return "Unknown (" + value + ")";
85 }
86 }
87
88 @Nullable
89 public String getJpegQualityDescription()
90 {
91 Integer value = _directory.getInteger(OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY);
92 if (value==null)
93 return null;
94 switch (value) {
95 case 1:
96 return "SQ";
97 case 2:
98 return "HQ";
99 case 3:
100 return "SHQ";
101 default:
102 return "Unknown (" + value + ")";
103 }
104 }
105
106 @Nullable
107 public String getSpecialModeDescription()
108 {
109 int[] values = _directory.getIntArray(OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE);
110 if (values==null)
111 return null;
112 if (values.length < 1)
113 return "";
114 StringBuilder desc = new StringBuilder();
115 switch (values[0]) {
116 case 0:
117 desc.append("Normal picture taking mode");
118 break;
119 case 1:
120 desc.append("Unknown picture taking mode");
121 break;
122 case 2:
123 desc.append("Fast picture taking mode");
124 break;
125 case 3:
126 desc.append("Panorama picture taking mode");
127 break;
128 default:
129 desc.append("Unknown picture taking mode");
130 break;
131 }
132
133 if (values.length < 2)
134 return desc.toString();
135 desc.append(" - ");
136 switch (values[1]) {
137 case 0:
138 desc.append("Unknown sequence number");
139 break;
140 case 1:
141 desc.append("1st in a sequence");
142 break;
143 case 2:
144 desc.append("2nd in a sequence");
145 break;
146 case 3:
147 desc.append("3rd in a sequence");
148 break;
149 default:
150 desc.append(values[1]);
151 desc.append("th in a sequence");
152 break;
153 }
154 if (values.length < 3)
155 return desc.toString();
156 desc.append(" - ");
157 switch (values[2]) {
158 case 1:
159 desc.append("Left to right panorama direction");
160 break;
161 case 2:
162 desc.append("Right to left panorama direction");
163 break;
164 case 3:
165 desc.append("Bottom to top panorama direction");
166 break;
167 case 4:
168 desc.append("Top to bottom panorama direction");
169 break;
170 }
171 return desc.toString();
172 }
173}
Note: See TracBrowser for help on using the repository browser.