source: josm/trunk/src/com/drew/metadata/exif/OlympusMakernoteDescriptor.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: 5.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 an OlympusMakernoteDirectory.
23 */
24public class OlympusMakernoteDescriptor extends TagDescriptor
25{
26 public OlympusMakernoteDescriptor(Directory directory)
27 {
28 super(directory);
29 }
30
31 public String getDescription(int tagType) throws MetadataException
32 {
33 switch (tagType) {
34 case OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE:
35 return getSpecialModeDescription();
36 case OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY:
37 return getJpegQualityDescription();
38 case OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE:
39 return getMacroModeDescription();
40 case OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO:
41 return getDigiZoomRatioDescription();
42 default:
43 return _directory.getString(tagType);
44 }
45 }
46
47 public String getDigiZoomRatioDescription() throws MetadataException
48 {
49 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO)) return null;
50 int value = _directory.getInt(OlympusMakernoteDirectory.TAG_OLYMPUS_DIGI_ZOOM_RATIO);
51 switch (value) {
52 case 0:
53 return "Normal";
54 case 2:
55 return "Digital 2x Zoom";
56 default:
57 return "Unknown (" + value + ")";
58 }
59 }
60
61 public String getMacroModeDescription() throws MetadataException
62 {
63 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE)) return null;
64 int value = _directory.getInt(OlympusMakernoteDirectory.TAG_OLYMPUS_MACRO_MODE);
65 switch (value) {
66 case 0:
67 return "Normal (no macro)";
68 case 1:
69 return "Macro";
70 default:
71 return "Unknown (" + value + ")";
72 }
73 }
74
75 public String getJpegQualityDescription() throws MetadataException
76 {
77 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY)) return null;
78 int value = _directory.getInt(OlympusMakernoteDirectory.TAG_OLYMPUS_JPEG_QUALITY);
79 switch (value) {
80 case 1:
81 return "SQ";
82 case 2:
83 return "HQ";
84 case 3:
85 return "SHQ";
86 default:
87 return "Unknown (" + value + ")";
88 }
89 }
90
91 public String getSpecialModeDescription() throws MetadataException
92 {
93 if (!_directory.containsTag(OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE)) return null;
94 int[] values = _directory.getIntArray(OlympusMakernoteDirectory.TAG_OLYMPUS_SPECIAL_MODE);
95 StringBuffer desc = new StringBuffer();
96 switch (values[0]) {
97 case 0:
98 desc.append("Normal picture taking mode");
99 break;
100 case 1:
101 desc.append("Unknown picture taking mode");
102 break;
103 case 2:
104 desc.append("Fast picture taking mode");
105 break;
106 case 3:
107 desc.append("Panorama picture taking mode");
108 break;
109 default:
110 desc.append("Unknown picture taking mode");
111 break;
112 }
113 desc.append(" - ");
114 switch (values[1]) {
115 case 0:
116 desc.append("Unknown sequence number");
117 break;
118 case 1:
119 desc.append("1st in a sequnce");
120 break;
121 case 2:
122 desc.append("2nd in a sequence");
123 break;
124 case 3:
125 desc.append("3rd in a sequence");
126 break;
127 default:
128 desc.append(values[1]);
129 desc.append("th in a sequence");
130 break;
131 }
132 switch (values[2]) {
133 case 1:
134 desc.append("Left to right panorama direction");
135 break;
136 case 2:
137 desc.append("Right to left panorama direction");
138 break;
139 case 3:
140 desc.append("Bottom to top panorama direction");
141 break;
142 case 4:
143 desc.append("Top to bottom panorama direction");
144 break;
145 }
146 return desc.toString();
147 }
148}
Note: See TracBrowser for help on using the repository browser.