source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Samsung.pm@ 24107

Last change on this file since 24107 was 24107, checked in by sjm84, 13 years ago

Updating the ExifTool perl modules

  • Property svn:executable set to *
File size: 21.4 KB
Line 
1#------------------------------------------------------------------------------
2# File: Samsung.pm
3#
4# Description: Samsung EXIF maker notes tags
5#
6# Revisions: 2010/03/01 - P. Harvey Created
7#
8# References: 1) Tae-Sun Park private communication
9# 2) http://www.cybercom.net/~dcoffin/dcraw/
10#------------------------------------------------------------------------------
11
12package Image::ExifTool::Samsung;
13
14use strict;
15use vars qw($VERSION);
16use Image::ExifTool qw(:DataAccess :Utils);
17use Image::ExifTool::Exif;
18
19$VERSION = '1.08';
20
21sub WriteSTMN($$$);
22sub ProcessINFO($$$);
23
24# range of values for Formats used in encrypted information
25my %formatMinMax = (
26 int16u => [ 0, 65535 ],
27 int32u => [ 0, 4294967295 ],
28 int16s => [ -32768, 32767 ],
29 int32s => [ -2147483648, 2147483647 ],
30);
31
32# Samsung "STMN" maker notes (ref PH)
33%Image::ExifTool::Samsung::Type1 = (
34 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
35 WRITE_PROC => \&WriteSTMN,
36 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
37 WRITABLE => 1,
38 FORMAT => 'int32u',
39 FIRST_ENTRY => 0,
40 IS_OFFSET => [ 2 ], # tag 2 is 'IsOffset'
41 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
42 NOTES => q{
43 Tags found in the binary "STMN" format maker notes written by a number of
44 Samsung models.
45 },
46 0 => {
47 Name => 'MakerNoteVersion',
48 Format => 'undef[8]',
49 },
50 2 => {
51 Name => 'PreviewImageStart',
52 OffsetPair => 3, # associated byte count tagID
53 DataTag => 'PreviewImage',
54 IsOffset => 3,
55 Protected => 2,
56 },
57 3 => {
58 Name => 'PreviewImageLength',
59 OffsetPair => 2, # point to associated offset
60 DataTag => 'PreviewImage',
61 Protected => 2,
62 },
63);
64
65# Samsung maker notes (ref PH)
66%Image::ExifTool::Samsung::Type2 = (
67 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
68 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
69 WRITABLE => 1,
70 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
71 NOTES => 'Tags found in the EXIF-format maker notes of newer Samsung models.',
72 0x0001 => {
73 Name => 'MakerNoteVersion',
74 Writable => 'undef',
75 Count => 4,
76 },
77 0x0021 => { #1
78 Name => 'PictureWizard',
79 Writable => 'int16u',
80 Count => 5,
81 PrintConv => q{
82 my @a = split ' ', $val;
83 return $val unless @a == 5;
84 sprintf("Mode: %d, Col: %d, Sat: %d, Sha: %d, Con: %d",
85 $a[0], $a[1], $a[2]-4, $a[3]-4, $a[4]-4);
86 },
87 PrintConvInv => q{
88 my @a = ($val =~ /[+-]?\d+/g);
89 return $val unless @a >= 5;
90 sprintf("%d %d %d %d %d", $a[0], $a[1], $a[2]+4, $a[3]+4, $a[4]+4);
91 },
92 },
93 # 0x0023 - string: "0123456789" (PH)
94 0x0030 => { #1 (NX100 with GPS)
95 Name => 'LocalLocationName',
96 Writable => 'string',
97 Format => 'undef',
98 # this contains 2 place names (in Korean if in Korea), separated by a null+space
99 # - terminate at double-null and replace nulls with newlines
100 ValueConv => '$val=~s/\0\0.*//; $val=~s/\0 */\n/g; $val',
101 ValueConvInv => '$val=~s/(\x0d\x0a|\x0d|\x0a)/\0 /g; $val . "\0\0"'
102 },
103 0x0031 => { #1 (NX100 with GPS)
104 Name => 'LocationName',
105 Writable => 'string',
106 },
107 0x0035 => {
108 Name => 'PreviewIFD',
109 Condition => '$$self{TIFF_TYPE} eq "SRW"', # (not an IFD in JPEG images)
110 Groups => { 1 => 'PreviewIFD' },
111 Flags => 'SubIFD',
112 SubDirectory => {
113 TagTable => 'Image::ExifTool::Nikon::PreviewIFD',
114 ByteOrder => 'Unknown',
115 Start => '$val',
116 },
117 },
118 0x0043 => { #1 (NC)
119 Name => 'CameraTemperature',
120 Groups => { 2 => 'Camera' },
121 Writable => 'rational64s',
122 # (DPreview samples all 0.2 C --> pre-production model)
123 PrintConv => '"$val C"',
124 PrintConvInv => '$val=~s/ ?C//; $val',
125 },
126 # 0x00a0 - undef[8192]: white balance information (ref 1):
127 # At byte 5788, the WBAdjust: "Adjust\0\X\0\Y\0\Z\xee\xea\xce\xab", where
128 # Y = BA adjust (0=Blue7, 7=0, 14=Amber7), Z = MG (0=Magenta7, 7=0, 14=Green7)
129#
130# the following tags found only in SRW images
131#
132 # 0xa000 - rational64u: 1 or 1.1 (ref PH)
133 0xa001 => { #1
134 Name => 'FirmwareName',
135 Groups => { 2 => 'Camera' },
136 Writable => 'string',
137 },
138 # 0xa002 - string[30]: '0' or 'DY049P000000' (ref PH)
139 0xa003 => { #1 (SRW images only)
140 Name => 'LensType',
141 Groups => { 2 => 'Camera' },
142 Writable => 'int16u',
143 PrintConv => {
144 0 => 'Built-in', #PH (EX1, WB2000)
145 1 => 'Samsung 30mm F2 Pancake',
146 2 => 'Samsung Zoom 18-55mm F3.5-5.6 OIS',
147 3 => 'Samsung Zoom 50-200mm F4-5.6 ED OIS',
148 # what about the non-OIS version of the 18-55,
149 # which was supposed to be available before the 20-50?
150 4 => 'Samsung 20-50mm F3.5-5.6 Compact Zoom', #PH
151 5 => 'Samsung 20mm F2.8 Pancake', #PH (guess)
152 },
153 },
154 0xa004 => { #1
155 Name => 'LensFirmware',
156 Groups => { 2 => 'Camera' },
157 Writable => 'string',
158 },
159 # 0xa005 - string[30]: constant for a given lens? Not the printed serial number (ref 1)
160 0xa010 => { #1
161 Name => 'SensorAreas',
162 Groups => { 2 => 'Camera' },
163 Notes => 'full and valid sensor areas',
164 Writable => 'int32u',
165 Count => 8,
166 },
167 0xa011 => { #1
168 Name => 'ColorSpace',
169 Writable => 'int16u',
170 PrintConv => {
171 0 => 'sRGB',
172 1 => 'Adobe RGB',
173 },
174 },
175 0xa012 => { #1
176 Name => 'SmartRange',
177 Writable => 'int16u',
178 PrintConv => { 0 => 'Off', 1 => 'On' },
179 },
180 0xa013 => { #1
181 Name => 'ExposureCompensation',
182 Writable => 'rational64s',
183 },
184 0xa014 => { #1
185 Name => 'ISO',
186 Writable => 'int32u',
187 },
188 0xa018 => { #1
189 Name => 'ExposureTime',
190 Writable => 'rational64u',
191 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
192 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
193 },
194 0xa019 => { #1
195 Name => 'FNumber',
196 Writable => 'rational64u',
197 PrintConv => 'sprintf("%.1f",$val)',
198 PrintConvInv => '$val',
199 },
200 0xa01a => { #1
201 Name => 'FocalLengthIn35mmFormat',
202 Groups => { 2 => 'Camera' },
203 Format => 'int32u',
204 ValueConv => '$val / 10',
205 ValueConvInv => '$val * 10',
206 PrintConv => '"$val mm"',
207 PrintConvInv => '$val=~s/\s*mm$//;$val',
208 },
209 0xa020 => { #1
210 Name => 'EncryptionKey',
211 Writable => 'int32u',
212 Count => 11,
213 Protected => 1,
214 DataMember => 'EncryptionKey',
215 RawConv => '$$self{EncryptionKey} = [ split(" ",$val) ]; $val',
216 Notes => 'key used to decrypt the tags below',
217 # value is "305 72 737 456 282 307 519 724 13 505 193"
218 },
219 0xa021 => { #1
220 Name => 'WB_RGGBLevelsUncorrected',
221 Writable => 'int32u',
222 Count => 4,
223 Notes => 'these tags not corrected for WB_RGGBLevelsBlack',
224 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
225 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
226 },
227 0xa022 => { #1
228 Name => 'WB_RGGBLevelsAuto',
229 Writable => 'int32u',
230 Count => 4,
231 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-4)',
232 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,4)',
233 },
234 0xa023 => { #1
235 Name => 'WB_RGGBLevelsIlluminator1',
236 Writable => 'int32u',
237 Count => 4,
238 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-8)',
239 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,8)',
240 },
241 0xa024 => { #1
242 Name => 'WB_RGGBLevelsIlluminator2',
243 Writable => 'int32u',
244 Count => 4,
245 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-1)',
246 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,1)',
247 },
248 #this doesn't seem correct
249 #0xa025 => { #PH/1
250 # Name => 'ColorTemperatureAuto',
251 # Writable => 'int32u',
252 # RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,6)',
253 # RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-6)',
254 #},
255 0xa028 => { #2/PH
256 Name => 'WB_RGGBLevelsBlack',
257 Writable => 'int32s',
258 Count => 4,
259 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
260 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
261 },
262 0xa030 => { #1
263 Name => 'ColorMatrix',
264 Writable => 'int32s',
265 Count => 9,
266 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
267 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
268 },
269 0xa031 => { #1
270 Name => 'ColorMatrixSRGB',
271 Writable => 'int32s',
272 Count => 9,
273 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
274 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
275 },
276 0xa032 => { #1
277 Name => 'ColorMatrixAdobeRGB',
278 Writable => 'int32s',
279 Count => 9,
280 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
281 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
282 },
283 0xa033 => { #1
284 Name => 'Samsung_Type2_0xa033',
285 Unknown => 1,
286 Hidden => 1,
287 Writable => 'int32s',
288 Count => 4,
289 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
290 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
291 },
292 0xa034 => { #1
293 Name => 'Samsung_Type2_0xa034',
294 Unknown => 1,
295 Hidden => 1,
296 Writable => 'int32s',
297 Count => 4,
298 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,4)',
299 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-4)',
300 },
301 0xa035 => { #1
302 Name => 'Samsung_Type2_0xa035',
303 Unknown => 1,
304 Hidden => 1,
305 Writable => 'int32u',
306 Count => 2,
307 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
308 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
309 },
310 0xa036 => { #1
311 Name => 'Samsung_Type2_0xa036',
312 Unknown => 1,
313 Hidden => 1,
314 Writable => 'int32u',
315 Count => 2,
316 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-2)',
317 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,2)',
318 },
319 0xa040 => { #1
320 Name => 'ToneCurve1',
321 Writable => 'int32u',
322 Count => 23,
323 Notes => q{
324 first value gives the number of tone curve entries. This is followed by an
325 array of X coordinates then an array of Y coordinates
326 },
327 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,"-0")',
328 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",0)',
329 },
330 0xa041 => { #1
331 Name => 'ToneCurve2',
332 Writable => 'int32u',
333 Count => 23,
334 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,"-0")',
335 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",0)',
336 },
337 0xa042 => { #1
338 Name => 'ToneCurve3',
339 Writable => 'int32u',
340 Count => 23,
341 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,"-0")',
342 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",0)',
343 },
344 0xa043 => { #1
345 Name => 'ToneCurve4',
346 Writable => 'int32u',
347 Count => 23,
348 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,"-0")',
349 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",0)',
350 },
351 0xa048 => { #1
352 Name => 'Samsung_Type2_0xa048',
353 Unknown => 1,
354 Hidden => 1,
355 Writable => 'int32s',
356 Count => 12,
357 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
358 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
359 },
360 0xa050 => { #1 (vignette curve?)
361 Name => 'Samsung_Type2_0xa050',
362 Unknown => 1,
363 Hidden => 1,
364 Writable => 'int32s',
365 Count => 8,
366 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0)',
367 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0")',
368 },
369 0xa051 => { #1
370 Name => 'Samsung_Type2_0xa051',
371 Unknown => 1,
372 Hidden => 1,
373 Writable => 'int16u',
374 Count => 22,
375 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",-7,-3)',
376 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,7,3)',
377 },
378 0xa052 => { #1 (vignette curve?)
379 Name => 'Samsung_Type2_0xa052',
380 Unknown => 1,
381 Hidden => 1,
382 Writable => 'int16u',
383 Count => 15,
384 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,"-0")',
385 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",0)',
386 },
387 0xa053 => { #1
388 Name => 'Samsung_Type2_0xa053',
389 Unknown => 1,
390 Hidden => 1,
391 Writable => 'int16u',
392 Count => 15,
393 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,"-0")',
394 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",0)',
395 },
396 0xa054 => { #1
397 Name => 'Samsung_Type2_0xa054',
398 Unknown => 1,
399 Hidden => 1,
400 Writable => 'int16u',
401 Count => 15,
402 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,0,"-0")',
403 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,"-0",0)',
404 },
405 0xa055 => { #1
406 Name => 'Samsung_Type2_0xa055',
407 Unknown => 1,
408 Hidden => 1,
409 Writable => 'int32s',
410 Count => 8,
411 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,8)',
412 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-8)',
413 },
414 0xa056 => { #1
415 Name => 'Samsung_Type2_0xa056',
416 Unknown => 1,
417 Hidden => 1,
418 Writable => 'int32s',
419 Count => 8,
420 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,5)',
421 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-5)',
422 },
423 0xa057 => { #1
424 Name => 'Samsung_Type2_0xa057',
425 Unknown => 1,
426 Hidden => 1,
427 Writable => 'int32s',
428 Count => 8,
429 RawConv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,2)',
430 RawConvInv => 'Image::ExifTool::Samsung::Crypt($self,$val,$tagInfo,-2)',
431 },
432);
433
434# INFO tags in Samsung MP4 videos (ref PH)
435%Image::ExifTool::Samsung::INFO = (
436 PROCESS_PROC => \&ProcessINFO,
437 GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
438 NOTES => q{
439 This information is found in MP4 videos from Samsung models such as the
440 SMX-C20N.
441 },
442 EFCT => 'Effect', # (guess)
443 QLTY => 'Quality',
444 # MDEL - value: 0
445 # ASPT - value: 1, 2
446);
447
448# Samsung MP4 TAGS information (PH - from WP10 sample)
449# --> very similar to Sanyo MP4 information
450%Image::ExifTool::Samsung::MP4 = (
451 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
452 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
453 NOTES => q{
454 This information is found in Samsung MP4 videos from models such as the
455 WP10.
456 },
457 0x00 => {
458 Name => 'Make',
459 Format => 'string[24]',
460 PrintConv => 'ucfirst(lc($val))',
461 },
462 0x18 => {
463 Name => 'Model',
464 Description => 'Camera Model Name',
465 Format => 'string[16]',
466 },
467 0x2e => { # (NC)
468 Name => 'ExposureTime',
469 Format => 'int32u',
470 ValueConv => '$val ? 10 / $val : 0',
471 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
472 },
473 0x32 => {
474 Name => 'FNumber',
475 Format => 'rational64u',
476 PrintConv => 'sprintf("%.1f",$val)',
477 },
478 0x3a => { # (NC)
479 Name => 'ExposureCompensation',
480 Format => 'rational64s',
481 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
482 },
483 0x6a => {
484 Name => 'ISO',
485 Format => 'int32u',
486 },
487 0x7d => {
488 Name => 'Software',
489 Format => 'string[32]',
490 # (these tags are not at a constant offset for Sanyo videos,
491 # so just to be safe use this to validate subsequent tags)
492 RawConv => q{
493 $val =~ /^SAMSUNG/ or return undef;
494 $$self{SamsungMP4} = 1;
495 return $val;
496 },
497 },
498 0xf8 => {
499 Name => 'ThumbnailWidth',
500 Condition => '$$self{SamsungMP4}',
501 Format => 'int32u',
502 },
503 0xfc => {
504 Name => 'ThumbnailHeight',
505 Condition => '$$self{SamsungMP4}',
506 Format => 'int32u',
507 },
508 0x100 => {
509 Name => 'ThumbnailLength',
510 Condition => '$$self{SamsungMP4}',
511 Format => 'int32u',
512 },
513 0x104 => {
514 Name => 'ThumbnailOffset',
515 Condition => '$$self{SamsungMP4}',
516 IsOffset => 1,
517 Format => 'int32u',
518 RawConv => '$val + 0xf4',
519 },
520);
521
522# Samsung composite tags
523%Image::ExifTool::Samsung::Composite = (
524 GROUPS => { 2 => 'Image' },
525 WB_RGGBLevels => {
526 Require => {
527 0 => 'WB_RGGBLevelsUncorrected',
528 1 => 'WB_RGGBLevelsBlack',
529 },
530 ValueConv => q{
531 my @a = split ' ', $val[0];
532 my @b = split ' ', $val[1];
533 $a[$_] -= $b[$_] foreach 0..$#a;
534 return "@a";
535 },
536 },
537);
538
539# add our composite tags
540Image::ExifTool::AddCompositeTags('Image::ExifTool::Samsung');
541
542#------------------------------------------------------------------------------
543# Encrypt/Decrypt NX10 information
544# Inputs: 0) ExifTool ref, 1) value as a string of integers,
545# 2) tagInfo hash ref, 3-N) encryption salt values
546# Returns: encrypted/decrypted value
547# Notes:
548# 1) The encryption salt starts with '-' to reverse the encryption algorithm
549# 2) Additional salt values are provided when tag stores multiple arrays
550# (in which case the first value of the tag gives the array length)
551sub Crypt($$$@)
552{
553 my ($exifTool, $val, $tagInfo, @salt) = @_;
554 my $key = $$exifTool{EncryptionKey} or return undef;
555 my $format = $$tagInfo{Writable} || $$tagInfo{Format} or return undef;
556 return undef unless $formatMinMax{$format};
557 my ($min, $max) = @{$formatMinMax{$format}};
558 my @a = split ' ', $val;
559 my $newSalt = (@salt > 1) ? 1 : 0; # skip length entry if this is an array
560 my ($i, $sign, $salt, $start);
561 for ($i=$newSalt; $i<@a; ++$i) {
562 if ($i == $newSalt) {
563 $start = $i;
564 $salt = shift @salt;
565 $sign = ($salt =~ s/^-//) ? -1 : 1;
566 $newSalt += $a[0] if @salt;
567 }
568 $a[$i] += $sign * $$key[($salt+$i-$start) % scalar(@$key)];
569 # handle integer wrap-around
570 if ($sign > 0) {
571 $a[$i] -= $max - $min + 1 if $a[$i] > $max;
572 } else {
573 $a[$i] += $max - $min + 1 if $a[$i] < $min;
574 }
575 }
576 return "@a";
577}
578
579#------------------------------------------------------------------------------
580# Process Samsung MP4 INFO data
581# Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) tag table ref
582# Returns: 1 on success
583sub ProcessINFO($$$)
584{
585 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
586 my $dataPt = $$dirInfo{DataPt};
587 my $pos = $$dirInfo{DirStart};
588 my $len = $$dirInfo{DirLen};
589 my $end = $pos + $len;
590 $exifTool->VerboseDir('INFO', undef, $len);
591 while ($pos + 8 <= $end) {
592 my $tag = substr($$dataPt, $pos, 4);
593 my $val = Get32u($dataPt, $pos + 4);
594 unless ($$tagTablePtr{$tag}) {
595 my $name = "Samsung_INFO_$tag";
596 $name =~ tr/-_0-9a-zA-Z//dc;
597 Image::ExifTool::AddTagToTable($tagTablePtr, $tag, { Name => $name }) if $name;
598 }
599 $exifTool->HandleTag($tagTablePtr, $tag, $val);
600 $pos += 8;
601 }
602 return 1;
603}
604
605#------------------------------------------------------------------------------
606# Write Samsung STMN maker notes
607# Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
608# Returns: Binary data block or undefined on error
609sub WriteSTMN($$$)
610{
611 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
612 # create a Fixup for the PreviewImage
613 $$dirInfo{Fixup} = new Image::ExifTool::Fixup;
614 my $val = Image::ExifTool::WriteBinaryData($exifTool, $dirInfo, $tagTablePtr);
615 # force PreviewImage into the trailer even if it fits in EXIF segment
616 $$exifTool{PREVIEW_INFO}{IsTrailer} = 1 if $$exifTool{PREVIEW_INFO};
617 return $val;
618}
619
6201; # end
621
622__END__
623
624=head1 NAME
625
626Image::ExifTool::Samsung - Samsung EXIF maker notes tags
627
628=head1 SYNOPSIS
629
630This module is loaded automatically by Image::ExifTool when required.
631
632=head1 DESCRIPTION
633
634This module contains definitions required by Image::ExifTool to interpret
635Samsung maker notes in EXIF information.
636
637=head1 AUTHOR
638
639Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
640
641This library is free software; you can redistribute it and/or modify it
642under the same terms as Perl itself.
643
644=head1 ACKNOWLEDGEMENTS
645
646Thanks to Tae-Sun Park for decoding a number of tags.
647
648=head1 SEE ALSO
649
650L<Image::ExifTool::TagNames/Samsung Tags>,
651L<Image::ExifTool(3pm)|Image::ExifTool>
652
653=cut
Note: See TracBrowser for help on using the repository browser.