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

Last change on this file since 8564 was 8243, checked in by Don-vip, 11 years ago

fix #11359 - update to metadata-extractor 2.8.1

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