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.10';
|
---|
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 | ValueConv => '$self->ValidateImage(\$val,$tag)',
|
---|
39 | ValueConvInv => '$val',
|
---|
40 | },
|
---|
41 | 0x0200 => {
|
---|
42 | Name => 'SpecialMode',
|
---|
43 | Writable => 'int32u',
|
---|
44 | Count => 3,
|
---|
45 | },
|
---|
46 | 0x0201 => {
|
---|
47 | Name => 'SanyoQuality',
|
---|
48 | Flags => 'PrintHex',
|
---|
49 | Writable => 'int16u',
|
---|
50 | PrintConv => {
|
---|
51 | 0x0000 => 'Normal/Very Low',
|
---|
52 | 0x0001 => 'Normal/Low',
|
---|
53 | 0x0002 => 'Normal/Medium Low',
|
---|
54 | 0x0003 => 'Normal/Medium',
|
---|
55 | 0x0004 => 'Normal/Medium High',
|
---|
56 | 0x0005 => 'Normal/High',
|
---|
57 | 0x0006 => 'Normal/Very High',
|
---|
58 | 0x0007 => 'Normal/Super High',
|
---|
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 | 0x0216 => {
|
---|
125 | Name => 'VoiceMemo',
|
---|
126 | Writable => 'int16u',
|
---|
127 | PrintConv => \%offOn,
|
---|
128 | },
|
---|
129 | 0x0217 => {
|
---|
130 | Name => 'RecordShutterRelease',
|
---|
131 | Writable => 'int16u',
|
---|
132 | PrintConv => {
|
---|
133 | 0 => 'Record while down',
|
---|
134 | 1 => 'Press start, press stop',
|
---|
135 | },
|
---|
136 | },
|
---|
137 | 0x0218 => {
|
---|
138 | Name => 'FlickerReduce',
|
---|
139 | Writable => 'int16u',
|
---|
140 | PrintConv => \%offOn,
|
---|
141 | },
|
---|
142 | 0x0219 => {
|
---|
143 | Name => 'OpticalZoomOn',
|
---|
144 | Writable => 'int16u',
|
---|
145 | PrintConv => \%offOn,
|
---|
146 | },
|
---|
147 | 0x021b => {
|
---|
148 | Name => 'DigitalZoomOn',
|
---|
149 | Writable => 'int16u',
|
---|
150 | PrintConv => \%offOn,
|
---|
151 | },
|
---|
152 | 0x021d => {
|
---|
153 | Name => 'LightSourceSpecial',
|
---|
154 | Writable => 'int16u',
|
---|
155 | PrintConv => \%offOn,
|
---|
156 | },
|
---|
157 | 0x021e => {
|
---|
158 | Name => 'Resaved',
|
---|
159 | Writable => 'int16u',
|
---|
160 | PrintConv => {
|
---|
161 | 0 => 'No',
|
---|
162 | 1 => 'Yes',
|
---|
163 | },
|
---|
164 | },
|
---|
165 | 0x021f => {
|
---|
166 | Name => 'SceneSelect',
|
---|
167 | Writable => 'int16u',
|
---|
168 | PrintConv => {
|
---|
169 | 0 => 'Off',
|
---|
170 | 1 => 'Sport',
|
---|
171 | 2 => 'TV',
|
---|
172 | 3 => 'Night',
|
---|
173 | 4 => 'User 1',
|
---|
174 | 5 => 'User 2',
|
---|
175 | 6 => 'Lamp', #PH
|
---|
176 | },
|
---|
177 | },
|
---|
178 | 0x0223 => {
|
---|
179 | Name => 'ManualFocusDistance',
|
---|
180 | Writable => 'rational64u',
|
---|
181 | },
|
---|
182 | 0x0224 => {
|
---|
183 | Name => 'SequenceShotInterval',
|
---|
184 | Writable => 'int16u',
|
---|
185 | PrintConv => {
|
---|
186 | 0 => '5 frames/sec',
|
---|
187 | 1 => '10 frames/sec',
|
---|
188 | 2 => '15 frames/sec',
|
---|
189 | 3 => '20 frames/sec',
|
---|
190 | },
|
---|
191 | },
|
---|
192 | 0x0225 => {
|
---|
193 | Name => 'FlashMode',
|
---|
194 | Writable => 'int16u',
|
---|
195 | PrintConv => {
|
---|
196 | 0 => 'Auto',
|
---|
197 | 1 => 'Force',
|
---|
198 | 2 => 'Disabled',
|
---|
199 | 3 => 'Red eye',
|
---|
200 | },
|
---|
201 | },
|
---|
202 | 0x0e00 => {
|
---|
203 | Name => 'PrintIM',
|
---|
204 | Description => 'Print Image Matching',
|
---|
205 | Writable => 0,
|
---|
206 | SubDirectory => {
|
---|
207 | TagTable => 'Image::ExifTool::PrintIM::Main',
|
---|
208 | },
|
---|
209 | },
|
---|
210 | 0x0f00 => {
|
---|
211 | Name => 'DataDump',
|
---|
212 | Writable => 0,
|
---|
213 | Binary => 1,
|
---|
214 | },
|
---|
215 | );
|
---|
216 |
|
---|
217 | # tags in Sanyo MOV videos (PH - observations from an E6 sample)
|
---|
218 | # (note: very similar to information in Nikon/Pentax videos)
|
---|
219 | %Image::ExifTool::Sanyo::MOV = (
|
---|
220 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
221 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
222 | NOTES => q{
|
---|
223 | This information is found in Sanyo MOV video images, and is very similar to
|
---|
224 | information found in Pentax MOV and Nikon QT videos.
|
---|
225 | },
|
---|
226 | 0x00 => {
|
---|
227 | Name => 'Make',
|
---|
228 | Format => 'string[5]',
|
---|
229 | PrintConv => 'ucfirst(lc($val))',
|
---|
230 | },
|
---|
231 | 0x18 => {
|
---|
232 | Name => 'Model',
|
---|
233 | Description => 'Camera Model Name',
|
---|
234 | Format => 'string[8]',
|
---|
235 | },
|
---|
236 | 0x26 => {
|
---|
237 | Name => 'ExposureTime',
|
---|
238 | Format => 'int32u',
|
---|
239 | ValueConv => '$val ? 10 / $val : 0',
|
---|
240 | PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
|
---|
241 | },
|
---|
242 | 0x2a => {
|
---|
243 | Name => 'FNumber',
|
---|
244 | Format => 'int32u',
|
---|
245 | ValueConv => '$val * 0.1',
|
---|
246 | PrintConv => 'sprintf("%.1f",$val)',
|
---|
247 | },
|
---|
248 | 0x32 => {
|
---|
249 | Name => 'ExposureCompensation',
|
---|
250 | Format => 'int32s',
|
---|
251 | ValueConv => '$val * 0.1',
|
---|
252 | PrintConv => 'Image::ExifTool::Exif::ConvertFraction($val)',
|
---|
253 | },
|
---|
254 | 0x44 => {
|
---|
255 | Name => 'WhiteBalance',
|
---|
256 | Format => 'int16u',
|
---|
257 | PrintConv => {
|
---|
258 | 0 => 'Auto',
|
---|
259 | 1 => 'Daylight',
|
---|
260 | 2 => 'Shade',
|
---|
261 | 3 => 'Fluorescent', #2
|
---|
262 | 4 => 'Tungsten',
|
---|
263 | 5 => 'Manual',
|
---|
264 | },
|
---|
265 | },
|
---|
266 | 0x48 => {
|
---|
267 | Name => 'FocalLength',
|
---|
268 | Writable => 'int32u',
|
---|
269 | ValueConv => '$val * 0.1',
|
---|
270 | PrintConv => 'sprintf("%.1fmm",$val)',
|
---|
271 | },
|
---|
272 | );
|
---|
273 |
|
---|
274 | # tags in Sanyo MP4 videos (PH - from C4, C5 and HD1A samples)
|
---|
275 | # (there is still a lot more information here that could be decoded!)
|
---|
276 | %Image::ExifTool::Sanyo::MP4 = (
|
---|
277 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
278 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
279 | NOTES => 'This information is found in Sanyo MP4 video images.',
|
---|
280 | 0x00 => {
|
---|
281 | Name => 'Make',
|
---|
282 | Format => 'string[5]',
|
---|
283 | PrintConv => 'ucfirst(lc($val))',
|
---|
284 | },
|
---|
285 | 0x18 => {
|
---|
286 | Name => 'Model',
|
---|
287 | Description => 'Camera Model Name',
|
---|
288 | Format => 'string[8]',
|
---|
289 | },
|
---|
290 | # (0x2e has values 0x31, 0x33 and 0x3c in my samples, but
|
---|
291 | # some of the shutter speeds should be around 1/500 or so)
|
---|
292 | 0x32 => {
|
---|
293 | Name => 'FNumber',
|
---|
294 | Format => 'int32u',
|
---|
295 | ValueConv => '$val / 10',
|
---|
296 | PrintConv => 'sprintf("%.1f",$val)',
|
---|
297 | },
|
---|
298 | 0x6a => {
|
---|
299 | Name => 'ISO',
|
---|
300 | Format => 'int32u',
|
---|
301 | },
|
---|
302 | # (these tags are shifted by +1 byte for the C4 compared to the HD1A, so we can't use them)
|
---|
303 | # 0xfe => {
|
---|
304 | # Name => 'ThumbnailLength',
|
---|
305 | # Format => 'int32u',
|
---|
306 | # },
|
---|
307 | # 0x102 => {
|
---|
308 | # Name => 'ThumbnailOffset',
|
---|
309 | # IsOffset => 1,
|
---|
310 | # Format => 'int32u',
|
---|
311 | # RawConv => '$val + 0xf2',
|
---|
312 | # },
|
---|
313 | # so instead, look for the JPEG header using brute force...
|
---|
314 | 0x800 => {
|
---|
315 | Name => 'ThumbnailImage',
|
---|
316 | Notes => 'position varies',
|
---|
317 | Format => 'undef[$size - 0x800]',
|
---|
318 | ValueConv => '$val=~s/.*(?=\xff\xd8\xff\xc4)//; $self->ValidateImage(\$val,$tag)',
|
---|
319 | },
|
---|
320 | );
|
---|
321 |
|
---|
322 | #------------------------------------------------------------------------------
|
---|
323 | # Patch incorrect offsets in J1, J2, J4, S1, S3 and S4 maker notes
|
---|
324 | # Inputs: 0) valuePtr, 1) end of previous value, 2) value size, 3) tag ID, 4) write flag
|
---|
325 | sub FixOffsets($$$$;$)
|
---|
326 | {
|
---|
327 | my ($valuePtr, $valEnd, $size, $tagID, $wFlag) = @_;
|
---|
328 | # ignore existing offsets and calculate reasonable values instead
|
---|
329 | if ($tagID == 0x100) {
|
---|
330 | # just ignore the SanyoThumbnail when writing (pointer is garbage)
|
---|
331 | $_[0] = undef if $wFlag;
|
---|
332 | } else {
|
---|
333 | $_[0] = $valEnd; # set value pointer to next logical location
|
---|
334 | ++$size if $size & 0x01;
|
---|
335 | $_[1] += $size; # update end-of-value pointer
|
---|
336 | }
|
---|
337 | }
|
---|
338 |
|
---|
339 |
|
---|
340 | 1; # end
|
---|
341 |
|
---|
342 | __END__
|
---|
343 |
|
---|
344 | =head1 NAME
|
---|
345 |
|
---|
346 | Image::ExifTool::Sanyo - Sanyo EXIF maker notes tags
|
---|
347 |
|
---|
348 | =head1 SYNOPSIS
|
---|
349 |
|
---|
350 | This module is loaded automatically by Image::ExifTool when required.
|
---|
351 |
|
---|
352 | =head1 DESCRIPTION
|
---|
353 |
|
---|
354 | This module contains definitions required by Image::ExifTool to interpret
|
---|
355 | Sanyo maker notes in EXIF information.
|
---|
356 |
|
---|
357 | =head1 AUTHOR
|
---|
358 |
|
---|
359 | Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
|
---|
360 |
|
---|
361 | This library is free software; you can redistribute it and/or modify it
|
---|
362 | under the same terms as Perl itself.
|
---|
363 |
|
---|
364 | =head1 REFERENCES
|
---|
365 |
|
---|
366 | =over 4
|
---|
367 |
|
---|
368 | =item L<http://www.exif.org/makernotes/SanyoMakerNote.html>
|
---|
369 |
|
---|
370 | =back
|
---|
371 |
|
---|
372 | =head1 SEE ALSO
|
---|
373 |
|
---|
374 | L<Image::ExifTool::TagNames/Sanyo Tags>,
|
---|
375 | L<Image::ExifTool(3pm)|Image::ExifTool>
|
---|
376 |
|
---|
377 | =cut
|
---|