source: josm/trunk/src/com/drew/metadata/exif/CanonMakernoteDescriptor.java@ 6830

Last change on this file since 6830 was 6127, checked in by bastiK, 13 years ago

applied #8895 - Upgrade metadata-extractor to v. 2.6.4 (patch by ebourg)

File size: 28.4 KB
RevLine 
[4231]1/*
[6127]2 * Copyright 2002-2012 Drew Noakes
[4231]3 *
[6127]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
[4231]7 *
[6127]8 * http://www.apache.org/licenses/LICENSE-2.0
[4231]9 *
[6127]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/
[4231]20 */
21package com.drew.metadata.exif;
22
[6127]23import com.drew.lang.annotations.NotNull;
24import com.drew.lang.annotations.Nullable;
[4231]25import com.drew.metadata.TagDescriptor;
26
27/**
[6127]28 * Provides human-readable string representations of tag values stored in a <code>CanonMakernoteDirectory</code>.
[4231]29 *
[6127]30 * @author Drew Noakes http://drewnoakes.com
[4231]31 */
[6127]32public class CanonMakernoteDescriptor extends TagDescriptor<CanonMakernoteDirectory>
[4231]33{
[6127]34 public CanonMakernoteDescriptor(@NotNull CanonMakernoteDirectory directory)
[4231]35 {
36 super(directory);
37 }
38
[6127]39 @Nullable
40 public String getDescription(int tagType)
[4231]41 {
42 switch (tagType) {
[6127]43 case CanonMakernoteDirectory.TAG_CANON_SERIAL_NUMBER:
44 return getSerialNumberDescription();
45 case CanonMakernoteDirectory.CameraSettings.TAG_FLASH_ACTIVITY:
[4231]46 return getFlashActivityDescription();
[6127]47 case CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_TYPE:
[4231]48 return getFocusTypeDescription();
[6127]49 case CanonMakernoteDirectory.CameraSettings.TAG_DIGITAL_ZOOM:
[4231]50 return getDigitalZoomDescription();
[6127]51 case CanonMakernoteDirectory.CameraSettings.TAG_QUALITY:
[4231]52 return getQualityDescription();
[6127]53 case CanonMakernoteDirectory.CameraSettings.TAG_MACRO_MODE:
[4231]54 return getMacroModeDescription();
[6127]55 case CanonMakernoteDirectory.CameraSettings.TAG_SELF_TIMER_DELAY:
[4231]56 return getSelfTimerDelayDescription();
[6127]57 case CanonMakernoteDirectory.CameraSettings.TAG_FLASH_MODE:
[4231]58 return getFlashModeDescription();
[6127]59 case CanonMakernoteDirectory.CameraSettings.TAG_CONTINUOUS_DRIVE_MODE:
[4231]60 return getContinuousDriveModeDescription();
[6127]61 case CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_1:
[4231]62 return getFocusMode1Description();
[6127]63 case CanonMakernoteDirectory.CameraSettings.TAG_IMAGE_SIZE:
[4231]64 return getImageSizeDescription();
[6127]65 case CanonMakernoteDirectory.CameraSettings.TAG_EASY_SHOOTING_MODE:
[4231]66 return getEasyShootingModeDescription();
[6127]67 case CanonMakernoteDirectory.CameraSettings.TAG_CONTRAST:
[4231]68 return getContrastDescription();
[6127]69 case CanonMakernoteDirectory.CameraSettings.TAG_SATURATION:
[4231]70 return getSaturationDescription();
[6127]71 case CanonMakernoteDirectory.CameraSettings.TAG_SHARPNESS:
[4231]72 return getSharpnessDescription();
[6127]73 case CanonMakernoteDirectory.CameraSettings.TAG_ISO:
[4231]74 return getIsoDescription();
[6127]75 case CanonMakernoteDirectory.CameraSettings.TAG_METERING_MODE:
[4231]76 return getMeteringModeDescription();
[6127]77 case CanonMakernoteDirectory.CameraSettings.TAG_AF_POINT_SELECTED:
[4231]78 return getAfPointSelectedDescription();
[6127]79 case CanonMakernoteDirectory.CameraSettings.TAG_EXPOSURE_MODE:
[4231]80 return getExposureModeDescription();
[6127]81 case CanonMakernoteDirectory.CameraSettings.TAG_LONG_FOCAL_LENGTH:
[4231]82 return getLongFocalLengthDescription();
[6127]83 case CanonMakernoteDirectory.CameraSettings.TAG_SHORT_FOCAL_LENGTH:
[4231]84 return getShortFocalLengthDescription();
[6127]85 case CanonMakernoteDirectory.CameraSettings.TAG_FOCAL_UNITS_PER_MM:
[4231]86 return getFocalUnitsPerMillimetreDescription();
[6127]87 case CanonMakernoteDirectory.CameraSettings.TAG_FLASH_DETAILS:
[4231]88 return getFlashDetailsDescription();
[6127]89 case CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_2:
[4231]90 return getFocusMode2Description();
[6127]91 case CanonMakernoteDirectory.FocalLength.TAG_WHITE_BALANCE:
[4231]92 return getWhiteBalanceDescription();
[6127]93 case CanonMakernoteDirectory.FocalLength.TAG_AF_POINT_USED:
[4231]94 return getAfPointUsedDescription();
[6127]95 case CanonMakernoteDirectory.FocalLength.TAG_FLASH_BIAS:
[4231]96 return getFlashBiasDescription();
[6127]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();
[4231]127 default:
[6127]128 return super.getDescription(tagType);
[4231]129 }
130 }
131
[6127]132 @Nullable
133 public String getSerialNumberDescription()
[4231]134 {
[6127]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;
[4231]148 switch (value) {
149 case 0: return "Off";
150 case 1: return "On";
151 default: return "Unknown (" + value + ")";
152 }
153 }
[6127]154
155 @Nullable
156 public String getShutterAutoExposureLockButtonDescription()
[4231]157 {
[6127]158 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_AUTO_EXPOSURE_LOCK_BUTTONS);
159 if (value==null)
160 return null;
[4231]161 switch (value) {
162 case 0: return "AF/AE lock";
163 case 1: return "AE lock/AF";
164 case 2: return "AF/AF lock";
165 case 3: return "AE+release/AE+AF";
166 default: return "Unknown (" + value + ")";
167 }
168 }
[6127]169
170 @Nullable
171 public String getMirrorLockupDescription()
[4231]172 {
[6127]173 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MIRROR_LOCKUP);
174 if (value==null)
175 return null;
[4231]176 switch (value) {
177 case 0: return "Disabled";
178 case 1: return "Enabled";
179 default: return "Unknown (" + value + ")";
180 }
181 }
[6127]182
183 @Nullable
184 public String getTvAndAvExposureLevelDescription()
[4231]185 {
[6127]186 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_TV_AV_AND_EXPOSURE_LEVEL);
187 if (value==null)
188 return null;
[4231]189 switch (value) {
190 case 0: return "1/2 stop";
191 case 1: return "1/3 stop";
192 default: return "Unknown (" + value + ")";
193 }
194 }
[6127]195
196 @Nullable
197 public String getAutoFocusAssistLightDescription()
[4231]198 {
[6127]199 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_ASSIST_LIGHT);
200 if (value==null)
201 return null;
[4231]202 switch (value) {
203 case 0: return "On (Auto)";
204 case 1: return "Off";
205 default: return "Unknown (" + value + ")";
206 }
207 }
[6127]208
209 @Nullable
210 public String getShutterSpeedInAvModeDescription()
[4231]211 {
[6127]212 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_SPEED_IN_AV_MODE);
213 if (value==null)
214 return null;
[4231]215 switch (value) {
216 case 0: return "Automatic";
217 case 1: return "1/200 (fixed)";
218 default: return "Unknown (" + value + ")";
219 }
220 }
[6127]221
222 @Nullable
223 public String getAutoExposureBrackettingSequenceAndAutoCancellationDescription()
[4231]224 {
[6127]225 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_BRACKETTING);
226 if (value==null)
227 return null;
[4231]228 switch (value) {
229 case 0: return "0,-,+ / Enabled";
230 case 1: return "0,-,+ / Disabled";
231 case 2: return "-,0,+ / Enabled";
232 case 3: return "-,0,+ / Disabled";
233 default: return "Unknown (" + value + ")";
234 }
235 }
[6127]236
237 @Nullable
238 public String getShutterCurtainSyncDescription()
[4231]239 {
[6127]240 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SHUTTER_CURTAIN_SYNC);
241 if (value==null)
242 return null;
[4231]243 switch (value) {
244 case 0: return "1st Curtain Sync";
245 case 1: return "2nd Curtain Sync";
246 default: return "Unknown (" + value + ")";
247 }
248 }
[6127]249
250 @Nullable
251 public String getLensAutoFocusStopButtonDescription()
[4231]252 {
[6127]253 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_AF_STOP);
254 if (value==null)
255 return null;
[4231]256 switch (value) {
257 case 0: return "AF stop";
258 case 1: return "Operate AF";
259 case 2: return "Lock AE and start timer";
260 default: return "Unknown (" + value + ")";
261 }
262 }
[6127]263
264 @Nullable
265 public String getFillFlashReductionDescription()
[4231]266 {
[6127]267 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_FILL_FLASH_REDUCTION);
268 if (value==null)
269 return null;
[4231]270 switch (value) {
271 case 0: return "Enabled";
272 case 1: return "Disabled";
273 default: return "Unknown (" + value + ")";
274 }
275 }
[6127]276
277 @Nullable
278 public String getMenuButtonReturnPositionDescription()
[4231]279 {
[6127]280 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_MENU_BUTTON_RETURN);
281 if (value==null)
282 return null;
[4231]283 switch (value) {
284 case 0: return "Top";
285 case 1: return "Previous (volatile)";
286 case 2: return "Previous";
287 default: return "Unknown (" + value + ")";
288 }
289 }
[6127]290
291 @Nullable
292 public String getSetButtonFunctionWhenShootingDescription()
[4231]293 {
[6127]294 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SET_BUTTON_FUNCTION);
295 if (value==null)
296 return null;
[4231]297 switch (value) {
298 case 0: return "Not Assigned";
299 case 1: return "Change Quality";
300 case 2: return "Change ISO Speed";
301 case 3: return "Select Parameters";
302 default: return "Unknown (" + value + ")";
303 }
304 }
[6127]305
306 @Nullable
307 public String getSensorCleaningDescription()
[4231]308 {
[6127]309 Integer value = _directory.getInteger(CanonMakernoteDirectory.TAG_CANON_CUSTOM_FUNCTION_SENSOR_CLEANING);
310 if (value==null)
311 return null;
[4231]312 switch (value) {
313 case 0: return "Disabled";
314 case 1: return "Enabled";
315 default: return "Unknown (" + value + ")";
316 }
317 }
[6127]318*/
[4231]319
[6127]320 @Nullable
321 public String getFlashBiasDescription()
[4231]322 {
[6127]323 Integer value = _directory.getInteger(CanonMakernoteDirectory.FocalLength.TAG_FLASH_BIAS);
[4231]324
[6127]325 if (value==null)
326 return null;
[4231]327
328 boolean isNegative = false;
329 if (value > 0xF000)
330 {
331 isNegative = true;
332 value = 0xFFFF - value;
333 value++;
334 }
335
336 // this tag is interesting in that the values returned are:
337 // 0, 0.375, 0.5, 0.626, 1
338 // not
339 // 0, 0.33, 0.5, 0.66, 1
340
341 return ((isNegative) ? "-" : "") + Float.toString(value / 32f) + " EV";
342 }
343
[6127]344 @Nullable
345 public String getAfPointUsedDescription()
[4231]346 {
[6127]347 Integer value = _directory.getInteger(CanonMakernoteDirectory.FocalLength.TAG_AF_POINT_USED);
348 if (value==null)
349 return null;
[4231]350 if ((value & 0x7) == 0) {
351 return "Right";
352 } else if ((value & 0x7) == 1) {
353 return "Centre";
354 } else if ((value & 0x7) == 2) {
355 return "Left";
356 } else {
357 return "Unknown (" + value + ")";
358 }
359 }
360
[6127]361 @Nullable
362 public String getWhiteBalanceDescription()
[4231]363 {
[6127]364 Integer value = _directory.getInteger(CanonMakernoteDirectory.FocalLength.TAG_WHITE_BALANCE);
365 if (value==null)
366 return null;
[4231]367 switch (value) {
368 case 0:
369 return "Auto";
370 case 1:
371 return "Sunny";
372 case 2:
373 return "Cloudy";
374 case 3:
375 return "Tungsten";
376 case 4:
[6127]377 return "Florescent";
[4231]378 case 5:
379 return "Flash";
380 case 6:
381 return "Custom";
382 default:
383 return "Unknown (" + value + ")";
384 }
385 }
386
[6127]387 @Nullable
388 public String getFocusMode2Description()
[4231]389 {
[6127]390 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_2);
391 if (value==null)
392 return null;
[4231]393 switch (value) {
394 case 0:
395 return "Single";
396 case 1:
397 return "Continuous";
398 default:
399 return "Unknown (" + value + ")";
400 }
401 }
402
[6127]403 @Nullable
404 public String getFlashDetailsDescription()
[4231]405 {
[6127]406 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_DETAILS);
407 if (value==null)
408 return null;
409 if (((value >> 14) & 1) > 0) {
[4231]410 return "External E-TTL";
411 }
[6127]412 if (((value >> 13) & 1) > 0) {
[4231]413 return "Internal flash";
414 }
[6127]415 if (((value >> 11) & 1) > 0) {
[4231]416 return "FP sync used";
417 }
[6127]418 if (((value >> 4) & 1) > 0) {
[4231]419 return "FP sync enabled";
420 }
421 return "Unknown (" + value + ")";
422 }
423
[6127]424 @Nullable
425 public String getFocalUnitsPerMillimetreDescription()
[4231]426 {
[6127]427 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCAL_UNITS_PER_MM);
428 if (value==null)
429 return null;
[4231]430 if (value != 0) {
431 return Integer.toString(value);
432 } else {
433 return "";
434 }
435 }
436
[6127]437 @Nullable
438 public String getShortFocalLengthDescription()
[4231]439 {
[6127]440 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SHORT_FOCAL_LENGTH);
441 if (value==null)
442 return null;
[4231]443 String units = getFocalUnitsPerMillimetreDescription();
444 return Integer.toString(value) + " " + units;
445 }
446
[6127]447 @Nullable
448 public String getLongFocalLengthDescription()
[4231]449 {
[6127]450 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_LONG_FOCAL_LENGTH);
451 if (value==null)
452 return null;
[4231]453 String units = getFocalUnitsPerMillimetreDescription();
454 return Integer.toString(value) + " " + units;
455 }
456
[6127]457 @Nullable
458 public String getExposureModeDescription()
[4231]459 {
[6127]460 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_EXPOSURE_MODE);
461 if (value==null)
462 return null;
[4231]463 switch (value) {
464 case 0:
465 return "Easy shooting";
466 case 1:
467 return "Program";
468 case 2:
469 return "Tv-priority";
470 case 3:
471 return "Av-priority";
472 case 4:
473 return "Manual";
474 case 5:
475 return "A-DEP";
476 default:
477 return "Unknown (" + value + ")";
478 }
479 }
480
[6127]481 @Nullable
482 public String getAfPointSelectedDescription()
[4231]483 {
[6127]484 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_AF_POINT_SELECTED);
485 if (value==null)
486 return null;
[4231]487 switch (value) {
488 case 0x3000:
489 return "None (MF)";
490 case 0x3001:
491 return "Auto selected";
492 case 0x3002:
493 return "Right";
494 case 0x3003:
495 return "Centre";
496 case 0x3004:
497 return "Left";
498 default:
499 return "Unknown (" + value + ")";
500 }
501 }
502
[6127]503 @Nullable
504 public String getMeteringModeDescription()
[4231]505 {
[6127]506 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_METERING_MODE);
507 if (value==null)
508 return null;
[4231]509 switch (value) {
510 case 3:
511 return "Evaluative";
512 case 4:
513 return "Partial";
514 case 5:
515 return "Centre weighted";
516 default:
517 return "Unknown (" + value + ")";
518 }
519 }
520
[6127]521 @Nullable
522 public String getIsoDescription()
[4231]523 {
[6127]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
[4231]533 switch (value) {
534 case 0:
535 return "Not specified (see ISOSpeedRatings tag)";
536 case 15:
537 return "Auto";
538 case 16:
539 return "50";
540 case 17:
541 return "100";
542 case 18:
543 return "200";
544 case 19:
545 return "400";
546 default:
547 return "Unknown (" + value + ")";
548 }
549 }
550
[6127]551 @Nullable
552 public String getSharpnessDescription()
[4231]553 {
[6127]554 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SHARPNESS);
555 if (value==null)
556 return null;
[4231]557 switch (value) {
558 case 0xFFFF:
559 return "Low";
560 case 0x000:
561 return "Normal";
562 case 0x001:
563 return "High";
564 default:
565 return "Unknown (" + value + ")";
566 }
567 }
568
[6127]569 @Nullable
570 public String getSaturationDescription()
[4231]571 {
[6127]572 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SATURATION);
573 if (value==null)
574 return null;
[4231]575 switch (value) {
576 case 0xFFFF:
577 return "Low";
578 case 0x000:
579 return "Normal";
580 case 0x001:
581 return "High";
582 default:
583 return "Unknown (" + value + ")";
584 }
585 }
586
[6127]587 @Nullable
588 public String getContrastDescription()
[4231]589 {
[6127]590 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_CONTRAST);
591 if (value==null)
592 return null;
[4231]593 switch (value) {
594 case 0xFFFF:
595 return "Low";
596 case 0x000:
597 return "Normal";
598 case 0x001:
599 return "High";
600 default:
601 return "Unknown (" + value + ")";
602 }
603 }
604
[6127]605 @Nullable
606 public String getEasyShootingModeDescription()
[4231]607 {
[6127]608 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_EASY_SHOOTING_MODE);
609 if (value==null)
610 return null;
[4231]611 switch (value) {
612 case 0:
613 return "Full auto";
614 case 1:
615 return "Manual";
616 case 2:
617 return "Landscape";
618 case 3:
619 return "Fast shutter";
620 case 4:
621 return "Slow shutter";
622 case 5:
623 return "Night";
624 case 6:
625 return "B&W";
626 case 7:
627 return "Sepia";
628 case 8:
629 return "Portrait";
630 case 9:
631 return "Sports";
632 case 10:
633 return "Macro / Closeup";
634 case 11:
635 return "Pan focus";
636 default:
637 return "Unknown (" + value + ")";
638 }
639 }
640
[6127]641 @Nullable
642 public String getImageSizeDescription()
[4231]643 {
[6127]644 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_IMAGE_SIZE);
645 if (value==null)
646 return null;
[4231]647 switch (value) {
648 case 0:
649 return "Large";
650 case 1:
651 return "Medium";
652 case 2:
653 return "Small";
654 default:
655 return "Unknown (" + value + ")";
656 }
657 }
658
[6127]659 @Nullable
660 public String getFocusMode1Description()
[4231]661 {
[6127]662 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_MODE_1);
663 if (value==null)
664 return null;
[4231]665 switch (value) {
666 case 0:
667 return "One-shot";
668 case 1:
669 return "AI Servo";
670 case 2:
671 return "AI Focus";
672 case 3:
673 return "Manual Focus";
674 case 4:
675 // TODO should check field 32 here (FOCUS_MODE_2)
676 return "Single";
677 case 5:
678 return "Continuous";
679 case 6:
680 return "Manual Focus";
681 default:
682 return "Unknown (" + value + ")";
683 }
684 }
685
[6127]686 @Nullable
687 public String getContinuousDriveModeDescription()
[4231]688 {
[6127]689 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_CONTINUOUS_DRIVE_MODE);
690 if (value==null)
691 return null;
[4231]692 switch (value) {
693 case 0:
[6127]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";
[4231]697 case 1:
698 return "Continuous";
699 }
[6127]700 return "Unknown (" + value + ")";
[4231]701 }
702
[6127]703 @Nullable
704 public String getFlashModeDescription()
[4231]705 {
[6127]706 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_MODE);
707 if (value==null)
708 return null;
[4231]709 switch (value) {
710 case 0:
711 return "No flash fired";
712 case 1:
713 return "Auto";
714 case 2:
715 return "On";
716 case 3:
717 return "Red-eye reduction";
718 case 4:
719 return "Slow-synchro";
720 case 5:
721 return "Auto and red-eye reduction";
722 case 6:
723 return "On and red-eye reduction";
724 case 16:
725 // note: this value not set on Canon D30
[6127]726 return "External flash";
[4231]727 default:
728 return "Unknown (" + value + ")";
729 }
730 }
731
[6127]732 @Nullable
733 public String getSelfTimerDelayDescription()
[4231]734 {
[6127]735 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_SELF_TIMER_DELAY);
736 if (value==null)
737 return null;
[4231]738 if (value == 0) {
739 return "Self timer not used";
740 } else {
741 // TODO find an image that tests this calculation
742 return Double.toString((double)value * 0.1d) + " sec";
743 }
744 }
745
[6127]746 @Nullable
747 public String getMacroModeDescription()
[4231]748 {
[6127]749 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_MACRO_MODE);
750 if (value==null)
751 return null;
[4231]752 switch (value) {
753 case 1:
754 return "Macro";
755 case 2:
756 return "Normal";
757 default:
758 return "Unknown (" + value + ")";
759 }
760 }
761
[6127]762 @Nullable
763 public String getQualityDescription()
[4231]764 {
[6127]765 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_QUALITY);
766 if (value==null)
767 return null;
[4231]768 switch (value) {
769 case 2:
770 return "Normal";
771 case 3:
772 return "Fine";
773 case 5:
774 return "Superfine";
775 default:
776 return "Unknown (" + value + ")";
777 }
778 }
779
[6127]780 @Nullable
781 public String getDigitalZoomDescription()
[4231]782 {
[6127]783 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_DIGITAL_ZOOM);
784 if (value==null)
785 return null;
[4231]786 switch (value) {
787 case 0:
788 return "No digital zoom";
789 case 1:
790 return "2x";
791 case 2:
792 return "4x";
793 default:
794 return "Unknown (" + value + ")";
795 }
796 }
797
[6127]798 @Nullable
799 public String getFocusTypeDescription()
[4231]800 {
[6127]801 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FOCUS_TYPE);
802 if (value==null)
803 return null;
[4231]804 switch (value) {
805 case 0:
806 return "Manual";
807 case 1:
808 return "Auto";
809 case 3:
810 return "Close-up (Macro)";
811 case 8:
812 return "Locked (Pan Mode)";
813 default:
814 return "Unknown (" + value + ")";
815 }
816 }
817
[6127]818 @Nullable
819 public String getFlashActivityDescription()
[4231]820 {
[6127]821 Integer value = _directory.getInteger(CanonMakernoteDirectory.CameraSettings.TAG_FLASH_ACTIVITY);
822 if (value==null)
823 return null;
[4231]824 switch (value) {
825 case 0:
826 return "Flash did not fire";
827 case 1:
828 return "Flash fired";
829 default:
830 return "Unknown (" + value + ")";
831 }
832 }
833}
Note: See TracBrowser for help on using the repository browser.