Ignore:
Timestamp:
2013-08-09T18:05:11+02:00 (13 years ago)
Author:
bastiK
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/drew/metadata/exif/PentaxMakernoteDescriptor.java

    r4231 r6127  
    11/*
    2  * This is public domain software - that is, you can do whatever you want
    3  * with it, and include it software that is licensed under the GNU or the
    4  * BSD license, or whatever other licence you choose, including proprietary
    5  * closed source licenses.  I do ask that you leave this header in tact.
    6  *
    7  * If you make modifications to this code that you think would benefit the
    8  * wider community, please send me a copy and I'll post it on my site.
    9  *
    10  * If you make use of this code, I'd appreciate hearing about it.
    11  *   drew@drewnoakes.com
    12  * Latest version of this software kept at
    13  *   http://drewnoakes.com/
     2 * Copyright 2002-2012 Drew Noakes
     3 *
     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
     7 *
     8 *        http://www.apache.org/licenses/LICENSE-2.0
     9 *
     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/
    1420 */
    1521package com.drew.metadata.exif;
    1622
    17 import com.drew.metadata.Directory;
    18 import com.drew.metadata.MetadataException;
     23import com.drew.lang.annotations.NotNull;
     24import com.drew.lang.annotations.Nullable;
    1925import com.drew.metadata.TagDescriptor;
    2026
    2127/**
    22  * Provides human-readable string versions of the tags stored in PentaxMakernoteDirectory.
    23  *
     28 * Provides human-readable string representations of tag values stored in a <code>PentaxMakernoteDirectory</code>.
     29 * <p/>
    2430 * Some information about this makernote taken from here:
    2531 * http://www.ozhiker.com/electronics/pjmt/jpeg_info/pentax_mn.html
     32 *
     33 * @author Drew Noakes http://drewnoakes.com
    2634 */
    27 public class PentaxMakernoteDescriptor extends TagDescriptor
     35public class PentaxMakernoteDescriptor extends TagDescriptor<PentaxMakernoteDirectory>
    2836{
    29     public PentaxMakernoteDescriptor(Directory directory)
     37    public PentaxMakernoteDescriptor(@NotNull PentaxMakernoteDirectory directory)
    3038    {
    3139        super(directory);
    3240    }
    3341
    34     public String getDescription(int tagType) throws MetadataException
     42    @Nullable
     43    public String getDescription(int tagType)
    3544    {
    3645        switch (tagType)
     
    5968                return getColourDescription();
    6069            default:
    61                 return _directory.getString(tagType);
    62         }
    63     }
    64 
    65     public String getColourDescription() throws MetadataException
    66     {
    67         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_COLOUR)) return null;
    68         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_COLOUR);
     70                return super.getDescription(tagType);
     71        }
     72    }
     73
     74    @Nullable
     75    public String getColourDescription()
     76    {
     77        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_COLOUR);
     78        if (value==null)
     79            return null;
    6980        switch (value)
    7081        {
     
    7687    }
    7788
    78     public String getIsoSpeedDescription() throws MetadataException
    79     {
    80         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED)) return null;
    81         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED);
     89    @Nullable
     90    public String getIsoSpeedDescription()
     91    {
     92        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED);
     93        if (value==null)
     94            return null;
    8295        switch (value)
    8396        {
     
    91104    }
    92105
    93     public String getSaturationDescription() throws MetadataException
    94     {
    95         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_SATURATION)) return null;
    96         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_SATURATION);
     106    @Nullable
     107    public String getSaturationDescription()
     108    {
     109        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_SATURATION);
     110        if (value==null)
     111            return null;
    97112        switch (value)
    98113        {
     
    104119    }
    105120
    106     public String getContrastDescription() throws MetadataException
    107     {
    108         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST)) return null;
    109         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST);
     121    @Nullable
     122    public String getContrastDescription()
     123    {
     124        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST);
     125        if (value==null)
     126            return null;
    110127        switch (value)
    111128        {
     
    117134    }
    118135
    119     public String getSharpnessDescription() throws MetadataException
    120     {
    121         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS)) return null;
    122         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS);
     136    @Nullable
     137    public String getSharpnessDescription()
     138    {
     139        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS);
     140        if (value==null)
     141            return null;
    123142        switch (value)
    124143        {
     
    130149    }
    131150
    132     public String getDigitalZoomDescription() throws MetadataException
    133     {
    134         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM)) return null;
    135         float value = _directory.getFloat(PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM);
     151    @Nullable
     152    public String getDigitalZoomDescription()
     153    {
     154        Float value = _directory.getFloatObject(PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM);
     155        if (value==null)
     156            return null;
    136157        if (value==0)
    137158            return "Off";
     
    139160    }
    140161
    141     public String getWhiteBalanceDescription() throws MetadataException
    142     {
    143         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE)) return null;
    144         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE);
     162    @Nullable
     163    public String getWhiteBalanceDescription()
     164    {
     165        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE);
     166        if (value==null)
     167            return null;
    145168        switch (value)
    146169        {
     
    155178    }
    156179
    157     public String getFlashModeDescription() throws MetadataException
    158     {
    159         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE)) return null;
    160         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE);
     180    @Nullable
     181    public String getFlashModeDescription()
     182    {
     183        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE);
     184        if (value==null)
     185            return null;
    161186        switch (value)
    162187        {
     
    169194    }
    170195
    171     public String getFocusModeDescription() throws MetadataException
    172     {
    173         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE)) return null;
    174         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE);
     196    @Nullable
     197    public String getFocusModeDescription()
     198    {
     199        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE);
     200        if (value==null)
     201            return null;
    175202        switch (value)
    176203        {
     
    181208    }
    182209
    183     public String getQualityLevelDescription() throws MetadataException
    184     {
    185         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL)) return null;
    186         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL);
     210    @Nullable
     211    public String getQualityLevelDescription()
     212    {
     213        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL);
     214        if (value==null)
     215            return null;
    187216        switch (value)
    188217        {
     
    194223    }
    195224
    196     public String getCaptureModeDescription() throws MetadataException
    197     {
    198         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE)) return null;
    199         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE);
     225    @Nullable
     226    public String getCaptureModeDescription()
     227    {
     228        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE);
     229        if (value==null)
     230            return null;
    200231        switch (value)
    201232        {
     
    209240
    210241/*
    211     public String getPrintImageMatchingInfoDescription() throws MetadataException
    212     {
    213         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO)) return null;
     242    public String getPrintImageMatchingInfoDescription()
     243    {
    214244        byte[] bytes = _directory.getByteArray(PentaxMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO);
     245        if (bytes==null)
     246            return null;
    215247        return "(" + bytes.length + " bytes)";
    216248    }
    217249
    218     public String getMacroModeDescription() throws MetadataException
    219     {
    220         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PANASONIC_MACRO_MODE)) return null;
    221         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PANASONIC_MACRO_MODE);
     250    public String getMacroModeDescription()
     251    {
     252        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PANASONIC_MACRO_MODE);
     253        if (value==null)
     254            return null;
    222255        switch (value) {
    223256            case 1:
     
    230263    }
    231264
    232     public String getRecordModeDescription() throws MetadataException
    233     {
    234         if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PANASONIC_RECORD_MODE)) return null;
    235         int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PANASONIC_RECORD_MODE);
     265    public String getRecordModeDescription()
     266    {
     267        Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PANASONIC_RECORD_MODE);
     268        if (value==null)
     269            return null;
    236270        switch (value) {
    237271            case 1:
Note: See TracChangeset for help on using the changeset viewer.