| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
package com.drew.metadata.exif.makernotes; |
| 22 |
|
| 23 |
import com.drew.lang.ByteArrayReader; |
| 24 |
import com.drew.lang.Charsets; |
| 25 |
import com.drew.lang.RandomAccessReader; |
| 26 |
import com.drew.lang.annotations.NotNull; |
| 27 |
import com.drew.lang.annotations.Nullable; |
| 28 |
import com.drew.metadata.Age; |
| 29 |
import com.drew.metadata.Face; |
| 30 |
import com.drew.metadata.TagDescriptor; |
| 31 |
|
| 32 |
import java.text.DecimalFormat; |
| 33 |
import java.io.IOException; |
| 34 |
|
| 35 |
import static com.drew.metadata.exif.makernotes.PanasonicMakernoteDirectory.*; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
@SuppressWarnings("WeakerAccess") |
| 50 |
public class PanasonicMakernoteDescriptor extends TagDescriptor<PanasonicMakernoteDirectory> |
| 51 |
{ |
| 52 |
public PanasonicMakernoteDescriptor(@NotNull PanasonicMakernoteDirectory directory) |
| 53 |
{ |
| 54 |
super(directory); |
| 55 |
} |
| 56 |
|
| 57 |
@Override |
| 58 |
@Nullable |
| 59 |
public String getDescription(int tagType) |
| 60 |
{ |
| 61 |
switch (tagType) { |
| 62 |
case TAG_QUALITY_MODE: |
| 63 |
return getQualityModeDescription(); |
| 64 |
case TAG_FIRMWARE_VERSION: |
| 65 |
return getVersionDescription(); |
| 66 |
case TAG_WHITE_BALANCE: |
| 67 |
return getWhiteBalanceDescription(); |
| 68 |
case TAG_FOCUS_MODE: |
| 69 |
return getFocusModeDescription(); |
| 70 |
case TAG_AF_AREA_MODE: |
| 71 |
return getAfAreaModeDescription(); |
| 72 |
case TAG_IMAGE_STABILIZATION: |
| 73 |
return getImageStabilizationDescription(); |
| 74 |
case TAG_MACRO_MODE: |
| 75 |
return getMacroModeDescription(); |
| 76 |
case TAG_RECORD_MODE: |
| 77 |
return getRecordModeDescription(); |
| 78 |
case TAG_AUDIO: |
| 79 |
return getAudioDescription(); |
| 80 |
case TAG_UNKNOWN_DATA_DUMP: |
| 81 |
return getUnknownDataDumpDescription(); |
| 82 |
case TAG_COLOR_EFFECT: |
| 83 |
return getColorEffectDescription(); |
| 84 |
case TAG_UPTIME: |
| 85 |
return getUptimeDescription(); |
| 86 |
case TAG_BURST_MODE: |
| 87 |
return getBurstModeDescription(); |
| 88 |
case TAG_CONTRAST_MODE: |
| 89 |
return getContrastModeDescription(); |
| 90 |
case TAG_NOISE_REDUCTION: |
| 91 |
return getNoiseReductionDescription(); |
| 92 |
case TAG_SELF_TIMER: |
| 93 |
return getSelfTimerDescription(); |
| 94 |
case TAG_ROTATION: |
| 95 |
return getRotationDescription(); |
| 96 |
case TAG_AF_ASSIST_LAMP: |
| 97 |
return getAfAssistLampDescription(); |
| 98 |
case TAG_COLOR_MODE: |
| 99 |
return getColorModeDescription(); |
| 100 |
case TAG_OPTICAL_ZOOM_MODE: |
| 101 |
return getOpticalZoomModeDescription(); |
| 102 |
case TAG_CONVERSION_LENS: |
| 103 |
return getConversionLensDescription(); |
| 104 |
case TAG_CONTRAST: |
| 105 |
return getContrastDescription(); |
| 106 |
case TAG_WORLD_TIME_LOCATION: |
| 107 |
return getWorldTimeLocationDescription(); |
| 108 |
case TAG_ADVANCED_SCENE_MODE: |
| 109 |
return getAdvancedSceneModeDescription(); |
| 110 |
case TAG_FACE_DETECTION_INFO: |
| 111 |
return getDetectedFacesDescription(); |
| 112 |
case TAG_TRANSFORM: |
| 113 |
return getTransformDescription(); |
| 114 |
case TAG_TRANSFORM_1: |
| 115 |
return getTransform1Description(); |
| 116 |
case TAG_INTELLIGENT_EXPOSURE: |
| 117 |
return getIntelligentExposureDescription(); |
| 118 |
case TAG_FLASH_WARNING: |
| 119 |
return getFlashWarningDescription(); |
| 120 |
case TAG_COUNTRY: |
| 121 |
return getCountryDescription(); |
| 122 |
case TAG_STATE: |
| 123 |
return getStateDescription(); |
| 124 |
case TAG_CITY: |
| 125 |
return getCityDescription(); |
| 126 |
case TAG_LANDMARK: |
| 127 |
return getLandmarkDescription(); |
| 128 |
case TAG_INTELLIGENT_RESOLUTION: |
| 129 |
return getIntelligentResolutionDescription(); |
| 130 |
case TAG_FACE_RECOGNITION_INFO: |
| 131 |
return getRecognizedFacesDescription(); |
| 132 |
case TAG_SCENE_MODE: |
| 133 |
return getSceneModeDescription(); |
| 134 |
case TAG_FLASH_FIRED: |
| 135 |
return getFlashFiredDescription(); |
| 136 |
case TAG_TEXT_STAMP: |
| 137 |
return getTextStampDescription(); |
| 138 |
case TAG_TEXT_STAMP_1: |
| 139 |
return getTextStamp1Description(); |
| 140 |
case TAG_TEXT_STAMP_2: |
| 141 |
return getTextStamp2Description(); |
| 142 |
case TAG_TEXT_STAMP_3: |
| 143 |
return getTextStamp3Description(); |
| 144 |
case TAG_MAKERNOTE_VERSION: |
| 145 |
return getMakernoteVersionDescription(); |
| 146 |
case TAG_EXIF_VERSION: |
| 147 |
return getExifVersionDescription(); |
| 148 |
case TAG_INTERNAL_SERIAL_NUMBER: |
| 149 |
return getInternalSerialNumberDescription(); |
| 150 |
case TAG_TITLE: |
| 151 |
return getTitleDescription(); |
| 152 |
case TAG_BRACKET_SETTINGS: |
| 153 |
return getBracketSettingsDescription(); |
| 154 |
case TAG_FLASH_CURTAIN: |
| 155 |
return getFlashCurtainDescription(); |
| 156 |
case TAG_LONG_EXPOSURE_NOISE_REDUCTION: |
| 157 |
return getLongExposureNoiseReductionDescription(); |
| 158 |
case TAG_BABY_NAME: |
| 159 |
return getBabyNameDescription(); |
| 160 |
case TAG_LOCATION: |
| 161 |
return getLocationDescription(); |
| 162 |
|
| 163 |
case TAG_LENS_FIRMWARE_VERSION: |
| 164 |
return getLensFirmwareVersionDescription(); |
| 165 |
case TAG_INTELLIGENT_D_RANGE: |
| 166 |
return getIntelligentDRangeDescription(); |
| 167 |
case TAG_CLEAR_RETOUCH: |
| 168 |
return getClearRetouchDescription(); |
| 169 |
case TAG_PHOTO_STYLE: |
| 170 |
return getPhotoStyleDescription(); |
| 171 |
case TAG_SHADING_COMPENSATION: |
| 172 |
return getShadingCompensationDescription(); |
| 173 |
|
| 174 |
case TAG_ACCELEROMETER_Z: |
| 175 |
return getAccelerometerZDescription(); |
| 176 |
case TAG_ACCELEROMETER_X: |
| 177 |
return getAccelerometerXDescription(); |
| 178 |
case TAG_ACCELEROMETER_Y: |
| 179 |
return getAccelerometerYDescription(); |
| 180 |
case TAG_CAMERA_ORIENTATION: |
| 181 |
return getCameraOrientationDescription(); |
| 182 |
case TAG_ROLL_ANGLE: |
| 183 |
return getRollAngleDescription(); |
| 184 |
case TAG_PITCH_ANGLE: |
| 185 |
return getPitchAngleDescription(); |
| 186 |
case TAG_SWEEP_PANORAMA_DIRECTION: |
| 187 |
return getSweepPanoramaDirectionDescription(); |
| 188 |
case TAG_TIMER_RECORDING: |
| 189 |
return getTimerRecordingDescription(); |
| 190 |
case TAG_HDR: |
| 191 |
return getHDRDescription(); |
| 192 |
case TAG_SHUTTER_TYPE: |
| 193 |
return getShutterTypeDescription(); |
| 194 |
case TAG_TOUCH_AE: |
| 195 |
return getTouchAeDescription(); |
| 196 |
|
| 197 |
case TAG_BABY_AGE: |
| 198 |
return getBabyAgeDescription(); |
| 199 |
case TAG_BABY_AGE_1: |
| 200 |
return getBabyAge1Description(); |
| 201 |
default: |
| 202 |
return super.getDescription(tagType); |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
@Nullable |
| 207 |
public String getTextStampDescription() |
| 208 |
{ |
| 209 |
return getIndexedDescription(TAG_TEXT_STAMP, 1, "Off", "On"); |
| 210 |
} |
| 211 |
|
| 212 |
@Nullable |
| 213 |
public String getTextStamp1Description() |
| 214 |
{ |
| 215 |
return getIndexedDescription(TAG_TEXT_STAMP_1, 1, "Off", "On"); |
| 216 |
} |
| 217 |
|
| 218 |
@Nullable |
| 219 |
public String getTextStamp2Description() |
| 220 |
{ |
| 221 |
return getIndexedDescription(TAG_TEXT_STAMP_2, 1, "Off", "On"); |
| 222 |
} |
| 223 |
|
| 224 |
@Nullable |
| 225 |
public String getTextStamp3Description() |
| 226 |
{ |
| 227 |
return getIndexedDescription(TAG_TEXT_STAMP_3, 1, "Off", "On"); |
| 228 |
} |
| 229 |
|
| 230 |
@Nullable |
| 231 |
public String getMacroModeDescription() |
| 232 |
{ |
| 233 |
return getIndexedDescription(TAG_MACRO_MODE, 1, "Off", "On"); |
| 234 |
} |
| 235 |
|
| 236 |
@Nullable |
| 237 |
public String getFlashFiredDescription() |
| 238 |
{ |
| 239 |
return getIndexedDescription(TAG_FLASH_FIRED, 1, "Off", "On"); |
| 240 |
} |
| 241 |
|
| 242 |
@Nullable |
| 243 |
public String getImageStabilizationDescription() |
| 244 |
{ |
| 245 |
return getIndexedDescription(TAG_IMAGE_STABILIZATION, |
| 246 |
2, |
| 247 |
"On, Mode 1", |
| 248 |
"Off", |
| 249 |
"On, Mode 2" |
| 250 |
); |
| 251 |
} |
| 252 |
|
| 253 |
@Nullable |
| 254 |
public String getAudioDescription() |
| 255 |
{ |
| 256 |
return getIndexedDescription(TAG_AUDIO, 1, "Off", "On"); |
| 257 |
} |
| 258 |
|
| 259 |
@Nullable |
| 260 |
public String getTransformDescription() |
| 261 |
{ |
| 262 |
return getTransformDescription(TAG_TRANSFORM); |
| 263 |
} |
| 264 |
|
| 265 |
@Nullable |
| 266 |
public String getTransform1Description() |
| 267 |
{ |
| 268 |
return getTransformDescription(TAG_TRANSFORM_1); |
| 269 |
} |
| 270 |
|
| 271 |
@Nullable |
| 272 |
private String getTransformDescription(int tag) |
| 273 |
{ |
| 274 |
byte[] values = _directory.getByteArray(tag); |
| 275 |
if (values == null) |
| 276 |
return null; |
| 277 |
|
| 278 |
RandomAccessReader reader = new ByteArrayReader(values); |
| 279 |
|
| 280 |
try |
| 281 |
{ |
| 282 |
int val1 = reader.getUInt16(0); |
| 283 |
int val2 = reader.getUInt16(2); |
| 284 |
|
| 285 |
if (val1 == -1 && val2 == 1) |
| 286 |
return "Slim Low"; |
| 287 |
if (val1 == -3 && val2 == 2) |
| 288 |
return "Slim High"; |
| 289 |
if (val1 == 0 && val2 == 0) |
| 290 |
return "Off"; |
| 291 |
if (val1 == 1 && val2 == 1) |
| 292 |
return "Stretch Low"; |
| 293 |
if (val1 == 3 && val2 == 2) |
| 294 |
return "Stretch High"; |
| 295 |
|
| 296 |
return "Unknown (" + val1 + " " + val2 + ")"; |
| 297 |
} catch (IOException e) { |
| 298 |
return null; |
| 299 |
} |
| 300 |
} |
| 301 |
|
| 302 |
@Nullable |
| 303 |
public String getIntelligentExposureDescription() |
| 304 |
{ |
| 305 |
return getIndexedDescription(TAG_INTELLIGENT_EXPOSURE, |
| 306 |
"Off", "Low", "Standard", "High"); |
| 307 |
} |
| 308 |
|
| 309 |
@Nullable |
| 310 |
public String getFlashWarningDescription() |
| 311 |
{ |
| 312 |
return getIndexedDescription(TAG_FLASH_WARNING, |
| 313 |
"No", "Yes (Flash required but disabled)"); |
| 314 |
} |
| 315 |
|
| 316 |
@Nullable |
| 317 |
private static String trim(@Nullable String s) |
| 318 |
{ |
| 319 |
return s == null ? null : s.trim(); |
| 320 |
} |
| 321 |
|
| 322 |
@Nullable |
| 323 |
public String getCountryDescription() |
| 324 |
{ |
| 325 |
return trim(getStringFromBytes(TAG_COUNTRY, Charsets.UTF_8)); |
| 326 |
} |
| 327 |
|
| 328 |
@Nullable |
| 329 |
public String getStateDescription() |
| 330 |
{ |
| 331 |
return trim(getStringFromBytes(TAG_STATE, Charsets.UTF_8)); |
| 332 |
} |
| 333 |
|
| 334 |
@Nullable |
| 335 |
public String getCityDescription() |
| 336 |
{ |
| 337 |
return trim(getStringFromBytes(TAG_CITY, Charsets.UTF_8)); |
| 338 |
} |
| 339 |
|
| 340 |
@Nullable |
| 341 |
public String getLandmarkDescription() |
| 342 |
{ |
| 343 |
return trim(getStringFromBytes(TAG_LANDMARK, Charsets.UTF_8)); |
| 344 |
} |
| 345 |
|
| 346 |
@Nullable |
| 347 |
public String getTitleDescription() |
| 348 |
{ |
| 349 |
return trim(getStringFromBytes(TAG_TITLE, Charsets.UTF_8)); |
| 350 |
} |
| 351 |
|
| 352 |
@Nullable |
| 353 |
public String getBracketSettingsDescription() |
| 354 |
{ |
| 355 |
return getIndexedDescription(TAG_BRACKET_SETTINGS, |
| 356 |
"No Bracket", "3 Images, Sequence 0/-/+", "3 Images, Sequence -/0/+", "5 Images, Sequence 0/-/+", |
| 357 |
"5 Images, Sequence -/0/+", "7 Images, Sequence 0/-/+", "7 Images, Sequence -/0/+"); |
| 358 |
} |
| 359 |
|
| 360 |
@Nullable |
| 361 |
public String getFlashCurtainDescription() |
| 362 |
{ |
| 363 |
return getIndexedDescription(TAG_FLASH_CURTAIN, |
| 364 |
"n/a", "1st", "2nd"); |
| 365 |
} |
| 366 |
|
| 367 |
@Nullable |
| 368 |
public String getLongExposureNoiseReductionDescription() |
| 369 |
{ |
| 370 |
return getIndexedDescription(TAG_LONG_EXPOSURE_NOISE_REDUCTION, 1, |
| 371 |
"Off", "On"); |
| 372 |
} |
| 373 |
|
| 374 |
@Nullable |
| 375 |
public String getLensFirmwareVersionDescription() |
| 376 |
{ |
| 377 |
|
| 378 |
byte[] bytes = _directory.getByteArray(TAG_LENS_FIRMWARE_VERSION); |
| 379 |
if (bytes == null) |
| 380 |
return null; |
| 381 |
|
| 382 |
StringBuilder sb = new StringBuilder(); |
| 383 |
for (int i = 0; i < bytes.length; i++) { |
| 384 |
sb.append(bytes[i]); |
| 385 |
if (i < bytes.length - 1) |
| 386 |
sb.append("."); |
| 387 |
} |
| 388 |
return sb.toString(); |
| 389 |
|
| 390 |
} |
| 391 |
|
| 392 |
@Nullable |
| 393 |
public String getIntelligentDRangeDescription() |
| 394 |
{ |
| 395 |
return getIndexedDescription(TAG_INTELLIGENT_D_RANGE, |
| 396 |
"Off", "Low", "Standard", "High"); |
| 397 |
} |
| 398 |
|
| 399 |
@Nullable |
| 400 |
public String getClearRetouchDescription() |
| 401 |
{ |
| 402 |
return getIndexedDescription(TAG_CLEAR_RETOUCH, |
| 403 |
"Off", "On"); |
| 404 |
|
| 405 |
} |
| 406 |
|
| 407 |
@Nullable |
| 408 |
public String getPhotoStyleDescription() |
| 409 |
{ |
| 410 |
return getIndexedDescription(TAG_PHOTO_STYLE, |
| 411 |
"Auto", "Standard or Custom", "Vivid", "Natural", "Monochrome", "Scenery", "Portrait"); |
| 412 |
} |
| 413 |
|
| 414 |
@Nullable |
| 415 |
public String getShadingCompensationDescription() |
| 416 |
{ |
| 417 |
return getIndexedDescription(TAG_SHADING_COMPENSATION, |
| 418 |
"Off", "On"); |
| 419 |
} |
| 420 |
|
| 421 |
@Nullable |
| 422 |
public String getAccelerometerZDescription() |
| 423 |
{ |
| 424 |
Integer value = _directory.getInteger(TAG_ACCELEROMETER_Z); |
| 425 |
if (value == null) |
| 426 |
return null; |
| 427 |
|
| 428 |
|
| 429 |
return String.valueOf(value.shortValue()); |
| 430 |
} |
| 431 |
|
| 432 |
@Nullable |
| 433 |
public String getAccelerometerXDescription() |
| 434 |
{ |
| 435 |
Integer value = _directory.getInteger(TAG_ACCELEROMETER_X); |
| 436 |
if (value == null) |
| 437 |
return null; |
| 438 |
|
| 439 |
|
| 440 |
return String.valueOf(value.shortValue()); |
| 441 |
} |
| 442 |
|
| 443 |
@Nullable |
| 444 |
public String getAccelerometerYDescription() |
| 445 |
{ |
| 446 |
Integer value = _directory.getInteger(TAG_ACCELEROMETER_Y); |
| 447 |
if (value == null) |
| 448 |
return null; |
| 449 |
|
| 450 |
|
| 451 |
return String.valueOf(value.shortValue()); |
| 452 |
} |
| 453 |
|
| 454 |
@Nullable |
| 455 |
public String getCameraOrientationDescription() |
| 456 |
{ |
| 457 |
return getIndexedDescription(TAG_CAMERA_ORIENTATION, |
| 458 |
"Normal", "Rotate CW", "Rotate 180", "Rotate CCW", "Tilt Upwards", "Tile Downwards"); |
| 459 |
} |
| 460 |
|
| 461 |
@Nullable |
| 462 |
public String getRollAngleDescription() |
| 463 |
{ |
| 464 |
Integer value = _directory.getInteger(TAG_ROLL_ANGLE); |
| 465 |
if (value == null) |
| 466 |
return null; |
| 467 |
|
| 468 |
DecimalFormat format = new DecimalFormat("0.#"); |
| 469 |
|
| 470 |
return format.format(value.shortValue() / 10.0); |
| 471 |
} |
| 472 |
|
| 473 |
@Nullable |
| 474 |
public String getPitchAngleDescription() |
| 475 |
{ |
| 476 |
Integer value = _directory.getInteger(TAG_PITCH_ANGLE); |
| 477 |
if (value == null) |
| 478 |
return null; |
| 479 |
|
| 480 |
DecimalFormat format = new DecimalFormat("0.#"); |
| 481 |
|
| 482 |
return format.format(-value.shortValue() / 10.0); |
| 483 |
} |
| 484 |
|
| 485 |
@Nullable |
| 486 |
public String getSweepPanoramaDirectionDescription() |
| 487 |
{ |
| 488 |
return getIndexedDescription(TAG_SWEEP_PANORAMA_DIRECTION, |
| 489 |
"Off", "Left to Right", "Right to Left", "Top to Bottom", "Bottom to Top"); |
| 490 |
} |
| 491 |
|
| 492 |
@Nullable |
| 493 |
public String getTimerRecordingDescription() |
| 494 |
{ |
| 495 |
return getIndexedDescription(TAG_TIMER_RECORDING, |
| 496 |
"Off", "Time Lapse", "Stop-motion Animation"); |
| 497 |
} |
| 498 |
|
| 499 |
@Nullable |
| 500 |
public String getHDRDescription() |
| 501 |
{ |
| 502 |
Integer value = _directory.getInteger(TAG_HDR); |
| 503 |
if (value == null) |
| 504 |
return null; |
| 505 |
|
| 506 |
switch (value) |
| 507 |
{ |
| 508 |
case 0: |
| 509 |
return "Off"; |
| 510 |
case 100: |
| 511 |
return "1 EV"; |
| 512 |
case 200: |
| 513 |
return "2 EV"; |
| 514 |
case 300: |
| 515 |
return "3 EV"; |
| 516 |
case 32868: |
| 517 |
return "1 EV (Auto)"; |
| 518 |
case 32968: |
| 519 |
return "2 EV (Auto)"; |
| 520 |
case 33068: |
| 521 |
return "3 EV (Auto)"; |
| 522 |
default: |
| 523 |
return String.format("Unknown (%d)", value); |
| 524 |
} |
| 525 |
} |
| 526 |
|
| 527 |
@Nullable |
| 528 |
public String getShutterTypeDescription() |
| 529 |
{ |
| 530 |
return getIndexedDescription(TAG_SHUTTER_TYPE, |
| 531 |
"Mechanical", "Electronic", "Hybrid"); |
| 532 |
} |
| 533 |
|
| 534 |
@Nullable |
| 535 |
public String getTouchAeDescription() |
| 536 |
{ |
| 537 |
return getIndexedDescription(TAG_TOUCH_AE, |
| 538 |
"Off", "On"); |
| 539 |
} |
| 540 |
|
| 541 |
@Nullable |
| 542 |
public String getBabyNameDescription() |
| 543 |
{ |
| 544 |
return trim(getStringFromBytes(TAG_BABY_NAME, Charsets.UTF_8)); |
| 545 |
} |
| 546 |
|
| 547 |
@Nullable |
| 548 |
public String getLocationDescription() |
| 549 |
{ |
| 550 |
return trim(getStringFromBytes(TAG_LOCATION, Charsets.UTF_8)); |
| 551 |
} |
| 552 |
|
| 553 |
@Nullable |
| 554 |
public String getIntelligentResolutionDescription() |
| 555 |
{ |
| 556 |
return getIndexedDescription(TAG_INTELLIGENT_RESOLUTION, |
| 557 |
"Off", null, "Auto", "On"); |
| 558 |
} |
| 559 |
|
| 560 |
@Nullable |
| 561 |
public String getContrastDescription() |
| 562 |
{ |
| 563 |
return getIndexedDescription(TAG_CONTRAST, "Normal"); |
| 564 |
} |
| 565 |
|
| 566 |
@Nullable |
| 567 |
public String getWorldTimeLocationDescription() |
| 568 |
{ |
| 569 |
return getIndexedDescription(TAG_WORLD_TIME_LOCATION, |
| 570 |
1, "Home", "Destination"); |
| 571 |
} |
| 572 |
|
| 573 |
@Nullable |
| 574 |
public String getAdvancedSceneModeDescription() |
| 575 |
{ |
| 576 |
return getIndexedDescription(TAG_ADVANCED_SCENE_MODE, |
| 577 |
1, |
| 578 |
"Normal", |
| 579 |
"Outdoor/Illuminations/Flower/HDR Art", |
| 580 |
"Indoor/Architecture/Objects/HDR B&W", |
| 581 |
"Creative", |
| 582 |
"Auto", |
| 583 |
null, |
| 584 |
"Expressive", |
| 585 |
"Retro", |
| 586 |
"Pure", |
| 587 |
"Elegant", |
| 588 |
null, |
| 589 |
"Monochrome", |
| 590 |
"Dynamic Art", |
| 591 |
"Silhouette" |
| 592 |
); |
| 593 |
} |
| 594 |
|
| 595 |
@Nullable |
| 596 |
public String getUnknownDataDumpDescription() |
| 597 |
{ |
| 598 |
return getByteLengthDescription(TAG_UNKNOWN_DATA_DUMP); |
| 599 |
} |
| 600 |
|
| 601 |
@Nullable |
| 602 |
public String getColorEffectDescription() |
| 603 |
{ |
| 604 |
return getIndexedDescription(TAG_COLOR_EFFECT, |
| 605 |
1, "Off", "Warm", "Cool", "Black & White", "Sepia" |
| 606 |
); |
| 607 |
} |
| 608 |
|
| 609 |
@Nullable |
| 610 |
public String getUptimeDescription() |
| 611 |
{ |
| 612 |
Integer value = _directory.getInteger(TAG_UPTIME); |
| 613 |
if (value == null) |
| 614 |
return null; |
| 615 |
return value / 100f + " s"; |
| 616 |
} |
| 617 |
|
| 618 |
@Nullable |
| 619 |
public String getBurstModeDescription() |
| 620 |
{ |
| 621 |
return getIndexedDescription(TAG_BURST_MODE, |
| 622 |
"Off", null, "On", "Indefinite", "Unlimited" |
| 623 |
); |
| 624 |
} |
| 625 |
|
| 626 |
@Nullable |
| 627 |
public String getContrastModeDescription() |
| 628 |
{ |
| 629 |
Integer value = _directory.getInteger(TAG_CONTRAST_MODE); |
| 630 |
if (value == null) |
| 631 |
return null; |
| 632 |
switch (value) { |
| 633 |
case 0x0: return "Normal"; |
| 634 |
case 0x1: return "Low"; |
| 635 |
case 0x2: return "High"; |
| 636 |
case 0x6: return "Medium Low"; |
| 637 |
case 0x7: return "Medium High"; |
| 638 |
case 0x100: return "Low"; |
| 639 |
case 0x110: return "Normal"; |
| 640 |
case 0x120: return "High"; |
| 641 |
default: |
| 642 |
return "Unknown (" + value + ")"; |
| 643 |
} |
| 644 |
} |
| 645 |
|
| 646 |
@Nullable |
| 647 |
public String getNoiseReductionDescription() |
| 648 |
{ |
| 649 |
return getIndexedDescription(TAG_NOISE_REDUCTION, |
| 650 |
"Standard (0)", "Low (-1)", "High (+1)", "Lowest (-2)", "Highest (+2)" |
| 651 |
); |
| 652 |
} |
| 653 |
|
| 654 |
@Nullable |
| 655 |
public String getSelfTimerDescription() |
| 656 |
{ |
| 657 |
return getIndexedDescription(TAG_SELF_TIMER, |
| 658 |
1, "Off", "10 s", "2 s" |
| 659 |
); |
| 660 |
} |
| 661 |
|
| 662 |
@Nullable |
| 663 |
public String getRotationDescription() |
| 664 |
{ |
| 665 |
Integer value = _directory.getInteger(TAG_ROTATION); |
| 666 |
if (value == null) |
| 667 |
return null; |
| 668 |
switch (value) { |
| 669 |
case 1: return "Horizontal"; |
| 670 |
case 3: return "Rotate 180"; |
| 671 |
case 6: return "Rotate 90 CW"; |
| 672 |
case 8: return "Rotate 270 CW"; |
| 673 |
default: |
| 674 |
return "Unknown (" + value + ")"; |
| 675 |
} |
| 676 |
} |
| 677 |
|
| 678 |
@Nullable |
| 679 |
public String getAfAssistLampDescription() |
| 680 |
{ |
| 681 |
return getIndexedDescription(TAG_AF_ASSIST_LAMP, |
| 682 |
1, "Fired", "Enabled but not used", "Disabled but required", "Disabled and not required" |
| 683 |
); |
| 684 |
} |
| 685 |
|
| 686 |
@Nullable |
| 687 |
public String getColorModeDescription() |
| 688 |
{ |
| 689 |
return getIndexedDescription(TAG_COLOR_MODE, |
| 690 |
"Normal", "Natural", "Vivid" |
| 691 |
); |
| 692 |
} |
| 693 |
|
| 694 |
@Nullable |
| 695 |
public String getOpticalZoomModeDescription() |
| 696 |
{ |
| 697 |
return getIndexedDescription(TAG_OPTICAL_ZOOM_MODE, |
| 698 |
1, "Standard", "Extended" |
| 699 |
); |
| 700 |
} |
| 701 |
|
| 702 |
@Nullable |
| 703 |
public String getConversionLensDescription() |
| 704 |
{ |
| 705 |
return getIndexedDescription(TAG_CONVERSION_LENS, |
| 706 |
1, "Off", "Wide", "Telephoto", "Macro" |
| 707 |
); |
| 708 |
} |
| 709 |
|
| 710 |
@Nullable |
| 711 |
public String getDetectedFacesDescription() |
| 712 |
{ |
| 713 |
return buildFacesDescription(_directory.getDetectedFaces()); |
| 714 |
} |
| 715 |
|
| 716 |
@Nullable |
| 717 |
public String getRecognizedFacesDescription() |
| 718 |
{ |
| 719 |
return buildFacesDescription(_directory.getRecognizedFaces()); |
| 720 |
} |
| 721 |
|
| 722 |
@Nullable |
| 723 |
private String buildFacesDescription(@Nullable Face[] faces) |
| 724 |
{ |
| 725 |
if (faces == null) |
| 726 |
return null; |
| 727 |
|
| 728 |
StringBuilder result = new StringBuilder(); |
| 729 |
|
| 730 |
for (int i = 0; i < faces.length; i++) |
| 731 |
result.append("Face ").append(i + 1).append(": ").append(faces[i].toString()).append("\n"); |
| 732 |
|
| 733 |
return result.length() > 0 ? result.substring(0, result.length() - 1) : null; |
| 734 |
|
| 735 |
} |
| 736 |
|
| 737 |
private static final String[] _sceneModes = new String[] { |
| 738 |
"Normal", |
| 739 |
"Portrait", |
| 740 |
"Scenery", |
| 741 |
"Sports", |
| 742 |
"Night Portrait", |
| 743 |
"Program", |
| 744 |
"Aperture Priority", |
| 745 |
"Shutter Priority", |
| 746 |
"Macro", |
| 747 |
"Spot", |
| 748 |
"Manual", |
| 749 |
"Movie Preview", |
| 750 |
"Panning", |
| 751 |
"Simple", |
| 752 |
"Color Effects", |
| 753 |
"Self Portrait", |
| 754 |
"Economy", |
| 755 |
"Fireworks", |
| 756 |
"Party", |
| 757 |
"Snow", |
| 758 |
"Night Scenery", |
| 759 |
"Food", |
| 760 |
"Baby", |
| 761 |
"Soft Skin", |
| 762 |
"Candlelight", |
| 763 |
"Starry Night", |
| 764 |
"High Sensitivity", |
| 765 |
"Panorama Assist", |
| 766 |
"Underwater", |
| 767 |
"Beach", |
| 768 |
"Aerial Photo", |
| 769 |
"Sunset", |
| 770 |
"Pet", |
| 771 |
"Intelligent ISO", |
| 772 |
"Clipboard", |
| 773 |
"High Speed Continuous Shooting", |
| 774 |
"Intelligent Auto", |
| 775 |
null, |
| 776 |
"Multi-aspect", |
| 777 |
null, |
| 778 |
"Transform", |
| 779 |
"Flash Burst", |
| 780 |
"Pin Hole", |
| 781 |
"Film Grain", |
| 782 |
"My Color", |
| 783 |
"Photo Frame", |
| 784 |
null, |
| 785 |
null, |
| 786 |
null, |
| 787 |
null, |
| 788 |
"HDR" |
| 789 |
}; |
| 790 |
|
| 791 |
@Nullable |
| 792 |
public String getRecordModeDescription() |
| 793 |
{ |
| 794 |
return getIndexedDescription(TAG_RECORD_MODE, 1, _sceneModes); |
| 795 |
} |
| 796 |
|
| 797 |
@Nullable |
| 798 |
public String getSceneModeDescription() |
| 799 |
{ |
| 800 |
return getIndexedDescription(TAG_SCENE_MODE, 1, _sceneModes); |
| 801 |
} |
| 802 |
|
| 803 |
@Nullable |
| 804 |
public String getFocusModeDescription() |
| 805 |
{ |
| 806 |
return getIndexedDescription(TAG_FOCUS_MODE, 1, |
| 807 |
"Auto", "Manual", null, "Auto, Focus Button", "Auto, Continuous"); |
| 808 |
} |
| 809 |
|
| 810 |
@Nullable |
| 811 |
public String getAfAreaModeDescription() |
| 812 |
{ |
| 813 |
int[] value = _directory.getIntArray(TAG_AF_AREA_MODE); |
| 814 |
if (value == null || value.length < 2) |
| 815 |
return null; |
| 816 |
switch (value[0]) { |
| 817 |
case 0: |
| 818 |
switch (value[1]) { |
| 819 |
case 1: return "Spot Mode On"; |
| 820 |
case 16: return "Spot Mode Off"; |
| 821 |
default: return "Unknown (" + value[0] + " " + value[1] + ")"; |
| 822 |
} |
| 823 |
case 1: |
| 824 |
switch (value[1]) { |
| 825 |
case 0: return "Spot Focusing"; |
| 826 |
case 1: return "5-area"; |
| 827 |
default: return "Unknown (" + value[0] + " " + value[1] + ")"; |
| 828 |
} |
| 829 |
case 16: |
| 830 |
switch (value[1]) { |
| 831 |
case 0: return "1-area"; |
| 832 |
case 16: return "1-area (high speed)"; |
| 833 |
default: return "Unknown (" + value[0] + " " + value[1] + ")"; |
| 834 |
} |
| 835 |
case 32: |
| 836 |
switch (value[1]) { |
| 837 |
case 0: return "Auto or Face Detect"; |
| 838 |
case 1: return "3-area (left)"; |
| 839 |
case 2: return "3-area (center)"; |
| 840 |
case 3: return "3-area (right)"; |
| 841 |
default: return "Unknown (" + value[0] + " " + value[1] + ")"; |
| 842 |
} |
| 843 |
case 64: return "Face Detect"; |
| 844 |
default: return "Unknown (" + value[0] + " " + value[1] + ")"; |
| 845 |
} |
| 846 |
} |
| 847 |
|
| 848 |
@Nullable |
| 849 |
public String getQualityModeDescription() |
| 850 |
{ |
| 851 |
return getIndexedDescription(TAG_QUALITY_MODE, |
| 852 |
2, |
| 853 |
"High", |
| 854 |
"Normal", |
| 855 |
null, |
| 856 |
null, |
| 857 |
"Very High", |
| 858 |
"Raw", |
| 859 |
null, |
| 860 |
"Motion Picture" |
| 861 |
); |
| 862 |
} |
| 863 |
|
| 864 |
@Nullable |
| 865 |
public String getVersionDescription() |
| 866 |
{ |
| 867 |
return getVersionBytesDescription(TAG_FIRMWARE_VERSION, 2); |
| 868 |
} |
| 869 |
|
| 870 |
@Nullable |
| 871 |
public String getMakernoteVersionDescription() |
| 872 |
{ |
| 873 |
return getVersionBytesDescription(TAG_MAKERNOTE_VERSION, 2); |
| 874 |
} |
| 875 |
|
| 876 |
@Nullable |
| 877 |
public String getExifVersionDescription() |
| 878 |
{ |
| 879 |
return getVersionBytesDescription(TAG_EXIF_VERSION, 2); |
| 880 |
} |
| 881 |
|
| 882 |
@Nullable |
| 883 |
public String getInternalSerialNumberDescription() |
| 884 |
{ |
| 885 |
return get7BitStringFromBytes(TAG_INTERNAL_SERIAL_NUMBER); |
| 886 |
} |
| 887 |
|
| 888 |
@Nullable |
| 889 |
public String getWhiteBalanceDescription() |
| 890 |
{ |
| 891 |
return getIndexedDescription(TAG_WHITE_BALANCE, |
| 892 |
1, |
| 893 |
"Auto", |
| 894 |
"Daylight", |
| 895 |
"Cloudy", |
| 896 |
"Incandescent", |
| 897 |
"Manual", |
| 898 |
null, |
| 899 |
null, |
| 900 |
"Flash", |
| 901 |
null, |
| 902 |
"Black & White", |
| 903 |
"Manual", |
| 904 |
"Shade" |
| 905 |
); |
| 906 |
} |
| 907 |
|
| 908 |
@Nullable |
| 909 |
public String getBabyAgeDescription() |
| 910 |
{ |
| 911 |
final Age age = _directory.getAge(TAG_BABY_AGE); |
| 912 |
return age == null ? null : age.toFriendlyString(); |
| 913 |
} |
| 914 |
|
| 915 |
@Nullable |
| 916 |
public String getBabyAge1Description() |
| 917 |
{ |
| 918 |
final Age age = _directory.getAge(TAG_BABY_AGE_1); |
| 919 |
return age == null ? null : age.toFriendlyString(); |
| 920 |
} |
| 921 |
} |