1 | #------------------------------------------------------------------------------
|
---|
2 | # File: Sanyo.pm
|
---|
3 | #
|
---|
4 | # Description: Sanyo EXIF maker notes tags
|
---|
5 | #
|
---|
6 | # Revisions: 04/06/2004 - P. Harvey Created
|
---|
7 | #
|
---|
8 | # Reference: http://www.exif.org/makernotes/SanyoMakerNote.html
|
---|
9 | #------------------------------------------------------------------------------
|
---|
10 |
|
---|
11 | package Image::ExifTool::Sanyo;
|
---|
12 |
|
---|
13 | use strict;
|
---|
14 | use vars qw($VERSION);
|
---|
15 | use Image::ExifTool::Exif;
|
---|
16 |
|
---|
17 | $VERSION = '1.14';
|
---|
18 |
|
---|
19 | my %offOn = (
|
---|
20 | 0 => 'Off',
|
---|
21 | 1 => 'On',
|
---|
22 | );
|
---|
23 |
|
---|
24 | %Image::ExifTool::Sanyo::Main = (
|
---|
25 | WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
|
---|
26 | CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
|
---|
27 | WRITABLE => 1,
|
---|
28 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
29 | 0x00ff => {
|
---|
30 | # this is an absolute offset in the JPG file... odd - PH
|
---|
31 | Name => 'MakerNoteOffset',
|
---|
32 | Writable => 'int32u',
|
---|
33 | },
|
---|
34 | 0x0100 => {
|
---|
35 | Name => 'SanyoThumbnail',
|
---|
36 | Writable => 'undef',
|
---|
37 | WriteCheck => '$self->CheckImage(\$val)',
|
---|
38 | RawConv => '$self->ValidateImage(\$val,$tag)',
|
---|
39 | },
|
---|
40 | 0x0200 => {
|
---|
41 | Name => 'SpecialMode',
|
---|
42 | Writable => 'int32u',
|
---|
43 | Count => 3,
|
---|
44 | },
|
---|
45 | 0x0201 => {
|
---|
46 | Name => 'SanyoQuality',
|
---|
47 | Flags => 'PrintHex',
|
---|
48 | Writable => 'int16u',
|
---|
49 | PrintConv => {
|
---|
50 | 0x0000 => 'Normal/Very Low',
|
---|
51 | 0x0001 => 'Normal/Low',
|
---|
52 | 0x0002 => 'Normal/Medium Low',
|
---|
53 | 0x0003 => 'Normal/Medium',
|
---|
54 | 0x0004 => 'Normal/Medium High',
|
---|
55 | 0x0005 => 'Normal/High',
|
---|
56 | 0x0006 => 'Normal/Very High',
|
---|
57 | 0x0007 => 'Normal/Super High',
|
---|
58 | # have seen 0x11 with HD2000 in '8M-H JPEG' mode - PH
|
---|
59 | 0x0100 => 'Fine/Very Low',
|
---|
60 | 0x0101 => 'Fine/Low',
|
---|
61 | 0x0102 => 'Fine/Medium Low',
|
---|
62 | 0x0103 => 'Fine/Medium',
|
---|
63 | 0x0104 => 'Fine/Medium High',
|
---|
64 | 0x0105 => 'Fine/High',
|
---|
65 | 0x0106 => 'Fine/Very High',
|
---|
66 | 0x0107 => 'Fine/Super High',
|
---|
67 | 0x0200 => 'Super Fine/Very Low',
|
---|
68 | 0x0201 => 'Super Fine/Low',
|
---|
69 | 0x0202 => 'Super Fine/Medium Low',
|
---|
70 | 0x0203 => 'Super Fine/Medium',
|
---|
71 | 0x0204 => 'Super Fine/Medium High',
|
---|
72 | 0x0205 => 'Super Fine/High',
|
---|
73 | 0x0206 => 'Super Fine/Very High',
|
---|
74 | 0x0207 => 'Super Fine/Super High',
|
---|
75 | },
|
---|
76 | },
|
---|
77 | 0x0202 => {
|
---|
78 | Name => 'Macro',
|
---|
79 | Writable => 'int16u',
|
---|
80 | PrintConv => {
|
---|
81 | 0 => 'Normal',
|
---|
82 | 1 => 'Macro',
|
---|
83 | 2 => 'View',
|
---|
84 | 3 => 'Manual',
|
---|
85 | },
|
---|
86 | },
|
---|
87 | 0x0204 => {
|
---|
88 | Name => 'DigitalZoom',
|
---|
89 | Writable => 'rational64u',
|
---|
90 | },
|
---|
91 | 0x0207 => 'SoftwareVersion',
|
---|
92 | 0x0208 => 'PictInfo',
|
---|
93 | 0x0209 => 'CameraID',
|
---|
94 | 0x020e => {
|
---|
95 | Name => 'SequentialShot',
|
---|
96 | Writable => 'int16u',
|
---|
97 | PrintConv => {
|
---|
98 | 0 => 'None',
|
---|
99 | 1 => 'Standard',
|
---|
100 | 2 => 'Best',
|
---|
101 | 3 => 'Adjust Exposure',
|
---|
102 | },
|
---|
103 | },
|
---|
104 | 0x020f => {
|
---|
105 | Name => 'WideRange',
|
---|
106 | Writable => 'int16u',
|
---|
107 | PrintConv => \%offOn,
|
---|
108 | },
|
---|
109 | 0x0210 => {
|
---|
110 | Name => 'ColorAdjustmentMode',
|
---|
111 | Writable => 'int16u',
|
---|
112 | PrintConv => \%offOn,
|
---|
113 | },
|
---|
114 | 0x0213 => {
|
---|
115 | Name => 'QuickShot',
|
---|
116 | Writable => 'int16u',
|
---|
117 | PrintConv => \%offOn,
|
---|
118 | },
|
---|
119 | 0x0214 => {
|
---|
120 | Name => 'SelfTimer',
|
---|
121 | Writable => 'int16u',
|
---|
122 | PrintConv => \%offOn,
|
---|
123 | },
|
---|
124 | # 0x0215 - Flash?
|
---|
125 | 0x0216 => {
|
---|
126 | Name => 'VoiceMemo',
|
---|
127 | Writable => 'int16u',
|
---|
128 | PrintConv => \%offOn,
|
---|
129 | },
|
---|
130 | 0x0217 => {
|
---|
131 | Name => 'RecordShutterRelease',
|
---|
132 | Writable => 'int16u',
|
---|
133 | PrintConv => {
|
---|
134 | 0 => 'Record while down',
|
---|
135 | 1 => 'Press start, press stop',
|
---|
136 | },
|
---|
137 | },
|
---|
138 | 0x0218 => {
|
---|
139 | Name => 'FlickerReduce',
|
---|
140 | Writable => 'int16u',
|
---|
141 | PrintConv => \%offOn,
|
---|
142 | },
|
---|
143 | 0x0219 => {
|
---|
144 | Name => 'OpticalZoomOn',
|
---|
145 | Writable => 'int16u',
|
---|
146 | PrintConv => \%offOn,
|
---|
147 | },
|
---|
148 | 0x021b => {
|
---|
149 | Name => 'DigitalZoomOn',
|
---|
150 | Writable => 'int16u',
|
---|
151 | PrintConv => \%offOn,
|
---|
152 | },
|
---|
153 | 0x021d => {
|
---|
154 | Name => 'LightSourceSpecial',
|
---|
155 | Writable => 'int16u',
|
---|
156 | PrintConv => \%offOn,
|
---|
157 | },
|
---|
158 | 0x021e => {
|
---|
159 | Name => 'Resaved',
|
---|
160 | Writable => 'int16u',
|
---|
161 | PrintConv => {
|
---|
162 | 0 => 'No',
|
---|
163 | 1 => 'Yes',
|
---|
164 | },
|
---|
165 | },
|
---|
166 | 0x021f => {
|
---|
167 | Name => 'SceneSelect',
|
---|
168 | Writable => 'int16u',
|
---|
169 | PrintConv => {
|
---|
170 | 0 => 'Off',
|
---|
171 | 1 => 'Sport',
|
---|
172 | 2 => 'TV',
|
---|
173 | 3 => 'Night',
|
---|
174 | 4 => 'User 1',
|
---|
175 | 5 => 'User 2',
|
---|
176 | 6 => 'Lamp', #PH
|
---|
177 | },
|
---|
178 | },
|
---|
179 | 0x0223 => [
|
---|
180 | {
|
---|
181 | Name => 'ManualFocusDistance',
|
---|
182 | Condition => '$format eq "rational64u"',
|
---|
183 | Writable => 'rational64u',
|
---|
184 | }, { #PH
|
---|
185 | Name => 'FaceInfo',
|
---|
186 | SubDirectory => { TagTable => 'Image::ExifTool::Sanyo::FaceInfo' },
|
---|
187 | },
|
---|
188 | ],
|
---|
189 | 0x0224 => {
|
---|
190 | Name => 'SequenceShotInterval',
|
---|
191 | Writable => 'int16u',
|
---|
192 | PrintConv => {
|
---|
193 | 0 => '5 frames/s',
|
---|
194 | 1 => '10 frames/s',
|
---|
195 | 2 => '15 frames/s',
|
---|
196 | 3 => '20 frames/s',
|
---|
197 | },
|
---|
198 | },
|
---|
199 | 0x0225 => {
|
---|
200 | Name => 'FlashMode',
|
---|
201 | Writable => 'int16u',
|
---|
202 | PrintConv => {
|
---|
203 | 0 => 'Auto',
|
---|
204 | 1 => 'Force',
|
---|
205 | 2 => 'Disabled',
|
---|
206 | 3 => 'Red eye',
|
---|
207 | },
|
---|
208 | },
|
---|
209 | 0x0e00 => {
|
---|
210 | Name => 'PrintIM',
|
---|
211 | Description => 'Print Image Matching',
|
---|
212 | Writable => 0,
|
---|
213 | SubDirectory => {
|
---|
214 | TagTable => 'Image::ExifTool::PrintIM::Main',
|
---|
215 | },
|
---|
216 | },
|
---|
217 | 0x0f00 => {
|
---|
218 | Name => 'DataDump',
|
---|
219 | Writable => 0,
|
---|
220 | Binary => 1,
|
---|
221 | },
|
---|
222 | );
|
---|
223 |
|
---|
224 | # face detection information (ref PH)
|
---|
225 | %Image::ExifTool::Sanyo::FaceInfo = (
|
---|
226 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
227 | WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
|
---|
228 | CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
|
---|
229 | GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
|
---|
230 | WRITABLE => 1,
|
---|
231 | FORMAT => 'int32u',
|
---|
232 | FIRST_ENTRY => 0,
|
---|
233 | 0 => 'FacesDetected',
|
---|
234 | 4 => {
|
---|
235 | Name => 'FacePosition',
|
---|
236 | Format => 'int32u[4]',
|
---|
237 | Notes => q{
|
---|
238 | left, top, right and bottom coordinates of detected face in an unrotated
|
---|
239 | 640-pixel-wide image, with increasing Y downwards
|
---|
240 | },
|
---|
241 | },
|
---|
242 | );
|
---|
243 |
|
---|
244 | # tags in Sanyo MOV videos (PH - observations from an E6 sample)
|
---|
245 | # (similar information in Kodak,Minolta,Nikon,Olympus,Pentax and Sanyo videos)
|
---|
246 | %Image::ExifTool::Sanyo::MOV = (
|
---|
247 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
248 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
249 | NOTES => 'This information is found in Sanyo MOV videos.',
|
---|
250 | 0x00 => {
|
---|
251 | Name => 'Make',
|
---|
252 | Format => 'string[24]',
|
---|
253 | },
|
---|
254 | 0x18 => {
|
---|
255 | Name => 'Model',
|
---|
256 | Description => 'Camera Model Name',
|
---|
257 | Format => 'string[8]',
|
---|
258 | },
|
---|
259 | # (01 00 at offset 0x20)
|
---|
260 | 0x26 => {
|
---|
261 | Name => 'ExposureTime',
|
---|
262 | Format => 'int32u',
|
---|
263 | ValueConv => '$val ? 10 / $val : 0',
|
---|
264 | PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
|
---|
265 | },
|
---|
266 | 0x2a => {
|
---|
267 | Name => 'FNumber',
|
---|
268 | Format => 'int32u',
|
---|
269 | ValueConv => '$val / 10',
|
---|
270 | PrintConv => 'sprintf("%.1f",$val)',
|
---|
271 | },
|
---|
272 | 0x32 => {
|
---|
273 | Name => 'ExposureCompensation',
|
---|
274 | Format => 'int32s',
|
---|
275 | ValueConv => '$val / 10',
|
---|
276 | PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
|
---|
277 | },
|
---|
278 | 0x44 => {
|
---|
279 | Name => 'WhiteBalance',
|
---|
280 | Format => 'int16u',
|
---|
281 | PrintConv => {
|
---|
282 | 0 => 'Auto',
|
---|
283 | 1 => 'Daylight',
|
---|
284 | 2 => 'Shade',
|
---|
285 | 3 => 'Fluorescent', #2
|
---|
286 | 4 => 'Tungsten',
|
---|
287 | 5 => 'Manual',
|
---|
288 | },
|
---|
289 | },
|
---|
290 | 0x48 => {
|
---|
291 | Name => 'FocalLength',
|
---|
292 | Format => 'int32u',
|
---|
293 | ValueConv => '$val / 10',
|
---|
294 | PrintConv => 'sprintf("%.1f mm",$val)',
|
---|
295 | },
|
---|
296 | );
|
---|
297 |
|
---|
298 | # tags in Sanyo MP4 videos (PH - from C4, C5 and HD1A samples)
|
---|
299 | # --> very similar to Samsung MP4 information
|
---|
300 | # (there is still a lot more information here that could be decoded!)
|
---|
301 | %Image::ExifTool::Sanyo::MP4 = (
|
---|
302 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
303 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
304 | NOTES => 'This information is found in Sanyo MP4 videos.',
|
---|
305 | 0x00 => {
|
---|
306 | Name => 'Make',
|
---|
307 | Format => 'string[5]',
|
---|
308 | PrintConv => 'ucfirst(lc($val))',
|
---|
309 | },
|
---|
310 | 0x18 => {
|
---|
311 | Name => 'Model',
|
---|
312 | Description => 'Camera Model Name',
|
---|
313 | Format => 'string[8]',
|
---|
314 | },
|
---|
315 | # (01 00 at offset 0x28)
|
---|
316 | # (0x2e has values 0x31, 0x33 and 0x3c in my samples, but
|
---|
317 | # some of the shutter speeds should be around 1/500 or so)
|
---|
318 | 0x32 => {
|
---|
319 | Name => 'FNumber',
|
---|
320 | Format => 'rational64u',
|
---|
321 | PrintConv => 'sprintf("%.1f",$val)',
|
---|
322 | },
|
---|
323 | 0x3a => { # (NC)
|
---|
324 | Name => 'ExposureCompensation',
|
---|
325 | Format => 'rational64s',
|
---|
326 | PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
|
---|
327 | },
|
---|
328 | 0x6a => {
|
---|
329 | Name => 'ISO',
|
---|
330 | Format => 'int32u',
|
---|
331 | },
|
---|
332 | 0xd1 => {
|
---|
333 | Name => 'Software',
|
---|
334 | Notes => 'these tags are shifted up by 1 byte for some models like the HD1A',
|
---|
335 | Format => 'undef[32]',
|
---|
336 | RawConv => q{
|
---|
337 | $val =~ /^SANYO/ or return undef;
|
---|
338 | $val =~ tr/\0//d;
|
---|
339 | $$self{SanyoSledder0xd1} = 1;
|
---|
340 | return $val;
|
---|
341 | },
|
---|
342 | },
|
---|
343 | 0xd2 => {
|
---|
344 | Name => 'Software',
|
---|
345 | Format => 'undef[32]',
|
---|
346 | RawConv => q{
|
---|
347 | $val =~ /^SANYO/ or return undef;
|
---|
348 | $val =~ tr/\0//d;
|
---|
349 | $$self{SanyoSledder0xd2} = 1;
|
---|
350 | return $val;
|
---|
351 | },
|
---|
352 | },
|
---|
353 | 0xfd => {
|
---|
354 | Name => 'ThumbnailLength',
|
---|
355 | Condition => '$$self{SanyoSledder0xd1}',
|
---|
356 | Format => 'int32u',
|
---|
357 | },
|
---|
358 | 0xfe => {
|
---|
359 | Name => 'ThumbnailLength',
|
---|
360 | Condition => '$$self{SanyoSledder0xd2}',
|
---|
361 | Format => 'int32u',
|
---|
362 | },
|
---|
363 | 0x101 => {
|
---|
364 | Name => 'ThumbnailOffset',
|
---|
365 | Condition => '$$self{SanyoSledder0xd1}',
|
---|
366 | IsOffset => 1,
|
---|
367 | Format => 'int32u',
|
---|
368 | RawConv => '$val + 0xf1',
|
---|
369 | },
|
---|
370 | 0x102 => {
|
---|
371 | Name => 'ThumbnailOffset',
|
---|
372 | Condition => '$$self{SanyoSledder0xd2}',
|
---|
373 | IsOffset => 1,
|
---|
374 | Format => 'int32u',
|
---|
375 | RawConv => '$val + 0xf2',
|
---|
376 | },
|
---|
377 | );
|
---|
378 |
|
---|
379 | #------------------------------------------------------------------------------
|
---|
380 | # Patch incorrect offsets in J1, J2, J4, S1, S3 and S4 maker notes
|
---|
381 | # Inputs: 0) valuePtr, 1) end of previous value, 2) value size, 3) tag ID, 4) write flag
|
---|
382 | sub FixOffsets($$$$;$)
|
---|
383 | {
|
---|
384 | my ($valuePtr, $valEnd, $size, $tagID, $wFlag) = @_;
|
---|
385 | # ignore existing offsets and calculate reasonable values instead
|
---|
386 | if ($tagID == 0x100) {
|
---|
387 | # just ignore the SanyoThumbnail when writing (pointer is garbage)
|
---|
388 | $_[0] = undef if $wFlag;
|
---|
389 | } else {
|
---|
390 | $_[0] = $valEnd; # set value pointer to next logical location
|
---|
391 | ++$size if $size & 0x01;
|
---|
392 | $_[1] += $size; # update end-of-value pointer
|
---|
393 | }
|
---|
394 | }
|
---|
395 |
|
---|
396 |
|
---|
397 | 1; # end
|
---|
398 |
|
---|
399 | __END__
|
---|
400 |
|
---|
401 | =head1 NAME
|
---|
402 |
|
---|
403 | Image::ExifTool::Sanyo - Sanyo EXIF maker notes tags
|
---|
404 |
|
---|
405 | =head1 SYNOPSIS
|
---|
406 |
|
---|
407 | This module is loaded automatically by Image::ExifTool when required.
|
---|
408 |
|
---|
409 | =head1 DESCRIPTION
|
---|
410 |
|
---|
411 | This module contains definitions required by Image::ExifTool to interpret
|
---|
412 | Sanyo maker notes in EXIF information.
|
---|
413 |
|
---|
414 | =head1 AUTHOR
|
---|
415 |
|
---|
416 | Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
|
---|
417 |
|
---|
418 | This library is free software; you can redistribute it and/or modify it
|
---|
419 | under the same terms as Perl itself.
|
---|
420 |
|
---|
421 | =head1 REFERENCES
|
---|
422 |
|
---|
423 | =over 4
|
---|
424 |
|
---|
425 | =item L<http://www.exif.org/makernotes/SanyoMakerNote.html>
|
---|
426 |
|
---|
427 | =back
|
---|
428 |
|
---|
429 | =head1 SEE ALSO
|
---|
430 |
|
---|
431 | L<Image::ExifTool::TagNames/Sanyo Tags>,
|
---|
432 | L<Image::ExifTool(3pm)|Image::ExifTool>
|
---|
433 |
|
---|
434 | =cut
|
---|