exiftool-vendored.pl 12.60.0 → 12.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/bin/Changes +110 -0
  2. package/bin/LICENSE +674 -0
  3. package/bin/MANIFEST +11 -0
  4. package/bin/META.json +5 -3
  5. package/bin/META.yml +5 -3
  6. package/bin/Makefile.PL +7 -1
  7. package/bin/README +50 -45
  8. package/bin/config_files/guano.config +161 -0
  9. package/bin/exiftool +163 -103
  10. package/bin/lib/Image/ExifTool/7Z.pm +793 -0
  11. package/bin/lib/Image/ExifTool/Apple.pm +14 -7
  12. package/bin/lib/Image/ExifTool/BMP.pm +0 -1
  13. package/bin/lib/Image/ExifTool/BigTIFF.pm +8 -1
  14. package/bin/lib/Image/ExifTool/BuildTagLookup.pm +4 -4
  15. package/bin/lib/Image/ExifTool/Canon.pm +4 -1
  16. package/bin/lib/Image/ExifTool/CanonRaw.pm +4 -4
  17. package/bin/lib/Image/ExifTool/CanonVRD.pm +4 -1
  18. package/bin/lib/Image/ExifTool/Exif.pm +31 -14
  19. package/bin/lib/Image/ExifTool/FlashPix.pm +9 -2
  20. package/bin/lib/Image/ExifTool/FujiFilm.pm +3 -3
  21. package/bin/lib/Image/ExifTool/GPS.pm +5 -2
  22. package/bin/lib/Image/ExifTool/Geotag.pm +4 -1
  23. package/bin/lib/Image/ExifTool/Jpeg2000.pm +243 -20
  24. package/bin/lib/Image/ExifTool/Lang/fr.pm +1467 -202
  25. package/bin/lib/Image/ExifTool/MPF.pm +2 -1
  26. package/bin/lib/Image/ExifTool/Matroska.pm +16 -1
  27. package/bin/lib/Image/ExifTool/MinoltaRaw.pm +2 -2
  28. package/bin/lib/Image/ExifTool/Nikon.pm +941 -33
  29. package/bin/lib/Image/ExifTool/NikonCustom.pm +874 -63
  30. package/bin/lib/Image/ExifTool/PDF.pm +39 -12
  31. package/bin/lib/Image/ExifTool/PLIST.pm +8 -1
  32. package/bin/lib/Image/ExifTool/PNG.pm +6 -6
  33. package/bin/lib/Image/ExifTool/PhaseOne.pm +5 -5
  34. package/bin/lib/Image/ExifTool/QuickTime.pm +96 -32
  35. package/bin/lib/Image/ExifTool/QuickTimeStream.pl +68 -37
  36. package/bin/lib/Image/ExifTool/README +2 -2
  37. package/bin/lib/Image/ExifTool/RIFF.pm +11 -9
  38. package/bin/lib/Image/ExifTool/Samsung.pm +227 -227
  39. package/bin/lib/Image/ExifTool/Shortcuts.pm +2 -1
  40. package/bin/lib/Image/ExifTool/SigmaRaw.pm +4 -4
  41. package/bin/lib/Image/ExifTool/Sony.pm +237 -32
  42. package/bin/lib/Image/ExifTool/TagLookup.pm +4762 -4629
  43. package/bin/lib/Image/ExifTool/TagNames.pod +737 -20
  44. package/bin/lib/Image/ExifTool/Validate.pm +17 -1
  45. package/bin/lib/Image/ExifTool/WPG.pm +296 -0
  46. package/bin/lib/Image/ExifTool/WriteExif.pl +9 -7
  47. package/bin/lib/Image/ExifTool/WritePDF.pl +7 -8
  48. package/bin/lib/Image/ExifTool/WriteQuickTime.pl +21 -9
  49. package/bin/lib/Image/ExifTool/WriteXMP.pl +2 -2
  50. package/bin/lib/Image/ExifTool/Writer.pl +47 -16
  51. package/bin/lib/Image/ExifTool/XMP.pm +30 -6
  52. package/bin/lib/Image/ExifTool/XMP2.pl +32 -0
  53. package/bin/lib/Image/ExifTool/XMPStruct.pl +96 -28
  54. package/bin/lib/Image/ExifTool/ZIP.pm +159 -41
  55. package/bin/lib/Image/ExifTool.pm +280 -164
  56. package/bin/lib/Image/ExifTool.pod +117 -52
  57. package/bin/perl-Image-ExifTool.spec +44 -43
  58. package/bin/pp_build_exe.args +8 -4
  59. package/package.json +3 -3
