source: josm/trunk/src/com/drew/metadata/exif/PanasonicMakernoteDescriptor.java@ 4231

Last change on this file since 4231 was 4231, checked in by stoecker, 14 years ago

add signpost and metadata extractor code to repository directly

File size: 3.2 KB
Line 
1/*
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/
14 */
15package com.drew.metadata.exif;
16
17import com.drew.metadata.Directory;
18import com.drew.metadata.MetadataException;
19import com.drew.metadata.TagDescriptor;
20
21/**
22 * Provides human-readable string versions of the tags stored in a PanasonicMakernoteDirectory.
23 *
24 * Some information about this makernote taken from here:
25 * http://www.ozhiker.com/electronics/pjmt/jpeg_info/panasonic_mn.html
26 */
27public class PanasonicMakernoteDescriptor extends TagDescriptor
28{
29 public PanasonicMakernoteDescriptor(Directory directory)
30 {
31 super(directory);
32 }
33
34 public String getDescription(int tagType) throws MetadataException
35 {
36 switch (tagType)
37 {
38 case PanasonicMakernoteDirectory.TAG_PANASONIC_MACRO_MODE:
39 return getMacroModeDescription();
40 case PanasonicMakernoteDirectory.TAG_PANASONIC_RECORD_MODE:
41 return getRecordModeDescription();
42 case PanasonicMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO:
43 return getPrintImageMatchingInfoDescription();
44 default:
45 return _directory.getString(tagType);
46 }
47 }
48
49 public String getPrintImageMatchingInfoDescription() throws MetadataException
50 {
51 if (!_directory.containsTag(PanasonicMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO)) return null;
52 byte[] bytes = _directory.getByteArray(PanasonicMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO);
53 return "(" + bytes.length + " bytes)";
54 }
55
56 public String getMacroModeDescription() throws MetadataException
57 {
58 if (!_directory.containsTag(PanasonicMakernoteDirectory.TAG_PANASONIC_MACRO_MODE)) return null;
59 int value = _directory.getInt(PanasonicMakernoteDirectory.TAG_PANASONIC_MACRO_MODE);
60 switch (value) {
61 case 1:
62 return "On";
63 case 2:
64 return "Off";
65 default:
66 return "Unknown (" + value + ")";
67 }
68 }
69
70 public String getRecordModeDescription() throws MetadataException
71 {
72 if (!_directory.containsTag(PanasonicMakernoteDirectory.TAG_PANASONIC_RECORD_MODE)) return null;
73 int value = _directory.getInt(PanasonicMakernoteDirectory.TAG_PANASONIC_RECORD_MODE);
74 switch (value) {
75 case 1:
76 return "Normal";
77 case 2:
78 return "Portrait";
79 case 9:
80 return "Macro";
81 default:
82 return "Unknown (" + value + ")";
83 }
84 }
85}
Note: See TracBrowser for help on using the repository browser.