Changeset 10862 in josm for trunk/src/com/drew/metadata/jpeg


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

update to metadata-extractor 2.9.1

Location:
trunk/src/com/drew/metadata/jpeg
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/drew/metadata/jpeg/JpegCommentDescriptor.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/jpeg/JpegCommentDirectory.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/jpeg/JpegCommentReader.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");
     
    2626import com.drew.metadata.Metadata;
    2727
    28 import java.util.Arrays;
     28import java.util.Collections;
    2929
    3030/**
     
    3939    public Iterable<JpegSegmentType> getSegmentTypes()
    4040    {
    41         return Arrays.asList(JpegSegmentType.COM);
    42     }
    43 
    44     public boolean canProcess(@NotNull byte[] segmentBytes, @NotNull JpegSegmentType segmentType)
    45     {
    46         // The entire contents of the byte[] is the comment. There's nothing here to discriminate upon.
    47         return true;
     41        return Collections.singletonList(JpegSegmentType.COM);
    4842    }
    4943
  • trunk/src/com/drew/metadata/jpeg/JpegComponent.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.jpeg;
    2222
    23 import com.drew.lang.annotations.Nullable;
     23import com.drew.lang.annotations.NotNull;
    2424
    2525import java.io.Serializable;
     
    5555     * @return the component name
    5656     */
    57     @Nullable
     57    @NotNull
    5858    public String getComponentName()
    5959    {
     
    7070            case 5:
    7171                return "Q";
     72            default:
     73                return String.format("Unknown (%s)", _componentId);
    7274        }
    73         return null;
    7475    }
    7576
     
    8182    public int getHorizontalSamplingFactor()
    8283    {
    83         return _samplingFactorByte & 0x0F;
     84        return (_samplingFactorByte>>4) & 0x0F;
    8485    }
    8586
    8687    public int getVerticalSamplingFactor()
    8788    {
    88         return (_samplingFactorByte>>4) & 0x0F;
     89        return _samplingFactorByte & 0x0F;
    8990    }
    9091}
  • trunk/src/com/drew/metadata/jpeg/JpegDescriptor.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");
     
    2525import com.drew.metadata.TagDescriptor;
    2626
     27import static com.drew.metadata.jpeg.JpegDirectory.*;
     28
    2729/**
    2830 * Provides human-readable string versions of the tags stored in a JpegDirectory.
     
    4446        switch (tagType)
    4547        {
    46             case JpegDirectory.TAG_COMPRESSION_TYPE:
     48            case TAG_COMPRESSION_TYPE:
    4749                return getImageCompressionTypeDescription();
    48             case JpegDirectory.TAG_COMPONENT_DATA_1:
     50            case TAG_COMPONENT_DATA_1:
    4951                return getComponentDataDescription(0);
    50             case JpegDirectory.TAG_COMPONENT_DATA_2:
     52            case TAG_COMPONENT_DATA_2:
    5153                return getComponentDataDescription(1);
    52             case JpegDirectory.TAG_COMPONENT_DATA_3:
     54            case TAG_COMPONENT_DATA_3:
    5355                return getComponentDataDescription(2);
    54             case JpegDirectory.TAG_COMPONENT_DATA_4:
     56            case TAG_COMPONENT_DATA_4:
    5557                return getComponentDataDescription(3);
    56             case JpegDirectory.TAG_DATA_PRECISION:
     58            case TAG_DATA_PRECISION:
    5759                return getDataPrecisionDescription();
    58             case JpegDirectory.TAG_IMAGE_HEIGHT:
     60            case TAG_IMAGE_HEIGHT:
    5961                return getImageHeightDescription();
    60             case JpegDirectory.TAG_IMAGE_WIDTH:
     62            case TAG_IMAGE_WIDTH:
    6163                return getImageWidthDescription();
    6264            default:
     
    6870    public String getImageCompressionTypeDescription()
    6971    {
    70         Integer value = _directory.getInteger(JpegDirectory.TAG_COMPRESSION_TYPE);
    71         if (value==null)
    72             return null;
    73         // Note there is no 2 or 12
    74         switch (value) {
    75             case 0: return "Baseline";
    76             case 1: return "Extended sequential, Huffman";
    77             case 2: return "Progressive, Huffman";
    78             case 3: return "Lossless, Huffman";
    79             case 5: return "Differential sequential, Huffman";
    80             case 6: return "Differential progressive, Huffman";
    81             case 7: return "Differential lossless, Huffman";
    82             case 8: return "Reserved for JPEG extensions";
    83             case 9: return "Extended sequential, arithmetic";
    84             case 10: return "Progressive, arithmetic";
    85             case 11: return "Lossless, arithmetic";
    86             case 13: return "Differential sequential, arithmetic";
    87             case 14: return "Differential progressive, arithmetic";
    88             case 15: return "Differential lossless, arithmetic";
    89             default:
    90                 return "Unknown type: "+ value;
    91         }
     72        return getIndexedDescription(TAG_COMPRESSION_TYPE,
     73            "Baseline",
     74            "Extended sequential, Huffman",
     75            "Progressive, Huffman",
     76            "Lossless, Huffman",
     77            null, // no 4
     78            "Differential sequential, Huffman",
     79            "Differential progressive, Huffman",
     80            "Differential lossless, Huffman",
     81            "Reserved for JPEG extensions",
     82            "Extended sequential, arithmetic",
     83            "Progressive, arithmetic",
     84            "Lossless, arithmetic",
     85            null, // no 12
     86            "Differential sequential, arithmetic",
     87            "Differential progressive, arithmetic",
     88            "Differential lossless, arithmetic");
    9289    }
     90
    9391    @Nullable
    9492    public String getImageWidthDescription()
    9593    {
    96         final String value = _directory.getString(JpegDirectory.TAG_IMAGE_WIDTH);
     94        final String value = _directory.getString(TAG_IMAGE_WIDTH);
    9795        if (value==null)
    9896            return null;
     
    103101    public String getImageHeightDescription()
    104102    {
    105         final String value = _directory.getString(JpegDirectory.TAG_IMAGE_HEIGHT);
     103        final String value = _directory.getString(TAG_IMAGE_HEIGHT);
    106104        if (value==null)
    107105            return null;
     
    112110    public String getDataPrecisionDescription()
    113111    {
    114         final String value = _directory.getString(JpegDirectory.TAG_DATA_PRECISION);
     112        final String value = _directory.getString(TAG_DATA_PRECISION);
    115113        if (value==null)
    116114            return null;
  • trunk/src/com/drew/metadata/jpeg/JpegDirectory.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/jpeg/JpegReader.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/jpeg/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.