@@ -17,7 +17,7 @@ package Image::ExifTool::Validate;
17
17
  use strict;
18
18
  use vars qw($VERSION %exifSpec);
19
19
 
20
- $VERSION = '1.20';
20
+ $VERSION = '1.21';
21
21
 
22
22
  use Image::ExifTool qw(:Utils);
23
23
  use Image::ExifTool::Exif;
@@ -56,6 +56,15 @@ use Image::ExifTool::Exif;
56
56
  0x212 => 1, 0x9204 => 1, 0xa210 => 1, 0xa500 => 221,
57
57
  0x213 => 1, 0x9205 => 1, 0xa214 => 1,
58
58
  0x214 => 1, 0x9206 => 1, 0xa215 => 1,
59
+
60
+ # new Exif 3.0 tags
61
+ 0xa436 => 300,
62
+ 0xa437 => 300,
63
+ 0xa438 => 300,
64
+ 0xa439 => 300,
65
+ 0xa43a => 300,
66
+ 0xa43b => 300,
67
+ 0xa43c => 300,
59
68
  );
60
69
 
61
70
  # GPSVersionID numbers when each tag was introduced
@@ -147,6 +156,13 @@ my %stdFormat = (
147
156
  0xc68d => 'int(16|32)u', 0xc791 => 'int(16|32)u',
148
157
  0xc68e => 'int(16|32)u', 0xc792 => 'int(16|32)u',
149
158
  0xc6d2 => '', 0xc793 => '(int16u|int32u|rational64u)',
159
+ # Exif 3.0 spec
160
+ 0x10e => 'string|utf8', 0xa430 => 'string|utf8', 0xa439 => 'string|utf8',
161
+ 0x10f => 'string|utf8', 0xa433 => 'string|utf8', 0xa43a => 'string|utf8',
162
+ 0x110 => 'string|utf8', 0xa434 => 'string|utf8', 0xa43b => 'string|utf8',
163
+ 0x131 => 'string|utf8', 0xa436 => 'string|utf8', 0xa43c => 'string|utf8',
164
+ 0x13b => 'string|utf8', 0xa437 => 'string|utf8', 0xa43a => 'string|utf8',
165
+ 0x8298 => 'string|utf8', 0xa438 => 'string|utf8',
150
166
  },
151
167
  );
152
168
 
