| 1 | /*
|
|---|
| 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/
|
|---|
| 20 | */
|
|---|
| 21 | package com.drew.metadata.exif;
|
|---|
| 22 |
|
|---|
| 23 | import com.drew.lang.annotations.NotNull;
|
|---|
| 24 | import com.drew.lang.annotations.Nullable;
|
|---|
| 25 | import com.drew.metadata.TagDescriptor;
|
|---|
| 26 |
|
|---|
| 27 | /**
|
|---|
| 28 | * Provides human-readable string representations of tag values stored in a <code>PentaxMakernoteDirectory</code>.
|
|---|
| 29 | * <p/>
|
|---|
| 30 | * Some information about this makernote taken from here:
|
|---|
| 31 | * http://www.ozhiker.com/electronics/pjmt/jpeg_info/pentax_mn.html
|
|---|
| 32 | *
|
|---|
| 33 | * @author Drew Noakes http://drewnoakes.com
|
|---|
| 34 | */
|
|---|
| 35 | public class PentaxMakernoteDescriptor extends TagDescriptor<PentaxMakernoteDirectory>
|
|---|
| 36 | {
|
|---|
| 37 | public PentaxMakernoteDescriptor(@NotNull PentaxMakernoteDirectory directory)
|
|---|
| 38 | {
|
|---|
| 39 | super(directory);
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | @Nullable
|
|---|
| 43 | public String getDescription(int tagType)
|
|---|
| 44 | {
|
|---|
| 45 | switch (tagType)
|
|---|
| 46 | {
|
|---|
| 47 | case PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE:
|
|---|
| 48 | return getCaptureModeDescription();
|
|---|
| 49 | case PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL:
|
|---|
| 50 | return getQualityLevelDescription();
|
|---|
| 51 | case PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE:
|
|---|
| 52 | return getFocusModeDescription();
|
|---|
| 53 | case PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE:
|
|---|
| 54 | return getFlashModeDescription();
|
|---|
| 55 | case PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE:
|
|---|
| 56 | return getWhiteBalanceDescription();
|
|---|
| 57 | case PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM:
|
|---|
| 58 | return getDigitalZoomDescription();
|
|---|
| 59 | case PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS:
|
|---|
| 60 | return getSharpnessDescription();
|
|---|
| 61 | case PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST:
|
|---|
| 62 | return getContrastDescription();
|
|---|
| 63 | case PentaxMakernoteDirectory.TAG_PENTAX_SATURATION:
|
|---|
| 64 | return getSaturationDescription();
|
|---|
| 65 | case PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED:
|
|---|
| 66 | return getIsoSpeedDescription();
|
|---|
| 67 | case PentaxMakernoteDirectory.TAG_PENTAX_COLOUR:
|
|---|
| 68 | return getColourDescription();
|
|---|
| 69 | default:
|
|---|
| 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;
|
|---|
| 80 | switch (value)
|
|---|
| 81 | {
|
|---|
| 82 | case 1: return "Normal";
|
|---|
| 83 | case 2: return "Black & White";
|
|---|
| 84 | case 3: return "Sepia";
|
|---|
| 85 | default: return "Unknown (" + value + ")";
|
|---|
| 86 | }
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | @Nullable
|
|---|
| 90 | public String getIsoSpeedDescription()
|
|---|
| 91 | {
|
|---|
| 92 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED);
|
|---|
| 93 | if (value==null)
|
|---|
| 94 | return null;
|
|---|
| 95 | switch (value)
|
|---|
| 96 | {
|
|---|
| 97 | // TODO there must be other values which aren't catered for here
|
|---|
| 98 | case 10: return "ISO 100";
|
|---|
| 99 | case 16: return "ISO 200";
|
|---|
| 100 | case 100: return "ISO 100";
|
|---|
| 101 | case 200: return "ISO 200";
|
|---|
| 102 | default: return "Unknown (" + value + ")";
|
|---|
| 103 | }
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | @Nullable
|
|---|
| 107 | public String getSaturationDescription()
|
|---|
| 108 | {
|
|---|
| 109 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_SATURATION);
|
|---|
| 110 | if (value==null)
|
|---|
| 111 | return null;
|
|---|
| 112 | switch (value)
|
|---|
| 113 | {
|
|---|
| 114 | case 0: return "Normal";
|
|---|
| 115 | case 1: return "Low";
|
|---|
| 116 | case 2: return "High";
|
|---|
| 117 | default: return "Unknown (" + value + ")";
|
|---|
| 118 | }
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | @Nullable
|
|---|
| 122 | public String getContrastDescription()
|
|---|
| 123 | {
|
|---|
| 124 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST);
|
|---|
| 125 | if (value==null)
|
|---|
| 126 | return null;
|
|---|
| 127 | switch (value)
|
|---|
| 128 | {
|
|---|
| 129 | case 0: return "Normal";
|
|---|
| 130 | case 1: return "Low";
|
|---|
| 131 | case 2: return "High";
|
|---|
| 132 | default: return "Unknown (" + value + ")";
|
|---|
| 133 | }
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | @Nullable
|
|---|
| 137 | public String getSharpnessDescription()
|
|---|
| 138 | {
|
|---|
| 139 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS);
|
|---|
| 140 | if (value==null)
|
|---|
| 141 | return null;
|
|---|
| 142 | switch (value)
|
|---|
| 143 | {
|
|---|
| 144 | case 0: return "Normal";
|
|---|
| 145 | case 1: return "Soft";
|
|---|
| 146 | case 2: return "Hard";
|
|---|
| 147 | default: return "Unknown (" + value + ")";
|
|---|
| 148 | }
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | @Nullable
|
|---|
| 152 | public String getDigitalZoomDescription()
|
|---|
| 153 | {
|
|---|
| 154 | Float value = _directory.getFloatObject(PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM);
|
|---|
| 155 | if (value==null)
|
|---|
| 156 | return null;
|
|---|
| 157 | if (value==0)
|
|---|
| 158 | return "Off";
|
|---|
| 159 | return Float.toString(value);
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | @Nullable
|
|---|
| 163 | public String getWhiteBalanceDescription()
|
|---|
| 164 | {
|
|---|
| 165 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE);
|
|---|
| 166 | if (value==null)
|
|---|
| 167 | return null;
|
|---|
| 168 | switch (value)
|
|---|
| 169 | {
|
|---|
| 170 | case 0: return "Auto";
|
|---|
| 171 | case 1: return "Daylight";
|
|---|
| 172 | case 2: return "Shade";
|
|---|
| 173 | case 3: return "Tungsten";
|
|---|
| 174 | case 4: return "Fluorescent";
|
|---|
| 175 | case 5: return "Manual";
|
|---|
| 176 | default: return "Unknown (" + value + ")";
|
|---|
| 177 | }
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | @Nullable
|
|---|
| 181 | public String getFlashModeDescription()
|
|---|
| 182 | {
|
|---|
| 183 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE);
|
|---|
| 184 | if (value==null)
|
|---|
| 185 | return null;
|
|---|
| 186 | switch (value)
|
|---|
| 187 | {
|
|---|
| 188 | case 1: return "Auto";
|
|---|
| 189 | case 2: return "Flash On";
|
|---|
| 190 | case 4: return "Flash Off";
|
|---|
| 191 | case 6: return "Red-eye Reduction";
|
|---|
| 192 | default: return "Unknown (" + value + ")";
|
|---|
| 193 | }
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | @Nullable
|
|---|
| 197 | public String getFocusModeDescription()
|
|---|
| 198 | {
|
|---|
| 199 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE);
|
|---|
| 200 | if (value==null)
|
|---|
| 201 | return null;
|
|---|
| 202 | switch (value)
|
|---|
| 203 | {
|
|---|
| 204 | case 2: return "Custom";
|
|---|
| 205 | case 3: return "Auto";
|
|---|
| 206 | default: return "Unknown (" + value + ")";
|
|---|
| 207 | }
|
|---|
| 208 | }
|
|---|
| 209 |
|
|---|
| 210 | @Nullable
|
|---|
| 211 | public String getQualityLevelDescription()
|
|---|
| 212 | {
|
|---|
| 213 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL);
|
|---|
| 214 | if (value==null)
|
|---|
| 215 | return null;
|
|---|
| 216 | switch (value)
|
|---|
| 217 | {
|
|---|
| 218 | case 0: return "Good";
|
|---|
| 219 | case 1: return "Better";
|
|---|
| 220 | case 2: return "Best";
|
|---|
| 221 | default: return "Unknown (" + value + ")";
|
|---|
| 222 | }
|
|---|
| 223 | }
|
|---|
| 224 |
|
|---|
| 225 | @Nullable
|
|---|
| 226 | public String getCaptureModeDescription()
|
|---|
| 227 | {
|
|---|
| 228 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE);
|
|---|
| 229 | if (value==null)
|
|---|
| 230 | return null;
|
|---|
| 231 | switch (value)
|
|---|
| 232 | {
|
|---|
| 233 | case 1: return "Auto";
|
|---|
| 234 | case 2: return "Night-scene";
|
|---|
| 235 | case 3: return "Manual";
|
|---|
| 236 | case 4: return "Multiple";
|
|---|
| 237 | default: return "Unknown (" + value + ")";
|
|---|
| 238 | }
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | /*
|
|---|
| 242 | public String getPrintImageMatchingInfoDescription()
|
|---|
| 243 | {
|
|---|
| 244 | byte[] bytes = _directory.getByteArray(PentaxMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO);
|
|---|
| 245 | if (bytes==null)
|
|---|
| 246 | return null;
|
|---|
| 247 | return "(" + bytes.length + " bytes)";
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | public String getMacroModeDescription()
|
|---|
| 251 | {
|
|---|
| 252 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PANASONIC_MACRO_MODE);
|
|---|
| 253 | if (value==null)
|
|---|
| 254 | return null;
|
|---|
| 255 | switch (value) {
|
|---|
| 256 | case 1:
|
|---|
| 257 | return "On";
|
|---|
| 258 | case 2:
|
|---|
| 259 | return "Off";
|
|---|
| 260 | default:
|
|---|
| 261 | return "Unknown (" + value + ")";
|
|---|
| 262 | }
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | public String getRecordModeDescription()
|
|---|
| 266 | {
|
|---|
| 267 | Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PANASONIC_RECORD_MODE);
|
|---|
| 268 | if (value==null)
|
|---|
| 269 | return null;
|
|---|
| 270 | switch (value) {
|
|---|
| 271 | case 1:
|
|---|
| 272 | return "Normal";
|
|---|
| 273 | case 2:
|
|---|
| 274 | return "Portrait";
|
|---|
| 275 | case 9:
|
|---|
| 276 | return "Macro";
|
|---|
| 277 | default:
|
|---|
| 278 | return "Unknown (" + value + ")";
|
|---|
| 279 | }
|
|---|
| 280 | }
|
|---|
| 281 | */
|
|---|
| 282 | }
|
|---|