Changeset 10862 in josm for trunk/src/com/drew/metadata/exif/makernotes
- Timestamp:
- 2016-08-20T20:58:03+02:00 (9 years ago)
- Location:
- trunk/src/com/drew/metadata/exif/makernotes
- Files:
-
- 4 added
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/exif/makernotes/CanonMakernoteDescriptor.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 24 24 import com.drew.lang.annotations.Nullable; 25 25 import com.drew.metadata.TagDescriptor; 26 27 import java.text.DecimalFormat; 26 28 27 29 import static com.drew.metadata.exif.makernotes.CanonMakernoteDirectory.*; … … 138 140 public String getSerialNumberDescription() 139 141 { 142 // http://www.ozhiker.com/electronics/pjmt/jpeg_info/canon_mn.html 140 143 Integer value = _directory.getInteger(TAG_CANON_SERIAL_NUMBER); 141 144 if (value == null) … … 673 676 return "Self timer not used"; 674 677 } else { 675 // TODO find an image that tests this calculation676 return Double.toString((double)value * 0.1d) + " sec";678 DecimalFormat format = new DecimalFormat("0.##"); 679 return format.format((double)value * 0.1d) + " sec"; 677 680 } 678 681 } -
trunk/src/com/drew/metadata/exif/makernotes/CanonMakernoteDirectory.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/CasioType1MakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 155 155 { 156 156 Integer value = _directory.getInteger(TAG_OBJECT_DISTANCE); 157 158 if (value == null) 159 return null; 160 161 return value + " mm"; 157 return value == null ? null : getFocalLengthDescription(value); 162 158 } 163 159 -
trunk/src/com/drew/metadata/exif/makernotes/CasioType1MakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/CasioType2MakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 240 240 { 241 241 Double value = _directory.getDoubleObject(TAG_FOCAL_LENGTH); 242 if (value == null) 243 return null; 244 return Double.toString(value / 10d) + " mm"; 242 return value == null ? null : getFocalLengthDescription(value / 10d); 245 243 } 246 244 -
trunk/src/com/drew/metadata/exif/makernotes/CasioType2MakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/FujifilmMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/FujifilmMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/KodakMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/KodakMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/KyoceraMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/KyoceraMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/LeicaMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/LeicaMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/NikonType1MakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/NikonType1MakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/NikonType2MakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 306 306 { 307 307 int[] values = _directory.getIntArray(tagType); 308 if (values == null) 308 if (values == null || values.length < 2) 309 309 return null; 310 310 if (values.length < 3 || values[2] == 0) … … 329 329 public String getLensDescription() 330 330 { 331 Rational[] values = _directory.getRationalArray(TAG_LENS); 332 333 return values == null 334 ? null 335 : values.length < 4 336 ? _directory.getString(TAG_LENS) 337 : String.format("%d-%dmm f/%.1f-%.1f", values[0].intValue(), values[1].intValue(), values[2].floatValue(), values[3].floatValue()); 338 331 return getLensSpecificationDescription(TAG_LENS); 339 332 } 340 333 -
trunk/src/com/drew/metadata/exif/makernotes/NikonType2MakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/OlympusMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 21 21 package com.drew.metadata.exif.makernotes; 22 22 23 import com.drew.lang.DateUtil; 23 24 import com.drew.lang.annotations.NotNull; 24 25 import com.drew.lang.annotations.Nullable; 25 26 import com.drew.metadata.TagDescriptor; 26 27 27 import java.util.GregorianCalendar; 28 import java.math.RoundingMode; 29 import java.text.DecimalFormat; 28 30 29 31 import static com.drew.metadata.exif.makernotes.OlympusMakernoteDirectory.*; … … 115 117 return getFocusDistanceDescription(); 116 118 case CameraSettings.TAG_FLASH_FIRED: 117 return getFlas tFiredDescription();119 return getFlashFiredDescription(); 118 120 case CameraSettings.TAG_DATE: 119 121 return getDateDescription(); … … 142 144 return getSubjectProgramDescription(); 143 145 case CameraSettings.TAG_FLASH_COMPENSATION: 144 return getFlas tCompensationDescription();146 return getFlashCompensationDescription(); 145 147 case CameraSettings.TAG_ISO_SETTING: 146 148 return getIsoSettingDescription(); … … 258 260 259 261 double iso = Math.pow((value / 8d) - 1, 2) * 3.125; 260 return Double.toString(iso); 262 DecimalFormat format = new DecimalFormat("0.##"); 263 format.setRoundingMode(RoundingMode.HALF_UP); 264 return format.format(iso); 261 265 } 262 266 … … 274 278 275 279 double shutterSpeed = Math.pow((49-value) / 8d, 2); 276 return Double.toString(shutterSpeed) + " sec"; 280 DecimalFormat format = new DecimalFormat("0.###"); 281 format.setRoundingMode(RoundingMode.HALF_UP); 282 return format.format(shutterSpeed) + " sec"; 277 283 } 278 284 … … 289 295 290 296 double fStop = Math.pow((value/16d) - 0.5, 2); 291 return "F" + Double.toString(fStop);297 return getFStopDescription(fStop); 292 298 } 293 299 … … 308 314 { 309 315 Long value = _directory.getLongObject(CameraSettings.TAG_EXPOSURE_COMPENSATION); 310 return value == null ? null : ((value / 3d) - 2) + " EV"; 316 DecimalFormat format = new DecimalFormat("0.##"); 317 return value == null ? null : format.format((value / 3d) - 2) + " EV"; 311 318 } 312 319 … … 341 348 { 342 349 Long value = _directory.getLongObject(CameraSettings.TAG_FOCAL_LENGTH); 343 return value == null ? null : Double.toString(value/256d)+ " mm";350 return value == null ? null : getFocalLengthDescription(value/256d); 344 351 } 345 352 … … 356 363 357 364 @Nullable 358 public String getFlas tFiredDescription()365 public String getFlashFiredDescription() 359 366 { 360 367 return getIndexedDescription(CameraSettings.TAG_FLASH_FIRED, "No", "Yes"); … … 370 377 if (value == null) 371 378 return null; 372 long day = value & 0xFF; 373 long month = (value >> 16) & 0xFF; 374 long year = (value >> 8) & 0xFF; 375 return new GregorianCalendar((int)year + 1970, (int)month, (int)day).getTime().toString(); 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); 376 388 } 377 389 … … 385 397 if (value == null) 386 398 return null; 387 long hours = (value >> 8) & 0xFF; 388 long minutes = (value >> 16) & 0xFF; 389 long seconds = value & 0xFF; 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"; 390 406 391 407 return String.format("%02d:%02d:%02d", hours, minutes, seconds); … … 400 416 return null; 401 417 double fStop = Math.pow((value/16d) - 0.5, 2); 402 return "F" + fStop;418 return getFStopDescription(fStop); 403 419 } 404 420 … … 424 440 { 425 441 Long value = _directory.getLongObject(CameraSettings.TAG_WHITE_BALANCE_RED); 426 return value == null ? null : Double.toString(value/256d); 442 DecimalFormat format = new DecimalFormat("0.##"); 443 return value == null ? null : format.format(value/256d); 427 444 } 428 445 … … 431 448 { 432 449 Long value = _directory.getLongObject(CameraSettings.TAG_WHITE_BALANCE_GREEN); 433 return value == null ? null : Double.toString(value/256d); 450 DecimalFormat format = new DecimalFormat("0.##"); 451 return value == null ? null : format.format(value/256d); 434 452 } 435 453 … … 438 456 { 439 457 Long value = _directory.getLongObject(CameraSettings.TAG_WHITE_BALANCE_BLUE); 440 return value == null ? null : Double.toString(value/256d); 458 DecimalFormat format = new DecimalFormat("0.##"); 459 return value == null ? null : format.format(value / 256d); 441 460 } 442 461 … … 468 487 469 488 @Nullable 470 public String getFlas tCompensationDescription()489 public String getFlashCompensationDescription() 471 490 { 472 491 Long value = _directory.getLongObject(CameraSettings.TAG_FLASH_COMPENSATION); 473 return value == null ? null : ((value-6)/3d) + " EV"; 492 DecimalFormat format = new DecimalFormat("0.##"); 493 return value == null ? null : format.format((value-6)/3d) + " EV"; 474 494 } 475 495 … … 535 555 { 536 556 Long value = _directory.getLongObject(CameraSettings.TAG_APEX_BRIGHTNESS_VALUE); 537 return value == null ? null : Double.toString((value/8d)-6); 557 DecimalFormat format = new DecimalFormat("0.##"); 558 return value == null ? null : format.format((value/8d)-6); 538 559 } 539 560 -
trunk/src/com/drew/metadata/exif/makernotes/OlympusMakernoteDirectory.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/PanasonicMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/PanasonicMakernoteDirectory.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/PentaxMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/PentaxMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/RicohMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/RicohMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SanyoMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SanyoMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SigmaMakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SigmaMakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SonyType1MakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SonyType1MakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SonyType6MakernoteDescriptor.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/SonyType6MakernoteDirectory.java
r8132 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); -
trunk/src/com/drew/metadata/exif/makernotes/package.html
r8132 r10862 1 1 <!-- 2 ~ Copyright 2002-201 5Drew Noakes2 ~ Copyright 2002-2016 Drew Noakes 3 3 ~ 4 4 ~ Licensed under the Apache License, Version 2.0 (the "License");
Note:
See TracChangeset
for help on using the changeset viewer.