Changeset 6127 in josm for trunk/src/com/drew/metadata/exif/FujifilmMakernoteDescriptor.java
- Timestamp:
- 2013-08-09T18:05:11+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/exif/FujifilmMakernoteDescriptor.java
r4231 r6127 1 1 /* 2 * This is public domain software - that is, you can do whatever you want 3 * with it, and include it software that is licensed under the GNU or the 4 * BSD license, or whatever other licence you choose, including proprietary 5 * closed source licenses. I do ask that you leave this header in tact. 6 * 7 * If you make modifications to this code that you think would benefit the 8 * wider community, please send me a copy and I'll post it on my site. 9 * 10 * If you make use of this code, I'd appreciate hearing about it. 11 * drew@drewnoakes.com 12 * Latest version of this software kept at 13 * http://drewnoakes.com/ 14 * 15 * Created by dnoakes on 27-Nov-2002 10:12:05 using IntelliJ IDEA. 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/ 16 20 */ 17 21 package com.drew.metadata.exif; 18 22 19 23 import com.drew.lang.Rational; 20 import com.drew. metadata.Directory;21 import com.drew. metadata.MetadataException;24 import com.drew.lang.annotations.NotNull; 25 import com.drew.lang.annotations.Nullable; 22 26 import com.drew.metadata.TagDescriptor; 23 27 24 28 /** 29 * Provides human-readable string representations of tag values stored in a <code>FujifilmMakernoteDirectory</code>. 30 * <p/> 25 31 * Fujifilm's digicam added the MakerNote tag from the Year2000's model (e.g.Finepix1400, 26 32 * Finepix4700). It uses IFD format and start from ASCII character 'FUJIFILM', and next 4 27 33 * bytes(value 0x000c) points the offset to first IFD entry. Example of actual data 28 34 * structure is shown below. 29 * 35 * <p/> 36 * <pre><code> 30 37 * :0000: 46 55 4A 49 46 49 4C 4D-0C 00 00 00 0F 00 00 00 :0000: FUJIFILM........ 31 38 * :0010: 07 00 04 00 00 00 30 31-33 30 00 10 02 00 08 00 :0010: ......0130...... 32 * 39 * </code></pre> 40 * <p/> 33 41 * There are two big differences to the other manufacturers. 34 42 * - Fujifilm's Exif data uses Motorola align, but MakerNote ignores it and uses Intel … … 37 45 * of TIFF header (same as the other IFD), but Fujifilm counts it from the first byte 38 46 * of MakerNote itself. 47 * 48 * @author Drew Noakes http://drewnoakes.com 39 49 */ 40 public class FujifilmMakernoteDescriptor extends TagDescriptor 50 public class FujifilmMakernoteDescriptor extends TagDescriptor<FujifilmMakernoteDirectory> 41 51 { 42 public FujifilmMakernoteDescriptor(Directory directory) 52 public FujifilmMakernoteDescriptor(@NotNull FujifilmMakernoteDirectory directory) 43 53 { 44 54 super(directory); 45 55 } 46 56 47 public String getDescription(int tagType) throws MetadataException 57 @Nullable 58 public String getDescription(int tagType) 48 59 { 49 60 switch (tagType) { … … 52 63 case FujifilmMakernoteDirectory.TAG_FUJIFILM_WHITE_BALANCE: 53 64 return getWhiteBalanceDescription(); 54 case FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR: 65 case FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR_SATURATION: 55 66 return getColorDescription(); 56 67 case FujifilmMakernoteDirectory.TAG_FUJIFILM_TONE: … … 64 75 case FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_MODE: 65 76 return getFocusModeDescription(); 66 case FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCH RO:77 case FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCH: 67 78 return getSlowSyncDescription(); 68 79 case FujifilmMakernoteDirectory.TAG_FUJIFILM_PICTURE_MODE: … … 77 88 return getAutoExposureWarningDescription(); 78 89 default: 79 return _directory.getString(tagType); 80 } 81 } 82 83 public String getAutoExposureWarningDescription() throws MetadataException 84 { 85 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_AE_WARNING)) return null; 86 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_AE_WARNING); 87 switch (value) { 88 case 0: 89 return "AE good"; 90 case 1: 91 return "Over exposed (>1/1000s @ F11)"; 92 default: 93 return "Unknown (" + value + ")"; 94 } 95 } 96 97 public String getFocusWarningDescription() throws MetadataException 98 { 99 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_WARNING)) return null; 100 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_WARNING); 101 switch (value) { 102 case 0: 103 return "Auto focus good"; 104 case 1: 105 return "Out of focus"; 106 default: 107 return "Unknown (" + value + ")"; 108 } 109 } 110 111 public String getBlurWarningDescription() throws MetadataException 112 { 113 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_BLUR_WARNING)) return null; 114 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_BLUR_WARNING); 115 switch (value) { 116 case 0: 117 return "No blur warning"; 118 case 1: 119 return "Blur warning"; 120 default: 121 return "Unknown (" + value + ")"; 122 } 123 } 124 125 public String getContinuousTakingOrAutoBrackettingDescription() throws MetadataException 126 { 127 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_CONTINUOUS_TAKING_OR_AUTO_BRACKETTING)) return null; 128 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_CONTINUOUS_TAKING_OR_AUTO_BRACKETTING); 129 switch (value) { 130 case 0: 90 return super.getDescription(tagType); 91 } 92 } 93 94 @Nullable 95 public String getSharpnessDescription() 96 { 97 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_SHARPNESS); 98 if (value==null) 99 return null; 100 switch (value) { 101 case 1: 102 return "Softest"; 103 case 2: 104 return "Soft"; 105 case 3: 106 return "Normal"; 107 case 4: 108 return "Hard"; 109 case 5: 110 return "Hardest"; 111 default: 112 return "Unknown (" + value + ")"; 113 } 114 } 115 116 @Nullable 117 public String getWhiteBalanceDescription() 118 { 119 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_WHITE_BALANCE); 120 if (value==null) 121 return null; 122 switch (value) { 123 case 0: 124 return "Auto"; 125 case 256: 126 return "Daylight"; 127 case 512: 128 return "Cloudy"; 129 case 768: 130 return "DaylightColor-fluorescence"; 131 case 769: 132 return "DaywhiteColor-fluorescence"; 133 case 770: 134 return "White-fluorescence"; 135 case 1024: 136 return "Incandescence"; 137 case 3840: 138 return "Custom white balance"; 139 default: 140 return "Unknown (" + value + ")"; 141 } 142 } 143 144 @Nullable 145 public String getColorDescription() 146 { 147 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR_SATURATION); 148 if (value==null) 149 return null; 150 switch (value) { 151 case 0: 152 return "Normal (STD)"; 153 case 256: 154 return "High (HARD)"; 155 case 512: 156 return "Low (ORG)"; 157 default: 158 return "Unknown (" + value + ")"; 159 } 160 } 161 162 @Nullable 163 public String getToneDescription() 164 { 165 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_TONE); 166 if (value==null) 167 return null; 168 switch (value) { 169 case 0: 170 return "Normal (STD)"; 171 case 256: 172 return "High (HARD)"; 173 case 512: 174 return "Low (ORG)"; 175 default: 176 return "Unknown (" + value + ")"; 177 } 178 } 179 180 @Nullable 181 public String getFlashModeDescription() 182 { 183 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_MODE); 184 if (value==null) 185 return null; 186 switch (value) { 187 case 0: 188 return "Auto"; 189 case 1: 190 return "On"; 191 case 2: 131 192 return "Off"; 132 case 1: 133 return "On"; 134 default: 135 return "Unknown (" + value + ")"; 136 } 137 } 138 139 public String getPictureModeDescription() throws MetadataException 140 { 141 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_PICTURE_MODE)) return null; 142 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_PICTURE_MODE); 193 case 3: 194 return "Red-eye reduction"; 195 default: 196 return "Unknown (" + value + ")"; 197 } 198 } 199 200 @Nullable 201 public String getFlashStrengthDescription() 202 { 203 Rational value = _directory.getRational(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_STRENGTH); 204 if (value==null) 205 return null; 206 return value.toSimpleString(false) + " EV (Apex)"; 207 } 208 209 @Nullable 210 public String getMacroDescription() 211 { 212 return getOnOffDescription(FujifilmMakernoteDirectory.TAG_FUJIFILM_MACRO); 213 } 214 215 @Nullable 216 public String getFocusModeDescription() 217 { 218 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_MODE); 219 if (value==null) 220 return null; 221 switch (value) { 222 case 0: 223 return "Auto focus"; 224 case 1: 225 return "Manual focus"; 226 default: 227 return "Unknown (" + value + ")"; 228 } 229 } 230 231 @Nullable 232 public String getSlowSyncDescription() 233 { 234 return getOnOffDescription(FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCH); 235 } 236 237 @Nullable 238 public String getPictureModeDescription() 239 { 240 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_PICTURE_MODE); 241 if (value==null) 242 return null; 143 243 switch (value) { 144 244 case 0: … … 165 265 } 166 266 167 public String getSlowSyncDescription() throws MetadataException 168 { 169 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCHRO)) return null; 170 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_SLOW_SYNCHRO); 267 @Nullable 268 public String getContinuousTakingOrAutoBrackettingDescription() 269 { 270 return getOnOffDescription(FujifilmMakernoteDirectory.TAG_FUJIFILM_CONTINUOUS_TAKING_OR_AUTO_BRACKETTING); 271 } 272 273 @Nullable 274 public String getBlurWarningDescription() 275 { 276 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_BLUR_WARNING); 277 if (value==null) 278 return null; 279 switch (value) { 280 case 0: 281 return "No blur warning"; 282 case 1: 283 return "Blur warning"; 284 default: 285 return "Unknown (" + value + ")"; 286 } 287 } 288 289 @Nullable 290 public String getFocusWarningDescription() 291 { 292 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_WARNING); 293 if (value==null) 294 return null; 295 switch (value) { 296 case 0: 297 return "Auto focus good"; 298 case 1: 299 return "Out of focus"; 300 default: 301 return "Unknown (" + value + ")"; 302 } 303 } 304 305 @Nullable 306 public String getAutoExposureWarningDescription() 307 { 308 final Integer value = _directory.getInteger(FujifilmMakernoteDirectory.TAG_FUJIFILM_AE_WARNING); 309 if (value==null) 310 return null; 311 switch (value) { 312 case 0: 313 return "AE good"; 314 case 1: 315 return "Over exposed (>1/1000s @ F11)"; 316 default: 317 return "Unknown (" + value + ")"; 318 } 319 } 320 321 322 @Nullable 323 private String getOnOffDescription(final int tagType) 324 { 325 final Integer value = _directory.getInteger(tagType); 326 if (value==null) 327 return null; 171 328 switch (value) { 172 329 case 0: … … 178 335 } 179 336 } 180 181 public String getFocusModeDescription() throws MetadataException182 {183 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_MODE)) return null;184 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_FOCUS_MODE);185 switch (value) {186 case 0:187 return "Auto focus";188 case 1:189 return "Manual focus";190 default:191 return "Unknown (" + value + ")";192 }193 }194 195 public String getMacroDescription() throws MetadataException196 {197 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_MACRO)) return null;198 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_MACRO);199 switch (value) {200 case 0:201 return "Off";202 case 1:203 return "On";204 default:205 return "Unknown (" + value + ")";206 }207 }208 209 public String getFlashStrengthDescription() throws MetadataException210 {211 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_STRENGTH)) return null;212 Rational value = _directory.getRational(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_STRENGTH);213 return value.toSimpleString(false) + " EV (Apex)";214 }215 216 public String getFlashModeDescription() throws MetadataException217 {218 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_MODE)) return null;219 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_FLASH_MODE);220 switch (value) {221 case 0:222 return "Auto";223 case 1:224 return "On";225 case 2:226 return "Off";227 case 3:228 return "Red-eye reduction";229 default:230 return "Unknown (" + value + ")";231 }232 }233 234 public String getToneDescription() throws MetadataException235 {236 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_TONE)) return null;237 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_TONE);238 switch (value) {239 case 0:240 return "Normal (STD)";241 case 256:242 return "High (HARD)";243 case 512:244 return "Low (ORG)";245 default:246 return "Unknown (" + value + ")";247 }248 }249 250 public String getColorDescription() throws MetadataException251 {252 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR)) return null;253 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_COLOR);254 switch (value) {255 case 0:256 return "Normal (STD)";257 case 256:258 return "High";259 case 512:260 return "Low (ORG)";261 default:262 return "Unknown (" + value + ")";263 }264 }265 266 public String getWhiteBalanceDescription() throws MetadataException267 {268 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_WHITE_BALANCE)) return null;269 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_WHITE_BALANCE);270 switch (value) {271 case 0:272 return "Auto";273 case 256:274 return "Daylight";275 case 512:276 return "Cloudy";277 case 768:278 return "DaylightColor-fluorescence";279 case 769:280 return "DaywhiteColor-fluorescence";281 case 770:282 return "White-fluorescence";283 case 1024:284 return "Incandenscense";285 case 3840:286 return "Custom white balance";287 default:288 return "Unknown (" + value + ")";289 }290 }291 292 public String getSharpnessDescription() throws MetadataException293 {294 if (!_directory.containsTag(FujifilmMakernoteDirectory.TAG_FUJIFILM_SHARPNESS)) return null;295 int value = _directory.getInt(FujifilmMakernoteDirectory.TAG_FUJIFILM_SHARPNESS);296 switch (value) {297 case 1:298 return "Softest";299 case 2:300 return "Soft";301 case 3:302 return "Normal";303 case 4:304 return "Hard";305 case 5:306 return "Hardest";307 default:308 return "Unknown (" + value + ")";309 }310 }311 337 }
Note:
See TracChangeset
for help on using the changeset viewer.