source: josm/trunk/src/com/drew/metadata/exif/makernotes/PanasonicMakernoteDirectory.java@ 13061

Last change on this file since 13061 was 13061, checked in by Don-vip, 7 years ago

fix #15505 - update to metadata-extractor 2.10.1

File size: 26.6 KB
Line 
1/*
2 * Copyright 2002-2017 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 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21package com.drew.metadata.exif.makernotes;
22
23import com.drew.lang.ByteArrayReader;
24import com.drew.lang.RandomAccessReader;
25import com.drew.lang.annotations.NotNull;
26import com.drew.lang.annotations.Nullable;
27import com.drew.metadata.Age;
28import com.drew.metadata.Directory;
29import com.drew.metadata.Face;
30
31import java.io.IOException;
32import java.util.HashMap;
33
34/**
35 * Describes tags specific to Panasonic and Leica cameras.
36 *
37 * @author Drew Noakes https://drewnoakes.com
38 * @author Philipp Sandhaus
39 */
40@SuppressWarnings("WeakerAccess")
41public class PanasonicMakernoteDirectory extends Directory
42{
43
44 /**
45 * <br>
46 * 2 = High <br>
47 * 3 = Normal <br>
48 * 6 = Very High <br>
49 * 7 = Raw <br>
50 * 9 = Motion Picture <br>
51 */
52 public static final int TAG_QUALITY_MODE = 0x0001;
53 public static final int TAG_FIRMWARE_VERSION = 0x0002;
54
55 /**
56 * <br>
57 * 1 = Auto <br>
58 * 2 = Daylight <br>
59 * 3 = Cloudy <br>
60 * 4 = Incandescent <br>
61 * 5 = Manual <br>
62 * 8 = Flash <br>
63 * 10 = Black &amp; White <br>
64 * 11 = Manual <br>
65 * 12 = Shade <br>
66 */
67 public static final int TAG_WHITE_BALANCE = 0x0003;
68
69
70 /**
71 * <br>
72 * 1 = Auto <br>
73 * 2 = Manual <br>
74 * 4 = Auto, Focus Button <br>
75 * 5 = Auto, Continuous <br>
76 */
77 public static final int TAG_FOCUS_MODE = 0x0007;
78
79 /**
80 * <br>
81 * 2 bytes <br>
82 * (DMC-FZ10) <br>
83 * '0 1' = Spot Mode On <br>
84 * '0 16' = Spot Mode Off <br>
85 * '(other models) <br>
86 * 16 = Normal? <br>
87 * '0 1' = 9-area <br>
88 * '0 16' = 3-area (high speed) <br>
89 * '1 0' = Spot Focusing <br>
90 * '1 1' = 5-area <br>
91 * '16 0' = 1-area <br>
92 * '16 16' = 1-area (high speed) <br>
93 * '32 0' = Auto or Face Detect <br>
94 * '32 1' = 3-area (left)? <br>
95 * '32 2' = 3-area (center)? <br>
96 * '32 3' = 3-area (right)? <br>
97 * '64 0' = Face Detect <br>
98 */
99 public static final int TAG_AF_AREA_MODE = 0x000f;
100
101 /**
102 * <br>
103 * 2 = On, Mode 1 <br>
104 * 3 = Off <br>
105 * 4 = On, Mode 2 <br>
106 */
107 public static final int TAG_IMAGE_STABILIZATION = 0x001a;
108
109 /**
110 * <br>
111 * 1 = On <br>
112 * 2 = Off <br>
113 */
114 public static final int TAG_MACRO_MODE = 0x001C;
115
116 /**
117 * <br>
118 * 1 = Normal <br>
119 * 2 = Portrait <br>
120 * 3 = Scenery <br>
121 * 4 = Sports <br>
122 * 5 = Night Portrait <br>
123 * 6 = Program <br>
124 * 7 = Aperture Priority <br>
125 * 8 = Shutter Priority <br>
126 * 9 = Macro <br>
127 * 10= Spot <br>
128 * 11= Manual <br>
129 * 12= Movie Preview <br>
130 * 13= Panning <br>
131 * 14= Simple <br>
132 * 15= Color Effects <br>
133 * 16= Self Portrait <br>
134 * 17= Economy <br>
135 * 18= Fireworks <br>
136 * 19= Party <br>
137 * 20= Snow <br>
138 * 21= Night Scenery <br>
139 * 22= Food <br>
140 * 23= Baby <br>
141 * 24= Soft Skin <br>
142 * 25= Candlelight <br>
143 * 26= Starry Night <br>
144 * 27= High Sensitivity <br>
145 * 28= Panorama Assist <br>
146 * 29= Underwater <br>
147 * 30= Beach <br>
148 * 31= Aerial Photo <br>
149 * 32= Sunset <br>
150 * 33= Pet <br>
151 * 34= Intelligent ISO <br>
152 * 35= Clipboard <br>
153 * 36= High Speed Continuous Shooting <br>
154 * 37= Intelligent Auto <br>
155 * 39= Multi-aspect <br>
156 * 41= Transform <br>
157 * 42= Flash Burst <br>
158 * 43= Pin Hole <br>
159 * 44= Film Grain <br>
160 * 45= My Color <br>
161 * 46= Photo Frame <br>
162 * 51= HDR <br>
163 */
164 public static final int TAG_RECORD_MODE = 0x001F;
165
166 /**
167 * 1 = Yes <br>
168 * 2 = No <br>
169 */
170 public static final int TAG_AUDIO = 0x0020;
171
172 /**
173 * No idea, what this is
174 */
175 public static final int TAG_UNKNOWN_DATA_DUMP = 0x0021;
176
177 public static final int TAG_EASY_MODE = 0x0022;
178 public static final int TAG_WHITE_BALANCE_BIAS = 0x0023;
179 public static final int TAG_FLASH_BIAS = 0x0024;
180
181 /**
182 * this number is unique, and contains the date of manufacture,
183 * but is not the same as the number printed on the camera body
184 */
185 public static final int TAG_INTERNAL_SERIAL_NUMBER = 0x0025;
186
187 /**
188 * Panasonic Exif Version
189 */
190 public static final int TAG_EXIF_VERSION = 0x0026;
191
192
193 /**
194 * 1 = Off <br>
195 * 2 = Warm <br>
196 * 3 = Cool <br>
197 * 4 = Black &amp; White <br>
198 * 5 = Sepia <br>
199 */
200 public static final int TAG_COLOR_EFFECT = 0x0028;
201
202 /**
203 * 4 Bytes <br>
204 * Time in 1/100 s from when the camera was powered on to when the
205 * image is written to memory card
206 */
207 public static final int TAG_UPTIME = 0x0029;
208
209
210 /**
211 * 0 = Off <br>
212 * 1 = On <br>
213 * 2 = Infinite <br>
214 * 4 = Unlimited <br>
215 */
216 public static final int TAG_BURST_MODE = 0x002a;
217
218 public static final int TAG_SEQUENCE_NUMBER = 0x002b;
219
220 /**
221 * (this decoding seems to work for some models such as the LC1, LX2, FZ7, FZ8, FZ18 and FZ50, but may not be correct for other models such as the FX10, G1, L1, L10 and LC80) <br>
222 * 0x0 = Normal <br>
223 * 0x1 = Low <br>
224 * 0x2 = High <br>
225 * 0x6 = Medium Low <br>
226 * 0x7 = Medium High <br>
227 * 0x100 = Low <br>
228 * 0x110 = Normal <br>
229 * 0x120 = High <br>
230 * (these values are used by the GF1) <br>
231 * 0 = -2 <br>
232 * 1 = -1 <br>
233 * 2 = Normal <br>
234 * 3 = +1 <br>
235 * 4 = +2 <br>
236 * 7 = Nature (Color Film) <br>
237 * 12 = Smooth (Color Film) or Pure (My Color) <br>
238 * 17 = Dynamic (B&amp;W Film) <br>
239 * 22 = Smooth (B&amp;W Film) <br>
240 * 27 = Dynamic (Color Film) <br>
241 * 32 = Vibrant (Color Film) or Expressive (My Color) <br>
242 * 33 = Elegant (My Color) <br>
243 * 37 = Nostalgic (Color Film) <br>
244 * 41 = Dynamic Art (My Color) <br>
245 * 42 = Retro (My Color) <br>
246 */
247 public static final int TAG_CONTRAST_MODE = 0x002c;
248
249
250 /**
251 * 0 = Standard <br>
252 * 1 = Low (-1) <br>
253 * 2 = High (+1) <br>
254 * 3 = Lowest (-2) <br>
255 * 4 = Highest (+2) <br>
256 */
257 public static final int TAG_NOISE_REDUCTION = 0x002d;
258
259 /**
260 * 1 = Off <br>
261 * 2 = 10 s <br>
262 * 3 = 2 s <br>
263 */
264 public static final int TAG_SELF_TIMER = 0x002e;
265
266 /**
267 * 1 = 0 DG <br>
268 * 3 = 180 DG <br>
269 * 6 = 90 DG <br>
270 * 8 = 270 DG <br>
271 */
272 public static final int TAG_ROTATION = 0x0030;
273
274 /**
275 * 1 = Fired <br>
276 * 2 = Enabled nut not used <br>
277 * 3 = Disabled but required <br>
278 * 4 = Disabled and not required
279 */
280 public static final int TAG_AF_ASSIST_LAMP = 0x0031;
281
282 /**
283 * 0 = Normal <br>
284 * 1 = Natural<br>
285 * 2 = Vivid
286 *
287 */
288 public static final int TAG_COLOR_MODE = 0x0032;
289
290 public static final int TAG_BABY_AGE = 0x0033;
291
292 /**
293 * 1 = Standard <br>
294 * 2 = Extended
295 */
296 public static final int TAG_OPTICAL_ZOOM_MODE = 0x0034;
297
298 /**
299 * 1 = Off <br>
300 * 2 = Wide <br>
301 * 3 = Telephoto <br>
302 * 4 = Macro
303 */
304 public static final int TAG_CONVERSION_LENS = 0x0035;
305
306 public static final int TAG_TRAVEL_DAY = 0x0036;
307
308 /**
309 * 0 = Normal
310 */
311 public static final int TAG_CONTRAST = 0x0039;
312
313 /**
314 * <br>
315 * 1 = Home <br>
316 * 2 = Destination
317 */
318 public static final int TAG_WORLD_TIME_LOCATION = 0x003a;
319
320 /**
321 * 1 = Off <br>
322 * 2 = On
323 */
324 public static final int TAG_TEXT_STAMP = 0x003b;
325
326 public static final int TAG_PROGRAM_ISO = 0x003c;
327
328 /**
329 * <br>
330 * 1 = Normal <br>
331 * 2 = Outdoor/Illuminations/Flower/HDR Art <br>
332 * 3 = Indoor/Architecture/Objects/HDR B&amp;W <br>
333 * 4 = Creative <br>
334 * 5 = Auto <br>
335 * 7 = Expressive <br>
336 * 8 = Retro <br>
337 * 9 = Pure <br>
338 * 10 = Elegant <br>
339 * 12 = Monochrome <br>
340 * 13 = Dynamic Art <br>
341 * 14 = Silhouette <br>
342 */
343 public static final int TAG_ADVANCED_SCENE_MODE = 0x003d;
344
345 /**
346 * 1 = Off <br>
347 * 2 = On
348 */
349 public static final int TAG_TEXT_STAMP_1 = 0x003e;
350
351 public static final int TAG_FACES_DETECTED = 0x003f;
352
353 public static final int TAG_SATURATION = 0x0040;
354 public static final int TAG_SHARPNESS = 0x0041;
355 public static final int TAG_FILM_MODE = 0x0042;
356
357 public static final int TAG_COLOR_TEMP_KELVIN = 0x0044;
358 public static final int TAG_BRACKET_SETTINGS = 0x0045;
359
360 /**
361 * WB adjust AB. Positive is a shift toward blue.
362 */
363 public static final int TAG_WB_ADJUST_AB = 0x0046;
364 /**
365 * WB adjust GM. Positive is a shift toward green.
366 */
367 public static final int TAG_WB_ADJUST_GM = 0x0047;
368
369 public static final int TAG_FLASH_CURTAIN = 0x0048;
370 public static final int TAG_LONG_EXPOSURE_NOISE_REDUCTION = 0x0049;
371
372 public static final int TAG_PANASONIC_IMAGE_WIDTH = 0x004b;
373 public static final int TAG_PANASONIC_IMAGE_HEIGHT = 0x004c;
374 public static final int TAG_AF_POINT_POSITION = 0x004d;
375
376
377 /**
378 * <br>
379 * Integer (16Bit) Indexes: <br>
380 * 0 Number Face Positions (maybe less than Faces Detected) <br>
381 * 1-4 Face Position 1 <br>
382 * 5-8 Face Position 2 <br>
383 * and so on <br>
384 * <br>
385 * The four Integers are interpreted as follows: <br>
386 * (XYWH) X,Y Center of Face, (W,H) Width and Height <br>
387 * All values are in respect to double the size of the thumbnail image <br>
388 *
389 */
390 public static final int TAG_FACE_DETECTION_INFO = 0x004e;
391 public static final int TAG_LENS_TYPE = 0x0051;
392 public static final int TAG_LENS_SERIAL_NUMBER = 0x0052;
393 public static final int TAG_ACCESSORY_TYPE = 0x0053;
394 public static final int TAG_ACCESSORY_SERIAL_NUMBER = 0x0054;
395
396 /**
397 * (decoded as two 16-bit signed integers)
398 * '-1 1' = Slim Low
399 * '-3 2' = Slim High
400 * '0 0' = Off
401 * '1 1' = Stretch Low
402 * '3 2' = Stretch High
403 */
404 public static final int TAG_TRANSFORM = 0x0059;
405
406 /**
407 * 0 = Off <br>
408 * 1 = Low <br>
409 * 2 = Standard <br>
410 * 3 = High
411 */
412 public static final int TAG_INTELLIGENT_EXPOSURE = 0x005d;
413
414 public static final int TAG_LENS_FIRMWARE_VERSION = 0x0060;
415 public static final int TAG_BURST_SPEED = 0x0077;
416 public static final int TAG_INTELLIGENT_D_RANGE = 0x0079;
417 public static final int TAG_CLEAR_RETOUCH = 0x007c;
418 public static final int TAG_CITY2 = 0x0080;
419 public static final int TAG_PHOTO_STYLE = 0x0089;
420 public static final int TAG_SHADING_COMPENSATION = 0x008a;
421
422 public static final int TAG_ACCELEROMETER_Z = 0x008c;
423 public static final int TAG_ACCELEROMETER_X = 0x008d;
424 public static final int TAG_ACCELEROMETER_Y = 0x008e;
425 public static final int TAG_CAMERA_ORIENTATION = 0x008f;
426 public static final int TAG_ROLL_ANGLE = 0x0090;
427 public static final int TAG_PITCH_ANGLE = 0x0091;
428 public static final int TAG_SWEEP_PANORAMA_DIRECTION = 0x0093;
429 public static final int TAG_SWEEP_PANORAMA_FIELD_OF_VIEW = 0x0094;
430 public static final int TAG_TIMER_RECORDING = 0x0096;
431
432 public static final int TAG_INTERNAL_ND_FILTER = 0x009d;
433 public static final int TAG_HDR = 0x009e;
434 public static final int TAG_SHUTTER_TYPE = 0x009f;
435
436 public static final int TAG_CLEAR_RETOUCH_VALUE = 0x00a3;
437 public static final int TAG_TOUCH_AE = 0x00ab;
438
439 /**
440 * Info at http://www.ozhiker.com/electronics/pjmt/jpeg_info/pim.html
441 */
442 public static final int TAG_PRINT_IMAGE_MATCHING_INFO = 0x0E00;
443
444 /**
445 * Byte Indexes: <br>
446 * 0 Int (2 Byte) Number of Recognized Faces <br>
447 * 4 String(20 Byte) Recognized Face 1 Name <br>
448 * 24 4 Int (8 Byte) Recognized Face 1 Position (Same Format as Face Detection) <br>
449 * 32 String(20 Byte) Recognized Face 1 Age <br>
450 * 52 String(20 Byte) Recognized Face 2 Name <br>
451 * 72 4 Int (8 Byte) Recognized Face 2 Position (Same Format as Face Detection) <br>
452 * 80 String(20 Byte) Recognized Face 2 Age <br>
453 * <br>
454 * And so on <br>
455 * <br>
456 * The four Integers are interpreted as follows: <br>
457 * (XYWH) X,Y Center of Face, (W,H) Width and Height <br>
458 * All values are in respect to double the size of the thumbnail image <br>
459 *
460 */
461 public static final int TAG_FACE_RECOGNITION_INFO = 0x0061;
462
463 /**
464 * 0 = No <br>
465 * 1 = Yes
466 */
467 public static final int TAG_FLASH_WARNING = 0x0062;
468 public static final int TAG_RECOGNIZED_FACE_FLAGS = 0x0063;
469 public static final int TAG_TITLE = 0x0065;
470 public static final int TAG_BABY_NAME = 0x0066;
471 public static final int TAG_LOCATION = 0x0067;
472 public static final int TAG_COUNTRY = 0x0069;
473 public static final int TAG_STATE = 0x006b;
474 public static final int TAG_CITY = 0x006d;
475 public static final int TAG_LANDMARK = 0x006f;
476
477 /**
478 * 0 = Off <br>
479 * 2 = Auto <br>
480 * 3 = On
481 */
482 public static final int TAG_INTELLIGENT_RESOLUTION = 0x0070;
483
484 public static final int TAG_MAKERNOTE_VERSION = 0x8000;
485 public static final int TAG_SCENE_MODE = 0x8001;
486 public static final int TAG_WB_RED_LEVEL = 0x8004;
487 public static final int TAG_WB_GREEN_LEVEL = 0x8005;
488 public static final int TAG_WB_BLUE_LEVEL = 0x8006;
489 public static final int TAG_FLASH_FIRED = 0x8007;
490 public static final int TAG_TEXT_STAMP_2 = 0x8008;
491 public static final int TAG_TEXT_STAMP_3 = 0x8009;
492 public static final int TAG_BABY_AGE_1 = 0x8010;
493
494 /**
495 * (decoded as two 16-bit signed integers)
496 * '-1 1' = Slim Low
497 * '-3 2' = Slim High
498 * '0 0' = Off
499 * '1 1' = Stretch Low
500 * '3 2' = Stretch High
501 */
502 public static final int TAG_TRANSFORM_1 = 0x8012;
503
504 @NotNull
505 protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>();
506
507 static
508 {
509 _tagNameMap.put(TAG_QUALITY_MODE, "Quality Mode");
510 _tagNameMap.put(TAG_FIRMWARE_VERSION, "Version");
511 _tagNameMap.put(TAG_WHITE_BALANCE, "White Balance");
512 _tagNameMap.put(TAG_FOCUS_MODE, "Focus Mode");
513 _tagNameMap.put(TAG_AF_AREA_MODE, "AF Area Mode");
514 _tagNameMap.put(TAG_IMAGE_STABILIZATION, "Image Stabilization");
515 _tagNameMap.put(TAG_MACRO_MODE, "Macro Mode");
516 _tagNameMap.put(TAG_RECORD_MODE, "Record Mode");
517 _tagNameMap.put(TAG_AUDIO, "Audio");
518 _tagNameMap.put(TAG_INTERNAL_SERIAL_NUMBER, "Internal Serial Number");
519 _tagNameMap.put(TAG_UNKNOWN_DATA_DUMP, "Unknown Data Dump");
520 _tagNameMap.put(TAG_EASY_MODE, "Easy Mode");
521 _tagNameMap.put(TAG_WHITE_BALANCE_BIAS, "White Balance Bias");
522 _tagNameMap.put(TAG_FLASH_BIAS, "Flash Bias");
523 _tagNameMap.put(TAG_EXIF_VERSION, "Exif Version");
524 _tagNameMap.put(TAG_COLOR_EFFECT, "Color Effect");
525 _tagNameMap.put(TAG_UPTIME, "Camera Uptime");
526 _tagNameMap.put(TAG_BURST_MODE, "Burst Mode");
527 _tagNameMap.put(TAG_SEQUENCE_NUMBER, "Sequence Number");
528 _tagNameMap.put(TAG_CONTRAST_MODE, "Contrast Mode");
529 _tagNameMap.put(TAG_NOISE_REDUCTION, "Noise Reduction");
530 _tagNameMap.put(TAG_SELF_TIMER, "Self Timer");
531 _tagNameMap.put(TAG_ROTATION, "Rotation");
532 _tagNameMap.put(TAG_AF_ASSIST_LAMP, "AF Assist Lamp");
533 _tagNameMap.put(TAG_COLOR_MODE, "Color Mode");
534 _tagNameMap.put(TAG_BABY_AGE, "Baby Age");
535 _tagNameMap.put(TAG_OPTICAL_ZOOM_MODE, "Optical Zoom Mode");
536 _tagNameMap.put(TAG_CONVERSION_LENS, "Conversion Lens");
537 _tagNameMap.put(TAG_TRAVEL_DAY, "Travel Day");
538 _tagNameMap.put(TAG_CONTRAST, "Contrast");
539 _tagNameMap.put(TAG_WORLD_TIME_LOCATION, "World Time Location");
540 _tagNameMap.put(TAG_TEXT_STAMP, "Text Stamp");
541 _tagNameMap.put(TAG_PROGRAM_ISO, "Program ISO");
542 _tagNameMap.put(TAG_ADVANCED_SCENE_MODE, "Advanced Scene Mode");
543 _tagNameMap.put(TAG_PRINT_IMAGE_MATCHING_INFO, "Print Image Matching (PIM) Info");
544 _tagNameMap.put(TAG_FACES_DETECTED, "Number of Detected Faces");
545 _tagNameMap.put(TAG_SATURATION, "Saturation");
546 _tagNameMap.put(TAG_SHARPNESS, "Sharpness");
547 _tagNameMap.put(TAG_FILM_MODE, "Film Mode");
548 _tagNameMap.put(TAG_COLOR_TEMP_KELVIN, "Color Temp Kelvin");
549 _tagNameMap.put(TAG_BRACKET_SETTINGS, "Bracket Settings");
550 _tagNameMap.put(TAG_WB_ADJUST_AB, "White Balance Adjust (AB)");
551 _tagNameMap.put(TAG_WB_ADJUST_GM, "White Balance Adjust (GM)");
552
553 _tagNameMap.put(TAG_FLASH_CURTAIN, "Flash Curtain");
554 _tagNameMap.put(TAG_LONG_EXPOSURE_NOISE_REDUCTION, "Long Exposure Noise Reduction");
555 _tagNameMap.put(TAG_PANASONIC_IMAGE_WIDTH, "Panasonic Image Width");
556 _tagNameMap.put(TAG_PANASONIC_IMAGE_HEIGHT, "Panasonic Image Height");
557
558 _tagNameMap.put(TAG_AF_POINT_POSITION, "Af Point Position");
559 _tagNameMap.put(TAG_FACE_DETECTION_INFO, "Face Detection Info");
560 _tagNameMap.put(TAG_LENS_TYPE, "Lens Type");
561 _tagNameMap.put(TAG_LENS_SERIAL_NUMBER, "Lens Serial Number");
562 _tagNameMap.put(TAG_ACCESSORY_TYPE, "Accessory Type");
563 _tagNameMap.put(TAG_ACCESSORY_SERIAL_NUMBER, "Accessory Serial Number");
564 _tagNameMap.put(TAG_TRANSFORM, "Transform");
565 _tagNameMap.put(TAG_INTELLIGENT_EXPOSURE, "Intelligent Exposure");
566 _tagNameMap.put(TAG_LENS_FIRMWARE_VERSION, "Lens Firmware Version");
567 _tagNameMap.put(TAG_FACE_RECOGNITION_INFO, "Face Recognition Info");
568 _tagNameMap.put(TAG_FLASH_WARNING, "Flash Warning");
569 _tagNameMap.put(TAG_RECOGNIZED_FACE_FLAGS, "Recognized Face Flags");
570 _tagNameMap.put(TAG_TITLE, "Title");
571 _tagNameMap.put(TAG_BABY_NAME, "Baby Name");
572 _tagNameMap.put(TAG_LOCATION, "Location");
573 _tagNameMap.put(TAG_COUNTRY, "Country");
574 _tagNameMap.put(TAG_STATE, "State");
575 _tagNameMap.put(TAG_CITY, "City");
576 _tagNameMap.put(TAG_LANDMARK, "Landmark");
577 _tagNameMap.put(TAG_INTELLIGENT_RESOLUTION, "Intelligent Resolution");
578 _tagNameMap.put(TAG_BURST_SPEED, "Burst Speed");
579 _tagNameMap.put(TAG_INTELLIGENT_D_RANGE, "Intelligent D-Range");
580 _tagNameMap.put(TAG_CLEAR_RETOUCH, "Clear Retouch");
581 _tagNameMap.put(TAG_CITY2, "City 2");
582 _tagNameMap.put(TAG_PHOTO_STYLE, "Photo Style");
583 _tagNameMap.put(TAG_SHADING_COMPENSATION, "Shading Compensation");
584
585 _tagNameMap.put(TAG_ACCELEROMETER_Z, "Accelerometer Z");
586 _tagNameMap.put(TAG_ACCELEROMETER_X, "Accelerometer X");
587 _tagNameMap.put(TAG_ACCELEROMETER_Y, "Accelerometer Y");
588 _tagNameMap.put(TAG_CAMERA_ORIENTATION, "Camera Orientation");
589 _tagNameMap.put(TAG_ROLL_ANGLE, "Roll Angle");
590 _tagNameMap.put(TAG_PITCH_ANGLE, "Pitch Angle");
591 _tagNameMap.put(TAG_SWEEP_PANORAMA_DIRECTION, "Sweep Panorama Direction");
592 _tagNameMap.put(TAG_SWEEP_PANORAMA_FIELD_OF_VIEW, "Sweep Panorama Field Of View");
593 _tagNameMap.put(TAG_TIMER_RECORDING, "Timer Recording");
594
595 _tagNameMap.put(TAG_INTERNAL_ND_FILTER, "Internal ND Filter");
596 _tagNameMap.put(TAG_HDR, "HDR");
597 _tagNameMap.put(TAG_SHUTTER_TYPE, "Shutter Type");
598 _tagNameMap.put(TAG_CLEAR_RETOUCH_VALUE, "Clear Retouch Value");
599 _tagNameMap.put(TAG_TOUCH_AE, "Touch AE");
600
601 _tagNameMap.put(TAG_MAKERNOTE_VERSION, "Makernote Version");
602 _tagNameMap.put(TAG_SCENE_MODE, "Scene Mode");
603 _tagNameMap.put(TAG_WB_RED_LEVEL, "White Balance (Red)");
604 _tagNameMap.put(TAG_WB_GREEN_LEVEL, "White Balance (Green)");
605 _tagNameMap.put(TAG_WB_BLUE_LEVEL, "White Balance (Blue)");
606 _tagNameMap.put(TAG_FLASH_FIRED, "Flash Fired");
607 _tagNameMap.put(TAG_TEXT_STAMP_1, "Text Stamp 1");
608 _tagNameMap.put(TAG_TEXT_STAMP_2, "Text Stamp 2");
609 _tagNameMap.put(TAG_TEXT_STAMP_3, "Text Stamp 3");
610 _tagNameMap.put(TAG_BABY_AGE_1, "Baby Age 1");
611 _tagNameMap.put(TAG_TRANSFORM_1, "Transform 1");
612 }
613
614 public PanasonicMakernoteDirectory()
615 {
616 this.setDescriptor(new PanasonicMakernoteDescriptor(this));
617 }
618
619 @Override
620 @NotNull
621 public String getName()
622 {
623 return "Panasonic Makernote";
624 }
625
626 @Override
627 @NotNull
628 protected HashMap<Integer, String> getTagNameMap()
629 {
630 return _tagNameMap;
631 }
632
633 @Nullable
634 public Face[] getDetectedFaces()
635 {
636 byte[] bytes = getByteArray(TAG_FACE_DETECTION_INFO);
637 if (bytes==null)
638 return null;
639
640 RandomAccessReader reader = new ByteArrayReader(bytes);
641 reader.setMotorolaByteOrder(false);
642
643 try {
644 int faceCount = reader.getUInt16(0);
645 if (faceCount==0)
646 return null;
647 Face[] faces = new Face[faceCount];
648
649 for (int i = 0; i < faceCount; i++) {
650 int offset = 2 + i * 8;
651 faces[i] = new Face(
652 reader.getUInt16(offset),
653 reader.getUInt16(offset + 2),
654 reader.getUInt16(offset + 4),
655 reader.getUInt16(offset + 6)
656 , null, null);
657 }
658 return faces;
659 } catch (IOException e) {
660 return null;
661 }
662 }
663
664 @Nullable
665 public Face[] getRecognizedFaces()
666 {
667 byte[] bytes = getByteArray(TAG_FACE_RECOGNITION_INFO);
668 if (bytes == null)
669 return null;
670
671 RandomAccessReader reader = new ByteArrayReader(bytes);
672 reader.setMotorolaByteOrder(false);
673
674 try {
675 int faceCount = reader.getUInt16(0);
676 if (faceCount==0)
677 return null;
678 Face[] faces = new Face[faceCount];
679
680 for (int i = 0; i < faceCount; i++) {
681 int offset = 4 + i * 44;
682 String name = reader.getString(offset, 20, "ASCII").trim();
683 String age = reader.getString(offset + 28, 20, "ASCII").trim();
684 faces[i] = new Face(
685 reader.getUInt16(offset + 20),
686 reader.getUInt16(offset + 22),
687 reader.getUInt16(offset + 24),
688 reader.getUInt16(offset + 26),
689 name,
690 Age.fromPanasonicString(age));
691 }
692 return faces;
693 } catch (IOException e) {
694 return null;
695 }
696 }
697
698 /**
699 * Attempts to convert the underlying string value (as stored in the directory) into an Age object.
700 * @param tag The tag identifier.
701 * @return The parsed Age object, or null if the tag was empty of the value unable to be parsed.
702 */
703 @Nullable
704 public Age getAge(int tag)
705 {
706 final String ageString = getString(tag);
707 if (ageString==null)
708 return null;
709 return Age.fromPanasonicString(ageString);
710 }
711}
Note: See TracBrowser for help on using the repository browser.