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

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

fix #11162 - update to metadata-extractor 2.7.2

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