@@ -0,0 +1,296 @@
1
+ #------------------------------------------------------------------------------
2
+ # File: WPG.pm
3
+ #
4
+ # Description: Read WordPerfect Graphics meta information
5
+ #
6
+ # Revisions: 2023-05-01 - P. Harvey Created
7
+ #
8
+ # References: 1) https://www.fileformat.info/format/wpg/egff.htm
9
+ # 2) https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996/page/n991/mode/2up
10
+ # 3) http://libwpg.sourceforge.net/
11
+ #------------------------------------------------------------------------------
12
+
13
+ package Image::ExifTool::WPG;
14
+
15
+ use strict;
16
+ use vars qw($VERSION);
17
+ use Image::ExifTool qw(:DataAccess :Utils);
18
+
19
+ $VERSION = '1.00';
20
+
21
+ sub PrintRecord($$$);
22
+
23
+ # WPG metadata
24
+ %Image::ExifTool::WPG::Main = (
25
+ GROUPS => { 0 => 'File', 1 => 'File', 2 => 'Image' },
26
+ VARS => { NO_ID => 1 },
27
+ NOTES => 'Tags extracted from WordPerfect Graphics (WPG) images.',
28
+ WPGVersion => { },
29
+ ImageWidthInches => { PrintConv => 'sprintf("%.2f",$val)' },
30
+ ImageHeightInches => { PrintConv => 'sprintf("%.2f",$val)' },
31
+ Records => {
32
+ Notes => 'records for version 1.0 files',
33
+ List => 1,
34
+ PrintHex => 2,
35
+ PrintConvColumns => 2,
36
+ PrintConv => {
37
+ OTHER => \&PrintRecord,
38
+ 0x01 => 'Fill Attributes',
39
+ 0x02 => 'Line Attributes',
40
+ 0x03 => 'Marker Attributes',
41
+ 0x04 => 'Polymarker',
42
+ 0x05 => 'Line',
43
+ 0x06 => 'Polyline',
44
+ 0x07 => 'Rectangle',
45
+ 0x08 => 'Polygon',
46
+ 0x09 => 'Ellipse',
47
+ 0x0a => 'Reserved',
48
+ 0x0b => 'Bitmap (Type 1)',
49
+ 0x0c => 'Graphics Text (Type 1)',
50
+ 0x0d => 'Graphics Text Attributes',
51
+ 0x0e => 'Color Map',
52
+ 0x0f => 'Start WPG (Type 1)',
53
+ 0x10 => 'End WPG',
54
+ 0x11 => 'PostScript Data (Type 1)',
55
+ 0x12 => 'Output Attributes',
56
+ 0x13 => 'Curved Polyline',
57
+ 0x14 => 'Bitmap (Type 2)',
58
+ 0x15 => 'Start Figure',
59
+ 0x16 => 'Start Chart',
60
+ 0x17 => 'PlanPerfect Data',
61
+ 0x18 => 'Graphics Text (Type 2)',
62
+ 0x19 => 'Start WPG (Type 2)',
63
+ 0x1a => 'Graphics Text (Type 3)',
64
+ 0x1b => 'PostScript Data (Type 2)',
65
+ },
66
+ },
67
+ RecordsV2 => {
68
+ Notes => 'records for version 2.0 files',
69
+ List => 1,
70
+ PrintHex => 2,
71
+ PrintConvColumns => 2,
72
+ PrintConv => {
73
+ OTHER => \&PrintRecord,
74
+ 0x00 => 'End Marker',
75
+ 0x01 => 'Start WPG',
76
+ 0x02 => 'End WPG',
77
+ 0x03 => 'Form Settings',
78
+ 0x04 => 'Ruler Settings',
79
+ 0x05 => 'Grid Settings',
80
+ 0x06 => 'Layer',
81
+ 0x08 => 'Pen Style Definition',
82
+ 0x09 => 'Pattern Definition',
83
+ 0x0a => 'Comment',
84
+ 0x0b => 'Color Transfer',
85
+ 0x0c => 'Color Palette',
86
+ 0x0d => 'DP Color Palette',
87
+ 0x0e => 'Bitmap Data',
88
+ 0x0f => 'Text Data',
89
+ 0x10 => 'Chart Style',
90
+ 0x11 => 'Chart Data',
91
+ 0x12 => 'Object Image',
92
+ 0x15 => 'Polyline',
93
+ 0x16 => 'Polyspline',
94
+ 0x17 => 'Polycurve',
95
+ 0x18 => 'Rectangle',
96
+ 0x19 => 'Arc',
97
+ 0x1a => 'Compound Polygon',
98
+ 0x1b => 'Bitmap',
99
+ 0x1c => 'Text Line',
100
+ 0x1d => 'Text Block',
101
+ 0x1e => 'Text Path',
102
+ 0x1f => 'Chart',
103
+ 0x20 => 'Group',
104
+ 0x21 => 'Object Capsule',
105
+ 0x22 => 'Font Settings',
106
+ 0x25 => 'Pen Fore Color',
107
+ 0x26 => 'DP Pen Fore Color',
108
+ 0x27 => 'Pen Back Color',
109
+ 0x28 => 'DP Pen Back Color',
110
+ 0x29 => 'Pen Style',
111
+ 0x2a => 'Pen Pattern',
112
+ 0x2b => 'Pen Size',
113
+ 0x2c => 'DP Pen Size',
114
+ 0x2d => 'Line Cap',
115
+ 0x2e => 'Line Join',
116
+ 0x2f => 'Brush Gradient',
117
+ 0x30 => 'DP Brush Gradient',
118
+ 0x31 => 'Brush Fore Color',
119
+ 0x32 => 'DP Brush Fore Color',
120
+ 0x33 => 'Brush Back Color',
121
+ 0x34 => 'DP Brush Back Color',
122
+ 0x35 => 'Brush Pattern',
123
+ 0x36 => 'Horizontal Line',
124
+ 0x37 => 'Vertical Line',
125
+ 0x38 => 'Poster Settings',
126
+ 0x39 => 'Image State',
127
+ 0x3a => 'Envelope Definition',
128
+ 0x3b => 'Envelope',
129
+ 0x3c => 'Texture Definition',
130
+ 0x3d => 'Brush Texture',
131
+ 0x3e => 'Texture Alignment',
132
+ 0x3f => 'Pen Texture ',
133
+ }
134
+ },
135
+ );
136
+
137
+ #------------------------------------------------------------------------------
138
+ # Print record type
139
+ # Inputs: 0) record type and count, 1) inverse flag, 2) PrintConv hash ref
140
+ # Returns: converted record name
141
+ sub PrintRecord($$$)
142
+ {
143
+ my ($val, $inv, $printConv) = @_;
144
+ my ($type, $count) = split 'x', $val;
145
+ my $prt = $$printConv{$type} || sprintf('Unknown (0x%.2x)', $type);
146
+ $prt .= " x $count" if $count;
147
+ return $prt;
148
+ }
149
+
150
+ #------------------------------------------------------------------------------
151
+ # Read variable-length integer
152
+ # Inputs: 0) RAF ref
153
+ # Returns: integer value
154
+ sub ReadVarInt($)
155
+ {
156
+ my $raf = shift;
157
+ my $buff;
158
+ $raf->Read($buff, 1) or return 0;
159
+ my $val = ord($buff);
160
+ if ($val == 0xff) {
161
+ $raf->Read($buff, 2) == 2 or return 0;
162
+ $val = unpack('v', $buff);
163
+ if ($val & 0x8000) {
164
+ $raf->Read($buff, 2) == 2 or return 0;
165
+ $val = (($val & 0x7fff) << 16) | unpack('v', $buff);
166
+ }
167
+ }
168
+ return $val;
169
+ }
170
+
171
+ #------------------------------------------------------------------------------
172
+ # Read WPG version 1 or 2 image
173
+ # Inputs: 0) ExifTool object reference, 1) dirInfo reference
174
+ # Returns: 1 on success, 0 if this wasn't a valid WPG file
175
+ sub ProcessWPG($$)
176
+ {
177
+ my ($et, $dirInfo) = @_;
178
+ my $raf = $$dirInfo{RAF};
179
+ my ($buff, $lastType, $count);
180
+
181
+ # verify this is a valid WPG file
182
+ return 0 unless $raf->Read($buff, 16) == 16;
183
+ return 0 unless $buff =~ /^\xff\x57\x50\x43/;
184
+ $et->SetFileType();
185
+ SetByteOrder('II');
186
+ my $tagTablePtr = GetTagTable('Image::ExifTool::WPG::Main');
187
+ my $offset = Get32u(\$buff, 4);
188
+ my ($ver, $rev) = unpack('x10CC', $buff);
189
+ $et->HandleTag($tagTablePtr, WPGVersion => "$ver.$rev");
190
+ if ($ver < 1 or $ver > 2) {
191
+ # currently support only version 1 and 2 formats
192
+ $et->Warn('Unsupported WPG version');
193
+ return 1;
194
+ }
195
+ my $tag = $ver == 1 ? 'Records' : 'RecordsV2';
196
+ $raf->Seek($offset - 16, 1) or return 1 if $offset > 16;
197
+ # loop through records
198
+ for (;;) {
199
+ my ($type, $len, $getSize);
200
+ if ($raf->Read($buff, $ver) == $ver) { # read 1 or 2 bytes, based on version
201
+ if ($ver == 1) {
202
+ # read version 1 record header
203
+ $type = ord($buff);
204
+ $len = ReadVarInt($raf);
205
+ $getSize = 1 if $type == 0x0f; # Start WPG (Type 1)
206
+ } else {
207
+ # read version 2 record header
208
+ $type = unpack('xC', $buff);
209
+ ReadVarInt($raf); # skip extensions
210
+ $len = ReadVarInt($raf);
211
+ $getSize = 1 if $type == 0x01; # Start WPG
212
+ undef $type if $type > 0x3f;
213
+ }
214
+ if ($getSize) {
215
+ # read Start record to obtain image size
216
+ $raf->Read($buff, $len) == $len or $et->Warn('File format error'), last;
217
+ my ($w, $h, $xres, $yres);
218
+ if ($ver == 1) {
219
+ ($w, $h) = unpack('x2vv', $buff);
220
+ } else {
221
+ my ($precision, $format);
222
+ ($xres, $yres, $precision) = unpack('vvC', $buff);
223
+ if ($precision == 0 and $len >= 21) {
224
+ $format = 'int16s';
225
+ } elsif ($precision == 1 and $len >= 29) {
226
+ $format = 'int32s';
227
+ } else {
228
+ $et->Warn('Invalid integer precision');
229
+ next;
230
+ }
231
+ my ($x1,$y1,$x2,$y2) = ReadValue(\$buff, 13, $format, 4, $len-13);
232
+ $w = abs($x2 - $x1);
233
+ $h = abs($y2 - $y1);
234
+ }
235
+ $et->HandleTag($tagTablePtr, ImageWidthInches => $w / ($xres || 1200));
236
+ $et->HandleTag($tagTablePtr, ImageHeightInches => $h / ($yres || 1200));
237
+ } else {
238
+ $raf->Seek($len, 1) or last; # skip to the next record
239
+ }
240
+ }
241
+ # go to some trouble to collapse identical sequential entries in record list
242
+ # (trying to keep the length of the list managable for complex images)
243
+ $lastType and $type and $type == $lastType and ++$count, next;
244
+ if ($lastType) {
245
+ my $val = $count > 1 ? "${lastType}x$count" : $lastType;
246
+ $et->HandleTag($tagTablePtr, $tag => $val);
247
+ }
248
+ last unless $type;
249
+ $lastType = $type;
250
+ $count = 1;
251
+ }
252
+ return 1;
253
+ }
254
+
255
+ 1; # end
256
+
257
+ __END__
258
+
259
+ =head1 NAME
260
+
261
+ Image::ExifTool::WPG - Read WPG meta information
262
+
263
+ =head1 SYNOPSIS
264
+
265
+ This module is used by Image::ExifTool
266
+
267
+ =head1 DESCRIPTION
268
+
269
+ This module contains definitions required by Image::ExifTool to read WPG
270
+ (WordPerfect Graphics) images.
271
+
272
+ =head1 AUTHOR
273
+
274
+ Copyright 2003-2023, Phil Harvey (philharvey66 at gmail.com)
275
+
276
+ This library is free software; you can redistribute it and/or modify it
277
+ under the same terms as Perl itself.
278
+
279
+ =head1 REFERENCES
280
+
281
+ =over 4
282
+
283
+ =item L<https://www.fileformat.info/format/wpg/egff.htm>
284
+
285
+ =item L<https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996/page/n991/mode/2up>
286
+
287
+ =item L<http://libwpg.sourceforge.net/>
288
+
289
+ =back
290
+
291
+ =head1 SEE ALSO
292
+
293
+ L<Image::ExifTool::TagNames/WPG Tags>,
294
+ L<Image::ExifTool(3pm)|Image::ExifTool>
295
+
296
+ =cut
@@ -420,15 +420,15 @@ sub ValidateImageData($$$;$)
420
420
  }
