| 1 | /*
|
|---|
| 2 | * Copyright 2002-2016 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 | package com.drew.metadata.exif.makernotes;
|
|---|
| 22 |
|
|---|
| 23 | import com.drew.lang.DateUtil;
|
|---|
| 24 | import com.drew.lang.annotations.NotNull;
|
|---|
| 25 | import com.drew.lang.annotations.Nullable;
|
|---|
| 26 | import com.drew.metadata.TagDescriptor;
|
|---|
| 27 |
|
|---|
| 28 | import java.math.RoundingMode;
|
|---|
| 29 | import java.text.DecimalFormat;
|
|---|
| 30 |
|
|---|
| 31 | import static com.drew.metadata.exif.makernotes.OlympusMakernoteDirectory.*;
|
|---|
| 32 |
|
|---|
| 33 | /**
|
|---|
| 34 | * Provides human-readable string representations of tag values stored in a {@link OlympusMakernoteDirectory}.
|
|---|
| 35 | *
|
|---|
| 36 | * @author Drew Noakes https://drewnoakes.com
|
|---|
| 37 | */
|
|---|
| 38 | public class OlympusMakernoteDescriptor extends TagDescriptor<OlympusMakernoteDirectory>
|
|---|
| 39 | {
|
|---|
| 40 | // TODO extend support for some offset-encoded byte[] tags: http://www.ozhiker.com/electronics/pjmt/jpeg_info/olympus_mn.html
|
|---|
| 41 |
|
|---|
| 42 | public OlympusMakernoteDescriptor(@NotNull OlympusMakernoteDirectory directory)
|
|---|
| 43 | {
|
|---|
| 44 | super(directory);
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | @Override
|
|---|
| 48 | @Nullable
|
|---|
| 49 | public String getDescription(int tagType)
|
|---|
| 50 | {
|
|---|
| 51 | switch (tagType) {
|
|---|
| 52 | case TAG_MAKERNOTE_VERSION:
|
|---|
| 53 | return getMakernoteVersionDescription();
|
|---|
| 54 | case TAG_COLOUR_MODE:
|
|---|
| 55 | return getColorModeDescription();
|
|---|
| 56 | case TAG_IMAGE_QUALITY_1:
|
|---|
| 57 | return getImageQuality1Description();
|
|---|
| 58 | case TAG_IMAGE_QUALITY_2:
|
|---|
| 59 | return getImageQuality2Description();
|
|---|
| 60 | case TAG_SPECIAL_MODE:
|
|---|
| 61 | return getSpecialModeDescription();
|
|---|
| 62 | case TAG_JPEG_QUALITY:
|
|---|
| 63 | return getJpegQualityDescription();
|
|---|
| 64 | case TAG_MACRO_MODE:
|
|---|
| 65 | return getMacroModeDescription();
|
|---|
| 66 | case TAG_BW_MODE:
|
|---|
| 67 | return getBWModeDescription();
|
|---|
| 68 | case TAG_DIGI_ZOOM_RATIO:
|
|---|
| 69 | return getDigiZoomRatioDescription();
|
|---|
| 70 | case TAG_CAMERA_ID:
|
|---|
| 71 | return getCameraIdDescription();
|
|---|
| 72 | case TAG_FLASH_MODE:
|
|---|
| 73 | return getFlashModeDescription();
|
|---|
| 74 | case TAG_FOCUS_RANGE:
|
|---|
| 75 | return getFocusRangeDescription();
|
|---|
| 76 | case TAG_FOCUS_MODE:
|
|---|
| 77 | return getFocusModeDescription();
|
|---|
| 78 | case TAG_SHARPNESS:
|
|---|
| 79 | return getSharpnessDescription();
|
|---|
| 80 |
|
|---|
| 81 | case CameraSettings.TAG_EXPOSURE_MODE:
|
|---|
| 82 | return getExposureModeDescription();
|
|---|
| 83 | case CameraSettings.TAG_FLASH_MODE:
|
|---|
| 84 | return getFlashModeCameraSettingDescription();
|
|---|
| 85 | case CameraSettings.TAG_WHITE_BALANCE:
|
|---|
| 86 | return getWhiteBalanceDescription();
|
|---|
| 87 | case CameraSettings.TAG_IMAGE_SIZE:
|
|---|
| 88 | return getImageSizeDescription();
|
|---|
| 89 | case CameraSettings.TAG_IMAGE_QUALITY:
|
|---|
| 90 | return getImageQualityDescription();
|
|---|
| 91 | case CameraSettings.TAG_SHOOTING_MODE:
|
|---|
| 92 | return getShootingModeDescription();
|
|---|
| 93 | case CameraSettings.TAG_METERING_MODE:
|
|---|
| 94 | return getMeteringModeDescription();
|
|---|
| 95 | case CameraSettings.TAG_APEX_FILM_SPEED_VALUE:
|
|---|
| 96 | return getApexFilmSpeedDescription();
|
|---|
| 97 | case CameraSettings.TAG_APEX_SHUTTER_SPEED_TIME_VALUE:
|
|---|
| 98 | return getApexShutterSpeedTimeDescription();
|
|---|
| 99 | case CameraSettings.TAG_APEX_APERTURE_VALUE:
|
|---|
| 100 | return getApexApertureDescription();
|
|---|
| 101 | case CameraSettings.TAG_MACRO_MODE:
|
|---|
| 102 | return getMacroModeCameraSettingDescription();
|
|---|
| 103 | case CameraSettings.TAG_DIGITAL_ZOOM:
|
|---|
| 104 | return getDigitalZoomDescription();
|
|---|
| 105 | case CameraSettings.TAG_EXPOSURE_COMPENSATION:
|
|---|
| 106 | return getExposureCompensationDescription();
|
|---|
| 107 | case CameraSettings.TAG_BRACKET_STEP:
|
|---|
| 108 | return getBracketStepDescription();
|
|---|
| 109 |
|
|---|
| 110 | case CameraSettings.TAG_INTERVAL_LENGTH:
|
|---|
| 111 | return getIntervalLengthDescription();
|
|---|
| 112 | case CameraSettings.TAG_INTERVAL_NUMBER:
|
|---|
| 113 | return getIntervalNumberDescription();
|
|---|
| 114 | case CameraSettings.TAG_FOCAL_LENGTH:
|
|---|
| 115 | return getFocalLengthDescription();
|
|---|
| 116 | case CameraSettings.TAG_FOCUS_DISTANCE:
|
|---|
| 117 | return getFocusDistanceDescription();
|
|---|
| 118 | case CameraSettings.TAG_FLASH_FIRED:
|
|---|
| 119 | return getFlashFiredDescription();
|
|---|
| 120 | case CameraSettings.TAG_DATE:
|
|---|
| 121 | return getDateDescription();
|
|---|
| 122 | case CameraSettings.TAG_TIME:
|
|---|
| 123 | return getTimeDescription();
|
|---|
| 124 | case CameraSettings.TAG_MAX_APERTURE_AT_FOCAL_LENGTH:
|
|---|
| 125 | return getMaxApertureAtFocalLengthDescription();
|
|---|
| 126 |
|
|---|
| 127 | case CameraSettings.TAG_FILE_NUMBER_MEMORY:
|
|---|
| 128 | return getFileNumberMemoryDescription();
|
|---|
| 129 | case CameraSettings.TAG_LAST_FILE_NUMBER:
|
|---|
| 130 | return getLastFileNumberDescription();
|
|---|
| 131 | case CameraSettings.TAG_WHITE_BALANCE_RED:
|
|---|
| 132 | return getWhiteBalanceRedDescription();
|
|---|
| 133 | case CameraSettings.TAG_WHITE_BALANCE_GREEN:
|
|---|
| 134 | return getWhiteBalanceGreenDescription();
|
|---|
| 135 | case CameraSettings.TAG_WHITE_BALANCE_BLUE:
|
|---|
| 136 | return getWhiteBalanceBlueDescription();
|
|---|
| 137 | case CameraSettings.TAG_SATURATION:
|
|---|
| 138 | return getSaturationDescription();
|
|---|
| 139 | case CameraSettings.TAG_CONTRAST:
|
|---|
| 140 | return getContrastDescription();
|
|---|
| 141 | case CameraSettings.TAG_SHARPNESS:
|
|---|
| 142 | return getSharpnessCameraSettingDescription();
|
|---|
| 143 | case CameraSettings.TAG_SUBJECT_PROGRAM:
|
|---|
| 144 | return getSubjectProgramDescription();
|
|---|
| 145 | case CameraSettings.TAG_FLASH_COMPENSATION:
|
|---|
| 146 | return getFlashCompensationDescription();
|
|---|
| 147 | case CameraSettings.TAG_ISO_SETTING:
|
|---|
| 148 | return getIsoSettingDescription();
|
|---|
| 149 | case CameraSettings.TAG_CAMERA_MODEL:
|
|---|
| 150 | return getCameraModelDescription();
|
|---|
| 151 | case CameraSettings.TAG_INTERVAL_MODE:
|
|---|
| 152 | return getIntervalModeDescription();
|
|---|
| 153 | case CameraSettings.TAG_FOLDER_NAME:
|
|---|
| 154 | return getFolderNameDescription();
|
|---|
| 155 | case CameraSettings.TAG_COLOR_MODE:
|
|---|
| 156 | return getColorModeCameraSettingDescription();
|
|---|
| 157 | case CameraSettings.TAG_COLOR_FILTER:
|
|---|
| 158 | return getColorFilterDescription();
|
|---|
| 159 | case CameraSettings.TAG_BLACK_AND_WHITE_FILTER:
|
|---|
| 160 | return getBlackAndWhiteFilterDescription();
|
|---|
| 161 | case CameraSettings.TAG_INTERNAL_FLASH:
|
|---|
| 162 | return getInternalFlashDescription();
|
|---|
| 163 | case CameraSettings.TAG_APEX_BRIGHTNESS_VALUE:
|
|---|
| 164 | return getApexBrightnessDescription();
|
|---|
| 165 | case CameraSettings.TAG_SPOT_FOCUS_POINT_X_COORDINATE:
|
|---|
| 166 | return getSpotFocusPointXCoordinateDescription();
|
|---|
| 167 | case CameraSettings.TAG_SPOT_FOCUS_POINT_Y_COORDINATE:
|
|---|
| 168 | return getSpotFocusPointYCoordinateDescription();
|
|---|
| 169 | case CameraSettings.TAG_WIDE_FOCUS_ZONE:
|
|---|
| 170 | return getWideFocusZoneDescription();
|
|---|
| 171 | case CameraSettings.TAG_FOCUS_MODE:
|
|---|
| 172 | return getFocusModeCameraSettingDescription();
|
|---|
| 173 | case CameraSettings.TAG_FOCUS_AREA:
|
|---|
| 174 | return getFocusAreaDescription();
|
|---|
| 175 | case CameraSettings.TAG_DEC_SWITCH_POSITION:
|
|---|
| 176 | return getDecSwitchPositionDescription();
|
|---|
| 177 |
|
|---|
| 178 | default:
|
|---|
| 179 | return super.getDescription(tagType);
|
|---|
| 180 | }
|
|---|
| 181 | }
|
|---|
| 182 |
|
|---|
| 183 | @Nullable
|
|---|
| 184 | public String getExposureModeDescription()
|
|---|
| 185 | {
|
|---|
| 186 | return getIndexedDescription(CameraSettings.TAG_EXPOSURE_MODE, "P", "A", "S", "M");
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | @Nullable
|
|---|
| 190 | public String getFlashModeCameraSettingDescription()
|
|---|
| 191 | {
|
|---|
| 192 | return getIndexedDescription(CameraSettings.TAG_FLASH_MODE,
|
|---|
| 193 | "Normal", "Red-eye reduction", "Rear flash sync", "Wireless");
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | @Nullable
|
|---|
| 197 | public String getWhiteBalanceDescription()
|
|---|
| 198 | {
|
|---|
| 199 | return getIndexedDescription(CameraSettings.TAG_WHITE_BALANCE,
|
|---|
| 200 | "Auto", // 0
|
|---|
| 201 | "Daylight",
|
|---|
| 202 | "Cloudy",
|
|---|
| 203 | "Tungsten",
|
|---|
| 204 | null,
|
|---|
| 205 | "Custom", // 5
|
|---|
| 206 | null,
|
|---|
| 207 | "Fluorescent",
|
|---|
| 208 | "Fluorescent 2",
|
|---|
| 209 | null,
|
|---|
| 210 | null, // 10
|
|---|
| 211 | "Custom 2",
|
|---|
| 212 | "Custom 3"
|
|---|
| 213 | );
|
|---|
| 214 | }
|
|---|
| 215 |
|
|---|
| 216 | @Nullable
|
|---|
| 217 | public String getImageSizeDescription()
|
|---|
| 218 | {
|
|---|
| 219 | // This is a pretty weird way to store this information!
|
|---|
| 220 | return getIndexedDescription(CameraSettings.TAG_IMAGE_SIZE, "2560 x 1920", "1600 x 1200", "1280 x 960", "640 x 480");
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | @Nullable
|
|---|
| 224 | public String getImageQualityDescription()
|
|---|
| 225 | {
|
|---|
| 226 | return getIndexedDescription(CameraSettings.TAG_IMAGE_QUALITY, "Raw", "Super Fine", "Fine", "Standard", "Economy", "Extra Fine");
|
|---|
| 227 | }
|
|---|
| 228 |
|
|---|
| 229 | @Nullable
|
|---|
| 230 | public String getShootingModeDescription()
|
|---|
| 231 | {
|
|---|
| 232 | return getIndexedDescription(CameraSettings.TAG_SHOOTING_MODE,
|
|---|
| 233 | "Single",
|
|---|
| 234 | "Continuous",
|
|---|
| 235 | "Self Timer",
|
|---|
| 236 | null,
|
|---|
| 237 | "Bracketing",
|
|---|
| 238 | "Interval",
|
|---|
| 239 | "UHS Continuous",
|
|---|
| 240 | "HS Continuous"
|
|---|
| 241 | );
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 | @Nullable
|
|---|
| 245 | public String getMeteringModeDescription()
|
|---|
| 246 | {
|
|---|
| 247 | return getIndexedDescription(CameraSettings.TAG_METERING_MODE, "Multi-Segment", "Centre Weighted", "Spot");
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | @Nullable
|
|---|
| 251 | public String getApexFilmSpeedDescription()
|
|---|
| 252 | {
|
|---|
| 253 | // http://www.ozhiker.com/electronics/pjmt/jpeg_info/minolta_mn.html#Minolta_Camera_Settings
|
|---|
| 254 | // Apex Speed value = value/8-1 ,
|
|---|
| 255 | // ISO = (2^(value/8-1))*3.125
|
|---|
| 256 | Long value = _directory.getLongObject(CameraSettings.TAG_APEX_FILM_SPEED_VALUE);
|
|---|
| 257 |
|
|---|
| 258 | if (value == null)
|
|---|
| 259 | return null;
|
|---|
| 260 |
|
|---|
| 261 | double iso = Math.pow((value / 8d) - 1, 2) * 3.125;
|
|---|
| 262 | DecimalFormat format = new DecimalFormat("0.##");
|
|---|
| 263 | format.setRoundingMode(RoundingMode.HALF_UP);
|
|---|
| 264 | return format.format(iso);
|
|---|
| 265 | }
|
|---|
| 266 |
|
|---|
| 267 | @Nullable
|
|---|
| 268 | public String getApexShutterSpeedTimeDescription()
|
|---|
| 269 | {
|
|---|
| 270 | // http://www.ozhiker.com/electronics/pjmt/jpeg_info/minolta_mn.html#Minolta_Camera_Settings
|
|---|
| 271 | // Apex Time value = value/8-6 ,
|
|---|
| 272 | // ShutterSpeed = 2^( (48-value)/8 ),
|
|---|
| 273 | // Due to rounding error value=8 should be displayed as 30 sec.
|
|---|
| 274 | Long value = _directory.getLongObject(CameraSettings.TAG_APEX_SHUTTER_SPEED_TIME_VALUE);
|
|---|
| 275 |
|
|---|
| 276 | if (value == null)
|
|---|
| 277 | return null;
|
|---|
| 278 |
|
|---|
| 279 | double shutterSpeed = Math.pow((49-value) / 8d, 2);
|
|---|
| 280 | DecimalFormat format = new DecimalFormat("0.###");
|
|---|
| 281 | format.setRoundingMode(RoundingMode.HALF_UP);
|
|---|
| 282 | return format.format(shutterSpeed) + " sec";
|
|---|
| 283 | }
|
|---|
| 284 |
|
|---|
| 285 | @Nullable
|
|---|
| 286 | public String getApexApertureDescription()
|
|---|
| 287 | {
|
|---|
| 288 | // http://www.ozhiker.com/electronics/pjmt/jpeg_info/minolta_mn.html#Minolta_Camera_Settings
|
|---|
| 289 | // Apex Aperture Value = value/8-1 ,
|
|---|
| 290 | // Aperture F-stop = 2^( value/16-0.5 )
|
|---|
| 291 | Long value = _directory.getLongObject(CameraSettings.TAG_APEX_APERTURE_VALUE);
|
|---|
| 292 |
|
|---|
| 293 | if (value == null)
|
|---|
| 294 | return null;
|
|---|
| 295 |
|
|---|
| 296 | double fStop = Math.pow((value/16d) - 0.5, 2);
|
|---|
| 297 | return getFStopDescription(fStop);
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | @Nullable
|
|---|
| 301 | public String getMacroModeCameraSettingDescription()
|
|---|
| 302 | {
|
|---|
| 303 | return getIndexedDescription(CameraSettings.TAG_MACRO_MODE, "Off", "On");
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | @Nullable
|
|---|
| 307 | public String getDigitalZoomDescription()
|
|---|
| 308 | {
|
|---|
| 309 | return getIndexedDescription(CameraSettings.TAG_DIGITAL_ZOOM, "Off", "Electronic magnification", "Digital zoom 2x");
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | @Nullable
|
|---|
| 313 | public String getExposureCompensationDescription()
|
|---|
| 314 | {
|
|---|
| 315 | Long value = _directory.getLongObject(CameraSettings.TAG_EXPOSURE_COMPENSATION);
|
|---|
| 316 | DecimalFormat format = new DecimalFormat("0.##");
|
|---|
| 317 | return value == null ? null : format.format((value / 3d) - 2) + " EV";
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 | @Nullable
|
|---|
| 321 | public String getBracketStepDescription()
|
|---|
| 322 | {
|
|---|
| 323 | return getIndexedDescription(CameraSettings.TAG_BRACKET_STEP, "1/3 EV", "2/3 EV", "1 EV");
|
|---|
| 324 | }
|
|---|
| 325 |
|
|---|
| 326 | @Nullable
|
|---|
| 327 | public String getIntervalLengthDescription()
|
|---|
| 328 | {
|
|---|
| 329 | if (!_directory.isIntervalMode())
|
|---|
| 330 | return "N/A";
|
|---|
| 331 |
|
|---|
| 332 | Long value = _directory.getLongObject(CameraSettings.TAG_INTERVAL_LENGTH);
|
|---|
| 333 | return value == null ? null : value + " min";
|
|---|
| 334 | }
|
|---|
| 335 |
|
|---|
| 336 | @Nullable
|
|---|
| 337 | public String getIntervalNumberDescription()
|
|---|
| 338 | {
|
|---|
| 339 | if (!_directory.isIntervalMode())
|
|---|
| 340 | return "N/A";
|
|---|
| 341 |
|
|---|
| 342 | Long value = _directory.getLongObject(CameraSettings.TAG_INTERVAL_NUMBER);
|
|---|
| 343 | return value == null ? null : Long.toString(value);
|
|---|
| 344 | }
|
|---|
| 345 |
|
|---|
| 346 | @Nullable
|
|---|
| 347 | public String getFocalLengthDescription()
|
|---|
| 348 | {
|
|---|
| 349 | Long value = _directory.getLongObject(CameraSettings.TAG_FOCAL_LENGTH);
|
|---|
| 350 | return value == null ? null : getFocalLengthDescription(value/256d);
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| 353 | @Nullable
|
|---|
| 354 | public String getFocusDistanceDescription()
|
|---|
| 355 | {
|
|---|
| 356 | Long value = _directory.getLongObject(CameraSettings.TAG_FOCUS_DISTANCE);
|
|---|
| 357 | return value == null
|
|---|
| 358 | ? null
|
|---|
| 359 | : value == 0
|
|---|
| 360 | ? "Infinity"
|
|---|
| 361 | : value + " mm";
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | @Nullable
|
|---|
| 365 | public String getFlashFiredDescription()
|
|---|
| 366 | {
|
|---|
| 367 | return getIndexedDescription(CameraSettings.TAG_FLASH_FIRED, "No", "Yes");
|
|---|
| 368 | }
|
|---|
| 369 |
|
|---|
| 370 | @Nullable
|
|---|
| 371 | public String getDateDescription()
|
|---|
| 372 | {
|
|---|
| 373 | // day = value%256,
|
|---|
| 374 | // month = floor( (value - floor( value/65536 )*65536 )/256 )
|
|---|
| 375 | // year = floor( value/65536)
|
|---|
| 376 | Long value = _directory.getLongObject(CameraSettings.TAG_DATE);
|
|---|
| 377 | if (value == null)
|
|---|
| 378 | return null;
|
|---|
| 379 |
|
|---|
| 380 | int day = (int) (value & 0xFF);
|
|---|
| 381 | int month = (int) ((value >> 16) & 0xFF);
|
|---|
| 382 | int year = (int) ((value >> 8) & 0xFF) + 1970;
|
|---|
| 383 |
|
|---|
| 384 | if (!DateUtil.isValidDate(year, month, day))
|
|---|
| 385 | return "Invalid date";
|
|---|
| 386 |
|
|---|
| 387 | return String.format("%04d-%02d-%02d", year, month + 1, day);
|
|---|
| 388 | }
|
|---|
| 389 |
|
|---|
| 390 | @Nullable
|
|---|
| 391 | public String getTimeDescription()
|
|---|
| 392 | {
|
|---|
| 393 | // hours = floor( value/65536 ),
|
|---|
| 394 | // minutes = floor( ( value - floor( value/65536 )*65536 )/256 ),
|
|---|
| 395 | // seconds = value%256
|
|---|
| 396 | Long value = _directory.getLongObject(CameraSettings.TAG_TIME);
|
|---|
| 397 | if (value == null)
|
|---|
| 398 | return null;
|
|---|
| 399 |
|
|---|
| 400 | int hours = (int) ((value >> 8) & 0xFF);
|
|---|
| 401 | int minutes = (int) ((value >> 16) & 0xFF);
|
|---|
| 402 | int seconds = (int) (value & 0xFF);
|
|---|
| 403 |
|
|---|
| 404 | if (!DateUtil.isValidTime(hours, minutes, seconds))
|
|---|
| 405 | return "Invalid time";
|
|---|
| 406 |
|
|---|
| 407 | return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
|---|
| 408 | }
|
|---|
| 409 |
|
|---|
| 410 | @Nullable
|
|---|
| 411 | public String getMaxApertureAtFocalLengthDescription()
|
|---|
| 412 | {
|
|---|
| 413 | // Aperture F-Stop = 2^(value/16-0.5)
|
|---|
| 414 | Long value = _directory.getLongObject(CameraSettings.TAG_TIME);
|
|---|
| 415 | if (value == null)
|
|---|
| 416 | return null;
|
|---|
| 417 | double fStop = Math.pow((value/16d) - 0.5, 2);
|
|---|
| 418 | return getFStopDescription(fStop);
|
|---|
| 419 | }
|
|---|
| 420 |
|
|---|
| 421 | @Nullable
|
|---|
| 422 | public String getFileNumberMemoryDescription()
|
|---|
| 423 | {
|
|---|
| 424 | return getIndexedDescription(CameraSettings.TAG_FILE_NUMBER_MEMORY, "Off", "On");
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | @Nullable
|
|---|
| 428 | public String getLastFileNumberDescription()
|
|---|
| 429 | {
|
|---|
| 430 | Long value = _directory.getLongObject(CameraSettings.TAG_LAST_FILE_NUMBER);
|
|---|
| 431 | return value == null
|
|---|
| 432 | ? null
|
|---|
| 433 | : value == 0
|
|---|
| 434 | ? "File Number Memory Off"
|
|---|
| 435 | : Long.toString(value);
|
|---|
| 436 | }
|
|---|
| 437 |
|
|---|
| 438 | @Nullable
|
|---|
| 439 | public String getWhiteBalanceRedDescription()
|
|---|
| 440 | {
|
|---|
| 441 | Long value = _directory.getLongObject(CameraSettings.TAG_WHITE_BALANCE_RED);
|
|---|
| 442 | DecimalFormat format = new DecimalFormat("0.##");
|
|---|
| 443 | return value == null ? null : format.format(value/256d);
|
|---|
| 444 | }
|
|---|
| 445 |
|
|---|
| 446 | @Nullable
|
|---|
| 447 | public String getWhiteBalanceGreenDescription()
|
|---|
| 448 | {
|
|---|
| 449 | Long value = _directory.getLongObject(CameraSettings.TAG_WHITE_BALANCE_GREEN);
|
|---|
| 450 | DecimalFormat format = new DecimalFormat("0.##");
|
|---|
| 451 | return value == null ? null : format.format(value/256d);
|
|---|
| 452 | }
|
|---|
| 453 |
|
|---|
| 454 | @Nullable
|
|---|
| 455 | public String getWhiteBalanceBlueDescription()
|
|---|
| 456 | {
|
|---|
| 457 | Long value = _directory.getLongObject(CameraSettings.TAG_WHITE_BALANCE_BLUE);
|
|---|
| 458 | DecimalFormat format = new DecimalFormat("0.##");
|
|---|
| 459 | return value == null ? null : format.format(value / 256d);
|
|---|
| 460 | }
|
|---|
| 461 |
|
|---|
| 462 | @Nullable
|
|---|
| 463 | public String getSaturationDescription()
|
|---|
| 464 | {
|
|---|
| 465 | Long value = _directory.getLongObject(CameraSettings.TAG_SATURATION);
|
|---|
| 466 | return value == null ? null : Long.toString(value-3);
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | @Nullable
|
|---|
| 470 | public String getContrastDescription()
|
|---|
| 471 | {
|
|---|
| 472 | Long value = _directory.getLongObject(CameraSettings.TAG_CONTRAST);
|
|---|
| 473 | return value == null ? null : Long.toString(value-3);
|
|---|
| 474 | }
|
|---|
| 475 |
|
|---|
| 476 | @Nullable
|
|---|
| 477 | public String getSharpnessCameraSettingDescription()
|
|---|
| 478 | {
|
|---|
| 479 | return getIndexedDescription(CameraSettings.TAG_SHARPNESS, "Hard", "Normal", "Soft");
|
|---|
| 480 | }
|
|---|
| 481 |
|
|---|
| 482 | @Nullable
|
|---|
| 483 | public String getSubjectProgramDescription()
|
|---|
| 484 | {
|
|---|
| 485 | return getIndexedDescription(CameraSettings.TAG_SUBJECT_PROGRAM, "None", "Portrait", "Text", "Night Portrait", "Sunset", "Sports Action");
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| 488 | @Nullable
|
|---|
| 489 | public String getFlashCompensationDescription()
|
|---|
| 490 | {
|
|---|
| 491 | Long value = _directory.getLongObject(CameraSettings.TAG_FLASH_COMPENSATION);
|
|---|
| 492 | DecimalFormat format = new DecimalFormat("0.##");
|
|---|
| 493 | return value == null ? null : format.format((value-6)/3d) + " EV";
|
|---|
| 494 | }
|
|---|
| 495 |
|
|---|
| 496 | @Nullable
|
|---|
| 497 | public String getIsoSettingDescription()
|
|---|
| 498 | {
|
|---|
| 499 | return getIndexedDescription(CameraSettings.TAG_ISO_SETTING, "100", "200", "400", "800", "Auto", "64");
|
|---|
| 500 | }
|
|---|
| 501 |
|
|---|
| 502 | @Nullable
|
|---|
| 503 | public String getCameraModelDescription()
|
|---|
| 504 | {
|
|---|
| 505 | return getIndexedDescription(CameraSettings.TAG_CAMERA_MODEL,
|
|---|
| 506 | "DiMAGE 7",
|
|---|
| 507 | "DiMAGE 5",
|
|---|
| 508 | "DiMAGE S304",
|
|---|
| 509 | "DiMAGE S404",
|
|---|
| 510 | "DiMAGE 7i",
|
|---|
| 511 | "DiMAGE 7Hi",
|
|---|
| 512 | "DiMAGE A1",
|
|---|
| 513 | "DiMAGE S414");
|
|---|
| 514 | }
|
|---|
| 515 |
|
|---|
| 516 | @Nullable
|
|---|
| 517 | public String getIntervalModeDescription()
|
|---|
| 518 | {
|
|---|
| 519 | return getIndexedDescription(CameraSettings.TAG_INTERVAL_MODE, "Still Image", "Time Lapse Movie");
|
|---|
| 520 | }
|
|---|
| 521 |
|
|---|
| 522 | @Nullable
|
|---|
| 523 | public String getFolderNameDescription()
|
|---|
| 524 | {
|
|---|
| 525 | return getIndexedDescription(CameraSettings.TAG_FOLDER_NAME, "Standard Form", "Data Form");
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 | @Nullable
|
|---|
| 529 | public String getColorModeCameraSettingDescription()
|
|---|
| 530 | {
|
|---|
| 531 | return getIndexedDescription(CameraSettings.TAG_COLOR_MODE, "Natural Color", "Black & White", "Vivid Color", "Solarization", "AdobeRGB");
|
|---|
| 532 | }
|
|---|
| 533 |
|
|---|
| 534 | @Nullable
|
|---|
| 535 | public String getColorFilterDescription()
|
|---|
| 536 | {
|
|---|
| 537 | Long value = _directory.getLongObject(CameraSettings.TAG_COLOR_FILTER);
|
|---|
| 538 | return value == null ? null : Long.toString(value-3);
|
|---|
| 539 | }
|
|---|
| 540 |
|
|---|
| 541 | @Nullable
|
|---|
| 542 | public String getBlackAndWhiteFilterDescription()
|
|---|
| 543 | {
|
|---|
| 544 | return super.getDescription(CameraSettings.TAG_BLACK_AND_WHITE_FILTER);
|
|---|
| 545 | }
|
|---|
| 546 |
|
|---|
| 547 | @Nullable
|
|---|
| 548 | public String getInternalFlashDescription()
|
|---|
| 549 | {
|
|---|
| 550 | return getIndexedDescription(CameraSettings.TAG_INTERNAL_FLASH, "Did Not Fire", "Fired");
|
|---|
| 551 | }
|
|---|
| 552 |
|
|---|
| 553 | @Nullable
|
|---|
| 554 | public String getApexBrightnessDescription()
|
|---|
| 555 | {
|
|---|
| 556 | Long value = _directory.getLongObject(CameraSettings.TAG_APEX_BRIGHTNESS_VALUE);
|
|---|
| 557 | DecimalFormat format = new DecimalFormat("0.##");
|
|---|
| 558 | return value == null ? null : format.format((value/8d)-6);
|
|---|
| 559 | }
|
|---|
| 560 |
|
|---|
| 561 | @Nullable
|
|---|
| 562 | public String getSpotFocusPointXCoordinateDescription()
|
|---|
| 563 | {
|
|---|
| 564 | return super.getDescription(CameraSettings.TAG_SPOT_FOCUS_POINT_X_COORDINATE);
|
|---|
| 565 | }
|
|---|
| 566 |
|
|---|
| 567 | @Nullable
|
|---|
| 568 | public String getSpotFocusPointYCoordinateDescription()
|
|---|
| 569 | {
|
|---|
| 570 | return super.getDescription(CameraSettings.TAG_SPOT_FOCUS_POINT_Y_COORDINATE);
|
|---|
| 571 | }
|
|---|
| 572 |
|
|---|
| 573 | @Nullable
|
|---|
| 574 | public String getWideFocusZoneDescription()
|
|---|
| 575 | {
|
|---|
| 576 | return getIndexedDescription(CameraSettings.TAG_WIDE_FOCUS_ZONE,
|
|---|
| 577 | "No Zone or AF Failed",
|
|---|
| 578 | "Center Zone (Horizontal Orientation)",
|
|---|
| 579 | "Center Zone (Vertical Orientation)",
|
|---|
| 580 | "Left Zone",
|
|---|
| 581 | "Right Zone"
|
|---|
| 582 | );
|
|---|
| 583 | }
|
|---|
| 584 |
|
|---|
| 585 | @Nullable
|
|---|
| 586 | public String getFocusModeCameraSettingDescription()
|
|---|
| 587 | {
|
|---|
| 588 | return getIndexedDescription(CameraSettings.TAG_FOCUS_MODE, "Auto Focus", "Manual Focus");
|
|---|
| 589 | }
|
|---|
| 590 |
|
|---|
| 591 | @Nullable
|
|---|
| 592 | public String getFocusAreaDescription()
|
|---|
| 593 | {
|
|---|
| 594 | return getIndexedDescription(CameraSettings.TAG_FOCUS_AREA, "Wide Focus (Normal)", "Spot Focus");
|
|---|
| 595 | }
|
|---|
| 596 |
|
|---|
| 597 | @Nullable
|
|---|
| 598 | public String getDecSwitchPositionDescription()
|
|---|
| 599 | {
|
|---|
| 600 | return getIndexedDescription(CameraSettings.TAG_DEC_SWITCH_POSITION, "Exposure", "Contrast", "Saturation", "Filter");
|
|---|
| 601 | }
|
|---|
| 602 |
|
|---|
| 603 | @Nullable
|
|---|
| 604 | public String getMakernoteVersionDescription()
|
|---|
| 605 | {
|
|---|
| 606 | return getVersionBytesDescription(TAG_MAKERNOTE_VERSION, 2);
|
|---|
| 607 | }
|
|---|
| 608 |
|
|---|
| 609 | @Nullable
|
|---|
| 610 | public String getImageQuality2Description()
|
|---|
| 611 | {
|
|---|
| 612 | return getIndexedDescription(TAG_IMAGE_QUALITY_2,
|
|---|
| 613 | "Raw",
|
|---|
| 614 | "Super Fine",
|
|---|
| 615 | "Fine",
|
|---|
| 616 | "Standard",
|
|---|
| 617 | "Extra Fine");
|
|---|
| 618 | }
|
|---|
| 619 |
|
|---|
| 620 | @Nullable
|
|---|
| 621 | public String getImageQuality1Description()
|
|---|
| 622 | {
|
|---|
| 623 | return getIndexedDescription(TAG_IMAGE_QUALITY_1,
|
|---|
| 624 | "Raw",
|
|---|
| 625 | "Super Fine",
|
|---|
| 626 | "Fine",
|
|---|
| 627 | "Standard",
|
|---|
| 628 | "Extra Fine");
|
|---|
| 629 | }
|
|---|
| 630 |
|
|---|
| 631 | @Nullable
|
|---|
| 632 | public String getColorModeDescription()
|
|---|
| 633 | {
|
|---|
| 634 | return getIndexedDescription(TAG_COLOUR_MODE,
|
|---|
| 635 | "Natural Colour",
|
|---|
| 636 | "Black & White",
|
|---|
| 637 | "Vivid Colour",
|
|---|
| 638 | "Solarization",
|
|---|
| 639 | "AdobeRGB");
|
|---|
| 640 | }
|
|---|
| 641 |
|
|---|
| 642 | @Nullable
|
|---|
| 643 | public String getSharpnessDescription()
|
|---|
| 644 | {
|
|---|
| 645 | return getIndexedDescription(TAG_SHARPNESS, "Normal", "Hard", "Soft");
|
|---|
| 646 | }
|
|---|
| 647 |
|
|---|
| 648 | @Nullable
|
|---|
| 649 | public String getFocusModeDescription()
|
|---|
| 650 | {
|
|---|
| 651 | return getIndexedDescription(TAG_FOCUS_MODE, "Auto", "Manual");
|
|---|
| 652 | }
|
|---|
| 653 |
|
|---|
| 654 | @Nullable
|
|---|
| 655 | public String getFocusRangeDescription()
|
|---|
| 656 | {
|
|---|
| 657 | return getIndexedDescription(TAG_FOCUS_RANGE, "Normal", "Macro");
|
|---|
| 658 | }
|
|---|
| 659 |
|
|---|
| 660 | @Nullable
|
|---|
| 661 | public String getFlashModeDescription()
|
|---|
| 662 | {
|
|---|
| 663 | return getIndexedDescription(TAG_FLASH_MODE, null, null, "On", "Off");
|
|---|
| 664 | }
|
|---|
| 665 |
|
|---|
| 666 | @Nullable
|
|---|
| 667 | public String getDigiZoomRatioDescription()
|
|---|
| 668 | {
|
|---|
| 669 | return getIndexedDescription(TAG_DIGI_ZOOM_RATIO, "Normal", null, "Digital 2x Zoom");
|
|---|
| 670 | }
|
|---|
| 671 |
|
|---|
| 672 | @Nullable
|
|---|
| 673 | public String getCameraIdDescription()
|
|---|
| 674 | {
|
|---|
| 675 | byte[] bytes = _directory.getByteArray(TAG_CAMERA_ID);
|
|---|
| 676 | if (bytes == null)
|
|---|
| 677 | return null;
|
|---|
| 678 | return new String(bytes);
|
|---|
| 679 | }
|
|---|
| 680 |
|
|---|
| 681 | @Nullable
|
|---|
| 682 | public String getMacroModeDescription()
|
|---|
| 683 | {
|
|---|
| 684 | return getIndexedDescription(TAG_MACRO_MODE, "Normal (no macro)", "Macro");
|
|---|
| 685 | }
|
|---|
| 686 |
|
|---|
| 687 | @Nullable
|
|---|
| 688 | public String getBWModeDescription()
|
|---|
| 689 | {
|
|---|
| 690 | return getIndexedDescription(TAG_BW_MODE, "Off", "On");
|
|---|
| 691 | }
|
|---|
| 692 |
|
|---|
| 693 | @Nullable
|
|---|
| 694 | public String getJpegQualityDescription()
|
|---|
| 695 | {
|
|---|
| 696 | return getIndexedDescription(TAG_JPEG_QUALITY,
|
|---|
| 697 | 1,
|
|---|
| 698 | "Standard Quality",
|
|---|
| 699 | "High Quality",
|
|---|
| 700 | "Super High Quality");
|
|---|
| 701 | }
|
|---|
| 702 |
|
|---|
| 703 | @Nullable
|
|---|
| 704 | public String getSpecialModeDescription()
|
|---|
| 705 | {
|
|---|
| 706 | long[] values = (long[])_directory.getObject(TAG_SPECIAL_MODE);
|
|---|
| 707 | if (values==null)
|
|---|
| 708 | return null;
|
|---|
| 709 | if (values.length < 1)
|
|---|
| 710 | return "";
|
|---|
| 711 | StringBuilder desc = new StringBuilder();
|
|---|
| 712 |
|
|---|
| 713 | switch ((int)values[0]) {
|
|---|
| 714 | case 0:
|
|---|
| 715 | desc.append("Normal picture taking mode");
|
|---|
| 716 | break;
|
|---|
| 717 | case 1:
|
|---|
| 718 | desc.append("Unknown picture taking mode");
|
|---|
| 719 | break;
|
|---|
| 720 | case 2:
|
|---|
| 721 | desc.append("Fast picture taking mode");
|
|---|
| 722 | break;
|
|---|
| 723 | case 3:
|
|---|
| 724 | desc.append("Panorama picture taking mode");
|
|---|
| 725 | break;
|
|---|
| 726 | default:
|
|---|
| 727 | desc.append("Unknown picture taking mode");
|
|---|
| 728 | break;
|
|---|
| 729 | }
|
|---|
| 730 |
|
|---|
| 731 | if (values.length >= 2) {
|
|---|
| 732 | switch ((int)values[1]) {
|
|---|
| 733 | case 0:
|
|---|
| 734 | break;
|
|---|
| 735 | case 1:
|
|---|
| 736 | desc.append(" / 1st in a sequence");
|
|---|
| 737 | break;
|
|---|
| 738 | case 2:
|
|---|
| 739 | desc.append(" / 2nd in a sequence");
|
|---|
| 740 | break;
|
|---|
| 741 | case 3:
|
|---|
| 742 | desc.append(" / 3rd in a sequence");
|
|---|
| 743 | break;
|
|---|
| 744 | default:
|
|---|
| 745 | desc.append(" / ");
|
|---|
| 746 | desc.append(values[1]);
|
|---|
| 747 | desc.append("th in a sequence");
|
|---|
| 748 | break;
|
|---|
| 749 | }
|
|---|
| 750 | }
|
|---|
| 751 | if (values.length >= 3) {
|
|---|
| 752 | switch ((int)values[2]) {
|
|---|
| 753 | case 1:
|
|---|
| 754 | desc.append(" / Left to right panorama direction");
|
|---|
| 755 | break;
|
|---|
| 756 | case 2:
|
|---|
| 757 | desc.append(" / Right to left panorama direction");
|
|---|
| 758 | break;
|
|---|
| 759 | case 3:
|
|---|
| 760 | desc.append(" / Bottom to top panorama direction");
|
|---|
| 761 | break;
|
|---|
| 762 | case 4:
|
|---|
| 763 | desc.append(" / Top to bottom panorama direction");
|
|---|
| 764 | break;
|
|---|
| 765 | }
|
|---|
| 766 | }
|
|---|
| 767 |
|
|---|
| 768 | return desc.toString();
|
|---|
| 769 | }
|
|---|
| 770 | }
|
|---|