Changeset 6127 in josm for trunk/src/com/drew/metadata/exif/CanonMakernoteDescriptor.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/CanonMakernoteDescriptor.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. 2 * Copyright 2002-2012 Drew Noakes 6 3 * 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. 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 9 7 * 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/ 8 * http://www.apache.org/licenses/LICENSE-2.0 14 9 * 15 * Created by dnoakes on 27-Nov-2002 10:12:05 using IntelliJ IDEA. 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 import com.drew. metadata.Directory;20 import com.drew. metadata.MetadataException;23 import com.drew.lang.annotations.NotNull; 24 import com.drew.lang.annotations.Nullable; 21 25 import com.drew.metadata.TagDescriptor; 22 26 23 27 /** 28 * Provides human-readable string representations of tag values stored in a <code>CanonMakernoteDirectory</code>. 24 29 * 30 * @author Drew Noakes http://drewnoakes.com 25 31 */ 26 public class CanonMakernoteDescriptor extends TagDescriptor 32 public class CanonMakernoteDescriptor extends TagDescriptor<CanonMakernoteDirectory> 27 33 { 28 public CanonMakernoteDescriptor(Directory directory) 34 public CanonMakernoteDescriptor(@NotNull CanonMakernoteDirectory directory) 29 35 { 30 36 super(directory); 31 37 } 32 38 33 public String getDescription(int tagType) throws MetadataException 39 @Nullable 40 public String getDescription(int tagType) 34 41 { 35 42 switch (tagType) { 36 case CanonMakernoteDirectory.TAG_CANON_STATE1_FLASH_ACTIVITY: 43 case CanonMakernoteDirectory.TAG_CANON_SERIAL_NUMBER: 44 return getSerialNumberDescription(); 45 case CanonMakernoteDirectory.CameraSettings.TAG_FLASH_ACTIVITY: 37 46 return getFlashActivityDescription(); 38 case CanonMakernoteDirectory. TAG_CANON_STATE1_FOCUS_TYPE:47 case CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_TYPE: 39 48 return getFocusTypeDescription(); 40 case CanonMakernoteDirectory. TAG_CANON_STATE1_DIGITAL_ZOOM:49 case CanonMakernoteDirectory.CameraSettings.TAG_DIGITAL_ZOOM: 41 50 return getDigitalZoomDescription(); 42 case CanonMakernoteDirectory. TAG_CANON_STATE1_QUALITY:51 case CanonMakernoteDirectory.CameraSettings.TAG_QUALITY: 43 52 return getQualityDescription(); 44 case CanonMakernoteDirectory. TAG_CANON_STATE1_MACRO_MODE:53 case CanonMakernoteDirectory.CameraSettings.TAG_MACRO_MODE: 45 54 return getMacroModeDescription(); 46 case CanonMakernoteDirectory. TAG_CANON_STATE1_SELF_TIMER_DELAY:55 case CanonMakernoteDirectory.CameraSettings.TAG_SELF_TIMER_DELAY: 47 56 return getSelfTimerDelayDescription(); 48 case CanonMakernoteDirectory. TAG_CANON_STATE1_FLASH_MODE:57 case CanonMakernoteDirectory.CameraSettings.TAG_FLASH_MODE: 49 58 return getFlashModeDescription(); 50 case CanonMakernoteDirectory. TAG_CANON_STATE1_CONTINUOUS_DRIVE_MODE:59 case CanonMakernoteDirectory.CameraSettings.TAG_CONTINUOUS_DRIVE_MODE: 51 60 return getContinuousDriveModeDescription(); 52 case CanonMakernoteDirectory. TAG_CANON_STATE1_FOCUS_MODE_1:61 case CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_1: 53 62 return getFocusMode1Description(); 54 case CanonMakernoteDirectory. TAG_CANON_STATE1_IMAGE_SIZE:63 case CanonMakernoteDirectory.CameraSettings.TAG_IMAGE_SIZE: 55 64 return getImageSizeDescription(); 56 case CanonMakernoteDirectory. TAG_CANON_STATE1_EASY_SHOOTING_MODE:65 case CanonMakernoteDirectory.CameraSettings.TAG_EASY_SHOOTING_MODE: 57 66 return getEasyShootingModeDescription(); 58 case CanonMakernoteDirectory. TAG_CANON_STATE1_CONTRAST:67 case CanonMakernoteDirectory.CameraSettings.TAG_CONTRAST: 59 68 return getContrastDescription(); 60 case CanonMakernoteDirectory. TAG_CANON_STATE1_SATURATION:69 case CanonMakernoteDirectory.CameraSettings.TAG_SATURATION: 61 70 return getSaturationDescription(); 62 case CanonMakernoteDirectory. TAG_CANON_STATE1_SHARPNESS:71 case CanonMakernoteDirectory.CameraSettings.TAG_SHARPNESS: 63 72 return getSharpnessDescription(); 64 case CanonMakernoteDirectory. TAG_CANON_STATE1_ISO:73 case CanonMakernoteDirectory.CameraSettings.TAG_ISO: 65 74 return getIsoDescription(); 66 case CanonMakernoteDirectory. TAG_CANON_STATE1_METERING_MODE:75 case CanonMakernoteDirectory.CameraSettings.TAG_METERING_MODE: 67 76 return getMeteringModeDescription(); 68 case CanonMakernoteDirectory. TAG_CANON_STATE1_AF_POINT_SELECTED:77 case CanonMakernoteDirectory.CameraSettings.TAG_AF_POINT_SELECTED: 69 78 return getAfPointSelectedDescription(); 70 case CanonMakernoteDirectory. TAG_CANON_STATE1_EXPOSURE_MODE:79 case CanonMakernoteDirectory.CameraSettings.TAG_EXPOSURE_MODE: 71 80 return getExposureModeDescription(); 72 case CanonMakernoteDirectory. TAG_CANON_STATE1_LONG_FOCAL_LENGTH:81 case CanonMakernoteDirectory.CameraSettings.TAG_LONG_FOCAL_LENGTH: 73 82 return getLongFocalLengthDescription(); 74 case CanonMakernoteDirectory. TAG_CANON_STATE1_SHORT_FOCAL_LENGTH:83 case CanonMakernoteDirectory.CameraSettings.TAG_SHORT_FOCAL_LENGTH: 75 84 return getShortFocalLengthDescription(); 76 case CanonMakernoteDirectory. TAG_CANON_STATE1_FOCAL_UNITS_PER_MM:85 case CanonMakernoteDirectory.CameraSettings.TAG_FOCAL_UNITS_PER_MM: 77 86 return getFocalUnitsPerMillimetreDescription(); 78 case CanonMakernoteDirectory. TAG_CANON_STATE1_FLASH_DETAILS:87 case CanonMakernoteDirectory.CameraSettings.TAG_FLASH_DETAILS: 79 88 return getFlashDetailsDescription(); 80 case CanonMakernoteDirectory. TAG_CANON_STATE1_FOCUS_MODE_2:89 case CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_2: 81 90 return getFocusMode2Description(); 82 case CanonMakernoteDirectory. TAG_CANON_STATE2_WHITE_BALANCE:91 case CanonMakernoteDirectory.FocalLength.TAG_WHITE_BALANCE: 83 92 return getWhiteBalanceDescription(); 84 case CanonMakernoteDirectory. TAG_CANON_STATE2_AF_POINT_USED:93 case CanonMakernoteDirectory.FocalLength.TAG_AF_POINT_USED: 85 94 return getAfPointUsedDescription(); 86 case CanonMakernoteDirectory. TAG_CANON_STATE2_FLASH_BIAS:95 case CanonMakernoteDirectory.FocalLength.TAG_FLASH_BIAS: 87 96 return getFlashBiasDescription(); 88 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_LONG_EXPOSURE_NOISE_REDUCTION: 89 return getLongExposureNoiseReductionDescription(); 90 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS: 91 return getShutterAutoExposureLockButtonDescription(); 92 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP: 93 return getMirrorLockupDescription(); 94 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL: 95 return getTvAndAvExposureLevelDescription(); 96 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT: 97 return getAutoFocusAssistLightDescription(); 98 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE: 99 return getShutterSpeedInAvModeDescription(); 100 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_BRACKETTING: 101 return getAutoExposureBrackettingSequenceAndAutoCancellationDescription(); 102 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC: 103 return getShutterCurtainSyncDescription(); 104 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_STOP: 105 return getLensAutoFocusStopButtonDescription(); 106 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION: 107 return getFillFlashReductionDescription(); 108 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN: 109 return getMenuButtonReturnPositionDescription(); 110 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION: 111 return getSetButtonFunctionWhenShootingDescription(); 112 case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING: 113 return getSensorCleaningDescription(); 114 default: 115 return _directory.getString(tagType); 116 } 117 } 118 119 public String getLongExposureNoiseReductionDescription() throws MetadataException 120 { 121 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_LONG_EXPOSURE_NOISE_REDUCTION)) return null; 122 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_LONG_EXPOSURE_NOISE_REDUCTION); 97 98 // It turns out that these values are dependent upon the camera model and therefore the below code was 99 // incorrect for some Canon models. This needs to be revisited. 100 101 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_LONG_EXPOSURE_NOISE_REDUCTION: 102 // return getLongExposureNoiseReductionDescription(); 103 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS: 104 // return getShutterAutoExposureLockButtonDescription(); 105 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP: 106 // return getMirrorLockupDescription(); 107 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL: 108 // return getTvAndAvExposureLevelDescription(); 109 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT: 110 // return getAutoFocusAssistLightDescription(); 111 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE: 112 // return getShutterSpeedInAvModeDescription(); 113 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_BRACKETTING: 114 // return getAutoExposureBrackettingSequenceAndAutoCancellationDescription(); 115 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC: 116 // return getShutterCurtainSyncDescription(); 117 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_STOP: 118 // return getLensAutoFocusStopButtonDescription(); 119 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION: 120 // return getFillFlashReductionDescription(); 121 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN: 122 // return getMenuButtonReturnPositionDescription(); 123 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION: 124 // return getSetButtonFunctionWhenShootingDescription(); 125 // case CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING: 126 // return getSensorCleaningDescription(); 127 default: 128 return super.getDescription(tagType); 129 } 130 } 131 132 @Nullable 133 public String getSerialNumberDescription() 134 { 135 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_SERIAL_NUMBER); 136 if (value==null) 137 return null; 138 return String.format("%04X%05d", (value >> 8) & 0xFF, value & 0xFF); 139 } 140 141 /* 142 @Nullable 143 public String getLongExposureNoiseReductionDescription() 144 { 145 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_LONG_EXPOSURE_NOISE_REDUCTION); 146 if (value==null) 147 return null; 123 148 switch (value) { 124 149 case 0: return "Off"; … … 127 152 } 128 153 } 129 public String getShutterAutoExposureLockButtonDescription() throws MetadataException 130 { 131 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS)) return null; 132 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS); 154 155 @Nullable 156 public String getShutterAutoExposureLockButtonDescription() 157 { 158 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS); 159 if (value==null) 160 return null; 133 161 switch (value) { 134 162 case 0: return "AF/AE lock"; … … 139 167 } 140 168 } 141 public String getMirrorLockupDescription() throws MetadataException 142 { 143 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP)) return null; 144 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP); 169 170 @Nullable 171 public String getMirrorLockupDescription() 172 { 173 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP); 174 if (value==null) 175 return null; 145 176 switch (value) { 146 177 case 0: return "Disabled"; … … 149 180 } 150 181 } 151 public String getTvAndAvExposureLevelDescription() throws MetadataException 152 { 153 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL)) return null; 154 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL); 182 183 @Nullable 184 public String getTvAndAvExposureLevelDescription() 185 { 186 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL); 187 if (value==null) 188 return null; 155 189 switch (value) { 156 190 case 0: return "1/2 stop"; … … 159 193 } 160 194 } 161 public String getAutoFocusAssistLightDescription() throws MetadataException 162 { 163 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT)) return null; 164 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT); 195 196 @Nullable 197 public String getAutoFocusAssistLightDescription() 198 { 199 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT); 200 if (value==null) 201 return null; 165 202 switch (value) { 166 203 case 0: return "On (Auto)"; … … 169 206 } 170 207 } 171 public String getShutterSpeedInAvModeDescription() throws MetadataException 172 { 173 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE)) return null; 174 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE); 208 209 @Nullable 210 public String getShutterSpeedInAvModeDescription() 211 { 212 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE); 213 if (value==null) 214 return null; 175 215 switch (value) { 176 216 case 0: return "Automatic"; … … 179 219 } 180 220 } 181 public String getAutoExposureBrackettingSequenceAndAutoCancellationDescription() throws MetadataException 182 { 183 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_BRACKETTING)) return null; 184 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_BRACKETTING); 221 222 @Nullable 223 public String getAutoExposureBrackettingSequenceAndAutoCancellationDescription() 224 { 225 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_BRACKETTING); 226 if (value==null) 227 return null; 185 228 switch (value) { 186 229 case 0: return "0,-,+ / Enabled"; … … 191 234 } 192 235 } 193 public String getShutterCurtainSyncDescription() throws MetadataException 194 { 195 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC)) return null; 196 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC); 236 237 @Nullable 238 public String getShutterCurtainSyncDescription() 239 { 240 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC); 241 if (value==null) 242 return null; 197 243 switch (value) { 198 244 case 0: return "1st Curtain Sync"; … … 201 247 } 202 248 } 203 public String getLensAutoFocusStopButtonDescription() throws MetadataException 204 { 205 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_STOP)) return null; 206 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_STOP); 249 250 @Nullable 251 public String getLensAutoFocusStopButtonDescription() 252 { 253 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_STOP); 254 if (value==null) 255 return null; 207 256 switch (value) { 208 257 case 0: return "AF stop"; … … 212 261 } 213 262 } 214 public String getFillFlashReductionDescription() throws MetadataException 215 { 216 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION)) return null; 217 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION); 263 264 @Nullable 265 public String getFillFlashReductionDescription() 266 { 267 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION); 268 if (value==null) 269 return null; 218 270 switch (value) { 219 271 case 0: return "Enabled"; … … 222 274 } 223 275 } 224 public String getMenuButtonReturnPositionDescription() throws MetadataException 225 { 226 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN)) return null; 227 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN); 276 277 @Nullable 278 public String getMenuButtonReturnPositionDescription() 279 { 280 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN); 281 if (value==null) 282 return null; 228 283 switch (value) { 229 284 case 0: return "Top"; … … 233 288 } 234 289 } 235 public String getSetButtonFunctionWhenShootingDescription() throws MetadataException 236 { 237 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION)) return null; 238 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION); 290 291 @Nullable 292 public String getSetButtonFunctionWhenShootingDescription() 293 { 294 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION); 295 if (value==null) 296 return null; 239 297 switch (value) { 240 298 case 0: return "Not Assigned"; … … 245 303 } 246 304 } 247 public String getSensorCleaningDescription() throws MetadataException 248 { 249 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING)) return null; 250 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING); 305 306 @Nullable 307 public String getSensorCleaningDescription() 308 { 309 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING); 310 if (value==null) 311 return null; 251 312 switch (value) { 252 313 case 0: return "Disabled"; … … 255 316 } 256 317 } 257 258 public String getFlashBiasDescription() throws MetadataException 259 { 260 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE2_FLASH_BIAS)) return null; 261 262 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE2_FLASH_BIAS); 318 */ 319 320 @Nullable 321 public String getFlashBiasDescription() 322 { 323 Integer value = _directory.getInteger(CanonMakernoteDirectory.FocalLength.TAG_FLASH_BIAS); 324 325 if (value==null) 326 return null; 263 327 264 328 boolean isNegative = false; … … 278 342 } 279 343 280 public String getAfPointUsedDescription() throws MetadataException 281 { 282 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE2_AF_POINT_USED)) return null; 283 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE2_AF_POINT_USED); 344 @Nullable 345 public String getAfPointUsedDescription() 346 { 347 Integer value = _directory.getInteger(CanonMakernoteDirectory.FocalLength.TAG_AF_POINT_USED); 348 if (value==null) 349 return null; 284 350 if ((value & 0x7) == 0) { 285 351 return "Right"; … … 293 359 } 294 360 295 public String getWhiteBalanceDescription() throws MetadataException 296 { 297 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE2_WHITE_BALANCE)) return null; 298 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE2_WHITE_BALANCE); 361 @Nullable 362 public String getWhiteBalanceDescription() 363 { 364 Integer value = _directory.getInteger(CanonMakernoteDirectory.FocalLength.TAG_WHITE_BALANCE); 365 if (value==null) 366 return null; 299 367 switch (value) { 300 368 case 0: … … 307 375 return "Tungsten"; 308 376 case 4: 309 return "Flo urescent";377 return "Florescent"; 310 378 case 5: 311 379 return "Flash"; … … 317 385 } 318 386 319 public String getFocusMode2Description() throws MetadataException 320 { 321 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCUS_MODE_2)) return null; 322 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCUS_MODE_2); 387 @Nullable 388 public String getFocusMode2Description() 389 { 390 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_2); 391 if (value==null) 392 return null; 323 393 switch (value) { 324 394 case 0: … … 331 401 } 332 402 333 public String getFlashDetailsDescription() throws MetadataException 334 { 335 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_FLASH_DETAILS)) return null; 336 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_FLASH_DETAILS); 337 if (((value << 14) & 1) > 0) { 403 @Nullable 404 public String getFlashDetailsDescription() 405 { 406 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_DETAILS); 407 if (value==null) 408 return null; 409 if (((value >> 14) & 1) > 0) { 338 410 return "External E-TTL"; 339 411 } 340 if (((value <<13) & 1) > 0) {412 if (((value >> 13) & 1) > 0) { 341 413 return "Internal flash"; 342 414 } 343 if (((value <<11) & 1) > 0) {415 if (((value >> 11) & 1) > 0) { 344 416 return "FP sync used"; 345 417 } 346 if (((value <<4) & 1) > 0) {418 if (((value >> 4) & 1) > 0) { 347 419 return "FP sync enabled"; 348 420 } … … 350 422 } 351 423 352 public String getFocalUnitsPerMillimetreDescription() throws MetadataException 353 { 354 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCAL_UNITS_PER_MM)) return ""; 355 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCAL_UNITS_PER_MM); 424 @Nullable 425 public String getFocalUnitsPerMillimetreDescription() 426 { 427 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCAL_UNITS_PER_MM); 428 if (value==null) 429 return null; 356 430 if (value != 0) { 357 431 return Integer.toString(value); … … 361 435 } 362 436 363 public String getShortFocalLengthDescription() throws MetadataException 364 { 365 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_SHORT_FOCAL_LENGTH)) return null; 366 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_SHORT_FOCAL_LENGTH); 437 @Nullable 438 public String getShortFocalLengthDescription() 439 { 440 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SHORT_FOCAL_LENGTH); 441 if (value==null) 442 return null; 367 443 String units = getFocalUnitsPerMillimetreDescription(); 368 444 return Integer.toString(value) + " " + units; 369 445 } 370 446 371 public String getLongFocalLengthDescription() throws MetadataException 372 { 373 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_LONG_FOCAL_LENGTH)) return null; 374 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_LONG_FOCAL_LENGTH); 447 @Nullable 448 public String getLongFocalLengthDescription() 449 { 450 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_LONG_FOCAL_LENGTH); 451 if (value==null) 452 return null; 375 453 String units = getFocalUnitsPerMillimetreDescription(); 376 454 return Integer.toString(value) + " " + units; 377 455 } 378 456 379 public String getExposureModeDescription() throws MetadataException 380 { 381 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_EXPOSURE_MODE)) return null; 382 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_EXPOSURE_MODE); 457 @Nullable 458 public String getExposureModeDescription() 459 { 460 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_EXPOSURE_MODE); 461 if (value==null) 462 return null; 383 463 switch (value) { 384 464 case 0: … … 399 479 } 400 480 401 public String getAfPointSelectedDescription() throws MetadataException 402 { 403 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_AF_POINT_SELECTED)) return null; 404 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_AF_POINT_SELECTED); 481 @Nullable 482 public String getAfPointSelectedDescription() 483 { 484 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_AF_POINT_SELECTED); 485 if (value==null) 486 return null; 405 487 switch (value) { 406 488 case 0x3000: … … 419 501 } 420 502 421 public String getMeteringModeDescription() throws MetadataException 422 { 423 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_METERING_MODE)) return null; 424 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_METERING_MODE); 503 @Nullable 504 public String getMeteringModeDescription() 505 { 506 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_METERING_MODE); 507 if (value==null) 508 return null; 425 509 switch (value) { 426 510 case 3: … … 435 519 } 436 520 437 public String getIsoDescription() throws MetadataException 438 { 439 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_ISO)) return null; 440 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_ISO); 521 @Nullable 522 public String getIsoDescription() 523 { 524 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_ISO); 525 if (value==null) 526 return null; 527 528 // Canon PowerShot S3 is special 529 int canonMask = 0x4000; 530 if ((value & canonMask) > 0) 531 return "" + (value & ~canonMask); 532 441 533 switch (value) { 442 534 case 0: … … 457 549 } 458 550 459 public String getSharpnessDescription() throws MetadataException 460 { 461 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_SHARPNESS)) return null; 462 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_SHARPNESS); 551 @Nullable 552 public String getSharpnessDescription() 553 { 554 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SHARPNESS); 555 if (value==null) 556 return null; 463 557 switch (value) { 464 558 case 0xFFFF: … … 473 567 } 474 568 475 public String getSaturationDescription() throws MetadataException 476 { 477 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_SATURATION)) return null; 478 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_SATURATION); 569 @Nullable 570 public String getSaturationDescription() 571 { 572 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SATURATION); 573 if (value==null) 574 return null; 479 575 switch (value) { 480 576 case 0xFFFF: … … 489 585 } 490 586 491 public String getContrastDescription() throws MetadataException 492 { 493 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_CONTRAST)) return null; 494 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_CONTRAST); 587 @Nullable 588 public String getContrastDescription() 589 { 590 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_CONTRAST); 591 if (value==null) 592 return null; 495 593 switch (value) { 496 594 case 0xFFFF: … … 505 603 } 506 604 507 public String getEasyShootingModeDescription() throws MetadataException 508 { 509 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_EASY_SHOOTING_MODE)) return null; 510 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_EASY_SHOOTING_MODE); 605 @Nullable 606 public String getEasyShootingModeDescription() 607 { 608 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_EASY_SHOOTING_MODE); 609 if (value==null) 610 return null; 511 611 switch (value) { 512 612 case 0: … … 539 639 } 540 640 541 public String getImageSizeDescription() throws MetadataException 542 { 543 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_IMAGE_SIZE)) return null; 544 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_IMAGE_SIZE); 641 @Nullable 642 public String getImageSizeDescription() 643 { 644 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_IMAGE_SIZE); 645 if (value==null) 646 return null; 545 647 switch (value) { 546 648 case 0: … … 555 657 } 556 658 557 public String getFocusMode1Description() throws MetadataException 558 { 559 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCUS_MODE_1)) return null; 560 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCUS_MODE_1); 659 @Nullable 660 public String getFocusMode1Description() 661 { 662 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_1); 663 if (value==null) 664 return null; 561 665 switch (value) { 562 666 case 0: … … 580 684 } 581 685 582 public String getContinuousDriveModeDescription() throws MetadataException583 {584 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_CONTINUOUS_DRIVE_MODE)) return null;585 intvalue = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_CONTINUOUS_DRIVE_MODE);586 switch(value) {587 case 0:588 if (_directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_SELF_TIMER_DELAY) == 0) {589 return "Single shot";590 } else {591 return "Single shot with self-timer";592 }686 @Nullable 687 public String getContinuousDriveModeDescription() 688 { 689 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_CONTINUOUS_DRIVE_MODE); 690 if (value==null) 691 return null; 692 switch (value) { 693 case 0: 694 final Integer delay = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SELF_TIMER_DELAY); 695 if (delay!=null) 696 return delay == 0 ? "Single shot" : "Single shot with self-timer"; 593 697 case 1: 594 698 return "Continuous"; 595 default: 596 return "Unknown (" + value + ")"; 597 } 598 } 599 600 public String getFlashModeDescription() throws MetadataException 601 { 602 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_FLASH_MODE)) return null; 603 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_FLASH_MODE); 699 } 700 return "Unknown (" + value + ")"; 701 } 702 703 @Nullable 704 public String getFlashModeDescription() 705 { 706 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_MODE); 707 if (value==null) 708 return null; 604 709 switch (value) { 605 710 case 0: … … 619 724 case 16: 620 725 // note: this value not set on Canon D30 621 return "Extenal flash"; 622 default: 623 return "Unknown (" + value + ")"; 624 } 625 } 626 627 public String getSelfTimerDelayDescription() throws MetadataException 628 { 629 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_SELF_TIMER_DELAY)) return null; 630 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_SELF_TIMER_DELAY); 726 return "External flash"; 727 default: 728 return "Unknown (" + value + ")"; 729 } 730 } 731 732 @Nullable 733 public String getSelfTimerDelayDescription() 734 { 735 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SELF_TIMER_DELAY); 736 if (value==null) 737 return null; 631 738 if (value == 0) { 632 739 return "Self timer not used"; … … 637 744 } 638 745 639 public String getMacroModeDescription() throws MetadataException 640 { 641 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_MACRO_MODE)) return null; 642 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_MACRO_MODE); 746 @Nullable 747 public String getMacroModeDescription() 748 { 749 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_MACRO_MODE); 750 if (value==null) 751 return null; 643 752 switch (value) { 644 753 case 1: … … 651 760 } 652 761 653 public String getQualityDescription() throws MetadataException 654 { 655 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_QUALITY)) return null; 656 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_QUALITY); 762 @Nullable 763 public String getQualityDescription() 764 { 765 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_QUALITY); 766 if (value==null) 767 return null; 657 768 switch (value) { 658 769 case 2: … … 667 778 } 668 779 669 public String getDigitalZoomDescription() throws MetadataException 670 { 671 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_DIGITAL_ZOOM)) return null; 672 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_DIGITAL_ZOOM); 780 @Nullable 781 public String getDigitalZoomDescription() 782 { 783 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_DIGITAL_ZOOM); 784 if (value==null) 785 return null; 673 786 switch (value) { 674 787 case 0: … … 683 796 } 684 797 685 public String getFocusTypeDescription() throws MetadataException 686 { 687 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCUS_TYPE)) return null; 688 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_FOCUS_TYPE); 798 @Nullable 799 public String getFocusTypeDescription() 800 { 801 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_TYPE); 802 if (value==null) 803 return null; 689 804 switch (value) { 690 805 case 0: … … 701 816 } 702 817 703 public String getFlashActivityDescription() throws MetadataException 704 { 705 if (!_directory.containsTag(CanonMakernoteDirectory.TAG_CANON_STATE1_FLASH_ACTIVITY)) return null; 706 int value = _directory.getInt(CanonMakernoteDirectory.TAG_CANON_STATE1_FLASH_ACTIVITY); 818 @Nullable 819 public String getFlashActivityDescription() 820 { 821 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_ACTIVITY); 822 if (value==null) 823 return null; 707 824 switch (value) { 708 825 case 0:
Note:
See TracChangeset
for help on using the changeset viewer.