421
421
 
422
422
  #------------------------------------------------------------------------------
423
- # Add specified image data to ImageDataMD5 hash
423
+ # Add specified image data to ImageDataHash hash
424
424
  # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) lookup for [tagInfo,value] based on tagID
425
- sub AddImageDataMD5($$$)
425
+ sub AddImageDataHash($$$)
426
426
  {
427
427
  my ($et, $dirInfo, $offsetInfo) = @_;
428
428
  my ($tagID, $offset, $buff);
429
429
 
430
430
  my $verbose = $et->Options('Verbose');
431
- my $md5 = $$et{ImageDataMD5};
431
+ my $hash = $$et{ImageDataHash};
432
432
  my $raf = $$dirInfo{RAF};
433
433
 
434
434
  foreach $tagID (sort keys %$offsetInfo) {
@@ -451,12 +451,12 @@ sub AddImageDataMD5($$$)
451
451
  my $size = shift @sizes;
452
452
  next unless $offset =~ /^\d+$/ and $size and $size =~ /^\d+$/ and $size;
453
453
  next unless $raf->Seek($offset, 0); # (offset is absolute)
454
- $total += $et->ImageDataMD5($raf, $size);
454
+ $total += $et->ImageDataHash($raf, $size);
455
455
  }
456
456
  if ($verbose) {
457
457
  my $name = "$$dirInfo{DirName}:$$tagInfo{Name}";
458
458
  $name =~ s/Offsets?|Start$//;
459
- $et->VPrint(0, "$$et{INDENT}(ImageDataMD5: $total bytes of $name data)\n");
459
+ $et->VPrint(0, "$$et{INDENT}(ImageDataHash: $total bytes of $name data)\n");
460
460
  }
461
461
  }
