Ignore:
Timestamp:
2016-08-20T20:58:03+02:00 (9 years ago)
Author:
Don-vip
Message:

update to metadata-extractor 2.9.1

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  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    2424import com.drew.lang.annotations.Nullable;
    2525import com.drew.metadata.TagDescriptor;
     26
     27import java.text.DecimalFormat;
    2628
    2729import static com.drew.metadata.exif.makernotes.CanonMakernoteDirectory.*;
     
    138140    public String getSerialNumberDescription()
    139141    {
     142        // http://www.ozhiker.com/electronics/pjmt/jpeg_info/canon_mn.html
    140143        Integer value = _directory.getInteger(TAG_CANON_SERIAL_NUMBER);
    141144        if (value == null)
     
    673676            return "Self timer not used";
    674677        } else {
    675             // TODO find an image that tests this calculation
    676             return Double.toString((double)value * 0.1d) + " sec";
     678            DecimalFormat format = new DecimalFormat("0.##");
     679            return format.format((double)value * 0.1d) + " sec";
    677680        }
    678681    }
  • trunk/src/com/drew/metadata/exif/makernotes/CanonMakernoteDirectory.java

    r8243 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/CasioType1MakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    155155    {
    156156        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);
    162158    }
    163159
  • trunk/src/com/drew/metadata/exif/makernotes/CasioType1MakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/CasioType2MakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    240240    {
    241241        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);
    245243    }
    246244
  • trunk/src/com/drew/metadata/exif/makernotes/CasioType2MakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/FujifilmMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/FujifilmMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/KodakMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/KodakMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/KyoceraMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/KyoceraMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/LeicaMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/LeicaMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/NikonType1MakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/NikonType1MakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/NikonType2MakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    306306    {
    307307        int[] values = _directory.getIntArray(tagType);
    308         if (values == null)
     308        if (values == null || values.length < 2)
    309309            return null;
    310310        if (values.length < 3 || values[2] == 0)
     
    329329    public String getLensDescription()
    330330    {
    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);
    339332    }
    340333
  • trunk/src/com/drew/metadata/exif/makernotes/NikonType2MakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/OlympusMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    2121package com.drew.metadata.exif.makernotes;
    2222
     23import com.drew.lang.DateUtil;
    2324import com.drew.lang.annotations.NotNull;
    2425import com.drew.lang.annotations.Nullable;
    2526import com.drew.metadata.TagDescriptor;
    2627
    27 import java.util.GregorianCalendar;
     28import java.math.RoundingMode;
     29import java.text.DecimalFormat;
    2830
    2931import static com.drew.metadata.exif.makernotes.OlympusMakernoteDirectory.*;
     
    115117                return getFocusDistanceDescription();
    116118            case CameraSettings.TAG_FLASH_FIRED:
    117                 return getFlastFiredDescription();
     119                return getFlashFiredDescription();
    118120            case CameraSettings.TAG_DATE:
    119121                return getDateDescription();
     
    142144                return getSubjectProgramDescription();
    143145            case CameraSettings.TAG_FLASH_COMPENSATION:
    144                 return getFlastCompensationDescription();
     146                return getFlashCompensationDescription();
    145147            case CameraSettings.TAG_ISO_SETTING:
    146148                return getIsoSettingDescription();
     
    258260
    259261        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);
    261265    }
    262266
     
    274278
    275279        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";
    277283    }
    278284
     
    289295
    290296        double fStop = Math.pow((value/16d) - 0.5, 2);
    291         return "F" + Double.toString(fStop);
     297        return getFStopDescription(fStop);
    292298    }
    293299
     
    308314    {
    309315        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";
    311318    }
    312319
     
    341348    {
    342349        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);
    344351    }
    345352
     
    356363
    357364    @Nullable
    358     public String getFlastFiredDescription()
     365    public String getFlashFiredDescription()
    359366    {
    360367        return getIndexedDescription(CameraSettings.TAG_FLASH_FIRED, "No", "Yes");
     
    370377        if (value == null)
    371378            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);
    376388    }
    377389
     
    385397        if (value == null)
    386398            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";
    390406
    391407        return String.format("%02d:%02d:%02d", hours, minutes, seconds);
     
    400416            return null;
    401417        double fStop = Math.pow((value/16d) - 0.5, 2);
    402         return "F" + fStop;
     418        return getFStopDescription(fStop);
    403419    }
    404420
     
    424440    {
    425441        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);
    427444    }
    428445
     
    431448    {
    432449        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);
    434452    }
    435453
     
    438456    {
    439457        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);
    441460    }
    442461
     
    468487
    469488    @Nullable
    470     public String getFlastCompensationDescription()
     489    public String getFlashCompensationDescription()
    471490    {
    472491        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";
    474494    }
    475495
     
    535555    {
    536556        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);
    538559    }
    539560
  • trunk/src/com/drew/metadata/exif/makernotes/OlympusMakernoteDirectory.java

    r8243 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/PanasonicMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/PanasonicMakernoteDirectory.java

    r8243 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/PentaxMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/PentaxMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/RicohMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/RicohMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SanyoMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SanyoMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SigmaMakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SigmaMakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SonyType1MakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SonyType1MakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SonyType6MakernoteDescriptor.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/SonyType6MakernoteDirectory.java

    r8132 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
  • trunk/src/com/drew/metadata/exif/makernotes/package.html

    r8132 r10862  
    11<!--
    2   ~ Copyright 2002-2015 Drew Noakes
     2  ~ Copyright 2002-2016 Drew Noakes
    33  ~
    44  ~    Licensed under the Apache License, Version 2.0 (the "License");
Note: See TracChangeset for help on using the changeset viewer.