462
462
  }
@@ -780,7 +780,7 @@ Entry: for (;;) {
780
780
  $readFormat = $oldFormat = Get16u($dataPt, $entry+2);
781
781
  $readCount = $oldCount = Get32u($dataPt, $entry+4);
782
782
  undef $oldImageData;
783
- if ($oldFormat < 1 or $oldFormat > 13 and not ($oldFormat == 16 and $$et{Make} eq 'Apple' and $inMakerNotes)) {
783
+ if (($oldFormat < 1 or $oldFormat > 13) and $oldFormat != 129 and not ($oldFormat == 16 and $$et{Make} eq 'Apple' and $inMakerNotes)) {
784
784
  my $msg = "Bad format ($oldFormat) for $name entry $index";
785
785
  # patch to preserve invalid directory entries in SubIFD3 of
786
786
  # various Kodak Z-series cameras (Z812, Z1085IS, Z1275)
@@ -1277,7 +1277,9 @@ NoWrite: next if $isNew > 0;
1277
1277
  $et->Warn("Writing large value for $name",1);
1278
1278
  }
1279
1279
  # re-code if necessary
1280
- if ($strEnc and $newFormName eq 'string') {
1280
+ if ($newFormName eq 'utf8') {
1281
+ $newValue = $et->Encode($newValue, 'UTF8');
1282
+ } elsif ($strEnc and $newFormName eq 'string') {
1281
1283
  $newValue = $et->Encode($newValue, $strEnc);
1282
1284
  }
1283
1285
  } else {
@@ -23,7 +23,7 @@ my $beginComment = '%BeginExifToolUpdate';
23
23
  my $endComment = '%EndExifToolUpdate ';
24
24
 
25
25
  my $keyExt; # crypt key extension
26
- my $pdfVer; # version of PDF file we are currently writing
26
+ my $pdfVer; # version of PDF file we are writing (highest Version in Root dictionaries)
27
27
 
28
28
  # internal tags used in dictionary objects
29
29
  my %myDictTags = (
@@ -297,15 +297,11 @@ sub WritePDF($$)
297
297
  $$newTool{PDF_CAPTURE} = \%capture;
298
298
  my $info = $newTool->ImageInfo($raf, 'XMP', 'PDF:*', 'Error', 'Warning');
299
299
  # not a valid PDF file unless we got a version number
300
- # (note: can't just check $$info{PDFVersion} due to possibility of XMP-pdf:PDFVersion)
301
- my $vers = $newTool->GetInfo('PDF:PDFVersion');
302
- # take highest version number if multiple versions in an incremental save
303
- ($pdfVer) = sort { $b <=> $a } values %$vers;
300
+ $pdfVer = $$newTool{PDFVersion};
304
301
  $pdfVer or $et->Error('Missing PDF:PDFVersion'), return 0;
305
302
  # check version number
306
- if ($pdfVer > 1.7) {
307
- $et->Warn("The PDF $pdfVer specification is not freely available", 1);
308
- # (so writing by ExifTool is based on trial and error)
303
+ if ($pdfVer > 2.0) {
304
+ $et->Error("Writing PDF $pdfVer is untested", 1) and return 0;
309
305
  }
310
306
  # fail if we had any serious errors while extracting information
311
307
  if ($capture{Error} or $$info{Error}) {
@@ -412,6 +408,9 @@ sub WritePDF($$)
412
408
  my $tagID;
413
409
  foreach $tagID (sort keys %$newTags) {
414
410
  my $tagInfo = $$newTags{$tagID};
411
+ if ($pdfVer >= 2.0 and not $$tagInfo{PDF2}) {
412
+ next if $et->Warn("Writing PDF:$$tagInfo{Name} is deprecated for PDF 2.0 documents",2);
413
+ }
415
414
  my $nvHash = $et->GetNewValueHash($tagInfo);
416
415
  my (@vals, $deleted);
417
416
  my $tag = $$tagInfo{Name};
@@ -973,16 +973,14 @@ sub WriteQuickTime($$$)
973
973
  }
974
974
  } elsif ($tag eq 'CTBO' or $tag eq 'uuid') { # hack for updating CR3 CTBO offsets
975
975
  push @{$$dirInfo{ChunkOffset}}, [ $tag, length($$outfile), length($hdr) + $size ];
976
- } elsif (not $flg) {
977
- my $grp = $$et{CUR_WRITE_GROUP} || $parent;
978
- $et->Error("Can't locate data reference to update offsets for $grp");
979
- return $rtnVal;
976
+ } elsif (not $flg or $flg == 1) {
977
+ # assume "1" if stsd is yet to be read
978
+ $flg or $$et{AssumedDataRef} = 1;
979
+ # must update offsets since the data is in this file
980
+ push @{$$dirInfo{ChunkOffset}}, [ $tag, length($$outfile) + length($hdr), $size ];
980
981
  } elsif ($flg == 3) {
981
982
  $et->Error("Can't write files with mixed internal/external media data");
982
983
  return $rtnVal;
983
- } elsif ($flg == 1) {
984
- # must update offsets since the data is in this file
985
- push @{$$dirInfo{ChunkOffset}}, [ $tag, length($$outfile) + length($hdr), $size ];
986
984
  }
987
985
  }
988
986
 
@@ -1036,8 +1034,10 @@ sub WriteQuickTime($$$)
1036
1034
 
1037
1035
  if ($subdir) { # process atoms in this container from a buffer in memory
1038
1036
 
1039
- undef $$et{HandlerType} if $tag eq 'trak'; # init handler type for this track
1040
-
1037
+ if ($tag eq 'trak') {
1038
+ undef $$et{HandlerType}; # init handler type for this track
1039
+ delete $$et{AssumedDataRef};
1040
+ }
1041
1041
  my $subName = $$subdir{DirName} || $$tagInfo{Name};
1042
1042
  my $start = $$subdir{Start} || 0;
1043
1043
  my $base = ($$dirInfo{Base} || 0) + $raf->Tell() - $size;
@@ -1103,6 +1103,11 @@ sub WriteQuickTime($$$)
1103
1103
  $$et{CHANGED} = $oldChanged;
1104
1104
  undef $newData;
1105
1105
  }
1106
+ if ($tag eq 'trak' and $$et{AssumedDataRef}) {
1107
+ my $grp = $$et{CUR_WRITE_GROUP} || $dirName;
1108
+ $et->Error("Can't locate data reference to update offsets for $grp");
1109
+ delete $$et{AssumedDataRef};
1110
+ }
1106
1111
  $$et{CUR_WRITE_GROUP} = $oldWriteGroup;
1107
1112
  SetByteOrder('MM');
1108
1113
  # add back header if necessary
@@ -1405,6 +1410,13 @@ sub WriteQuickTime($$$)
1405
1410
  $flg = 1; # (this seems to be the case)
1406
1411
  }
1407
1412
  $$et{QtDataFlg} = $flg;
1413
+ if ($$et{AssumedDataRef}) {
1414
+ if ($flg != $$et{AssumedDataRef}) {
1415
+ my $grp = $$et{CUR_WRITE_GROUP} || $parent;
1416
+ $et->Error("Assumed incorrect data reference for $grp (was $flg)");
1417
+ }
1418
+ delete $$et{AssumedDataRef};
1419
+ }
1408
1420
  }
1409
1421
  if ($tagInfo and $$tagInfo{WriteLast}) {
1410
1422
  $writeLast = ($writeLast || '') . $hdr . $buff;
@@ -176,7 +176,7 @@ sub CheckXMP($$$;$)
176
176
  require 'Image/ExifTool/XMPStruct.pl';
177
177
  my ($item, $err, $w, $warn);
178
178
  unless (ref $$valPtr) {
179
- ($$valPtr, $warn) = InflateStruct($valPtr);
179
+ ($$valPtr, $warn) = InflateStruct($et, $valPtr);
180
180
  # expect a structure HASH ref or ARRAY of structures
181
181
  unless (ref $$valPtr) {
182
182
  $$valPtr eq '' and $$valPtr = { }, return undef; # allow empty structures
@@ -189,7 +189,7 @@ sub CheckXMP($$$;$)
189
189
  $$valPtr = \@copy; # return the copy
190
190
  foreach $item (@copy) {
191
191
  unless (ref $item eq 'HASH') {
192
- ($item, $w) = InflateStruct(\$item); # deserialize structure
192
+ ($item, $w) = InflateStruct($et, \$item); # deserialize structure
193
193
  $w and $warn = $w;
194
194
  next if ref $item eq 'HASH';
195
195
  $err = 'Improperly formed structure';