exiftool_vendored 12.16.0 → 12.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Changes +137 -1
  3. data/bin/MANIFEST +12 -0
  4. data/bin/META.json +1 -1
  5. data/bin/META.yml +1 -1
  6. data/bin/README +44 -43
  7. data/bin/config_files/acdsee.config +193 -6
  8. data/bin/config_files/cuepointlist.config +70 -0
  9. data/bin/config_files/example.config +1 -8
  10. data/bin/exiftool +139 -98
  11. data/bin/fmt_files/gpx.fmt +1 -1
  12. data/bin/fmt_files/gpx_wpt.fmt +1 -1
  13. data/bin/fmt_files/kml.fmt +1 -1
  14. data/bin/fmt_files/kml_track.fmt +1 -1
  15. data/bin/lib/Image/ExifTool.pm +158 -49
  16. data/bin/lib/Image/ExifTool.pod +94 -75
  17. data/bin/lib/Image/ExifTool/Apple.pm +3 -2
  18. data/bin/lib/Image/ExifTool/BuildTagLookup.pm +25 -14
  19. data/bin/lib/Image/ExifTool/Canon.pm +28 -3
  20. data/bin/lib/Image/ExifTool/CanonCustom.pm +19 -1
  21. data/bin/lib/Image/ExifTool/DJI.pm +6 -6
  22. data/bin/lib/Image/ExifTool/DjVu.pm +6 -5
  23. data/bin/lib/Image/ExifTool/Exif.pm +50 -22
  24. data/bin/lib/Image/ExifTool/FITS.pm +13 -2
  25. data/bin/lib/Image/ExifTool/FujiFilm.pm +19 -8
  26. data/bin/lib/Image/ExifTool/GPS.pm +24 -13
  27. data/bin/lib/Image/ExifTool/H264.pm +20 -5
  28. data/bin/lib/Image/ExifTool/ICC_Profile.pm +2 -2
  29. data/bin/lib/Image/ExifTool/JPEG.pm +6 -2
  30. data/bin/lib/Image/ExifTool/JSON.pm +24 -3
  31. data/bin/lib/Image/ExifTool/Jpeg2000.pm +361 -16
  32. data/bin/lib/Image/ExifTool/M2TS.pm +40 -4
  33. data/bin/lib/Image/ExifTool/MIE.pm +2 -2
  34. data/bin/lib/Image/ExifTool/MRC.pm +341 -0
  35. data/bin/lib/Image/ExifTool/MWG.pm +3 -3
  36. data/bin/lib/Image/ExifTool/MXF.pm +1 -1
  37. data/bin/lib/Image/ExifTool/MacOS.pm +1 -1
  38. data/bin/lib/Image/ExifTool/Microsoft.pm +298 -82
  39. data/bin/lib/Image/ExifTool/Nikon.pm +5 -5
  40. data/bin/lib/Image/ExifTool/NikonSettings.pm +25 -16
  41. data/bin/lib/Image/ExifTool/Olympus.pm +2 -2
  42. data/bin/lib/Image/ExifTool/PNG.pm +2 -2
  43. data/bin/lib/Image/ExifTool/Panasonic.pm +14 -1
  44. data/bin/lib/Image/ExifTool/PhaseOne.pm +4 -3
  45. data/bin/lib/Image/ExifTool/QuickTime.pm +148 -68
  46. data/bin/lib/Image/ExifTool/QuickTimeStream.pl +94 -34
  47. data/bin/lib/Image/ExifTool/README +5 -4
  48. data/bin/lib/Image/ExifTool/RIFF.pm +84 -12
  49. data/bin/lib/Image/ExifTool/Samsung.pm +2 -1
  50. data/bin/lib/Image/ExifTool/Shortcuts.pm +9 -0
  51. data/bin/lib/Image/ExifTool/Sony.pm +157 -49
  52. data/bin/lib/Image/ExifTool/TagInfoXML.pm +1 -0
  53. data/bin/lib/Image/ExifTool/TagLookup.pm +4079 -3987
  54. data/bin/lib/Image/ExifTool/TagNames.pod +642 -273
  55. data/bin/lib/Image/ExifTool/WriteExif.pl +1 -1
  56. data/bin/lib/Image/ExifTool/WritePostScript.pl +1 -0
  57. data/bin/lib/Image/ExifTool/WriteQuickTime.pl +44 -17
  58. data/bin/lib/Image/ExifTool/WriteXMP.pl +15 -8
  59. data/bin/lib/Image/ExifTool/Writer.pl +50 -14
  60. data/bin/lib/Image/ExifTool/XMP.pm +50 -11
  61. data/bin/perl-Image-ExifTool.spec +42 -42
  62. data/lib/exiftool_vendored/version.rb +1 -1
  63. metadata +52 -12
@@ -31,7 +31,7 @@ use strict;
31
31
  use vars qw($VERSION);
32
32
  use Image::ExifTool qw(:DataAccess :Utils);
33
33
 
34
- $VERSION = '1.18';
34
+ $VERSION = '1.19';
35
35
 
36
36
  # program map table "stream_type" lookup (ref 6/1)
37
37
  my %streamType = (
@@ -57,7 +57,8 @@ my %streamType = (
57
57
  0x13 => 'ISO 14496-1 SL-packetized',
58
58
  0x14 => 'ISO 13818-6 Synchronized Download Protocol',
59
59
  # 0x15-0x7F => 'ISO 13818-1 Reserved',
60
- 0x1b => 'H.264 Video',
60
+ 0x1b => 'H.264 (AVC) Video',
61
+ 0x24 => 'H.265 (HEVC) Video', #PH
61
62
  0x80 => 'DigiCipher II Video',
62
63
  0x81 => 'A52/AC-3 Audio',
63
64
  0x82 => 'HDMV DTS Audio',
@@ -67,6 +68,7 @@ my %streamType = (
67
68
  0x86 => 'DTS-HD Audio',
68
69
  0x87 => 'E-AC-3 Audio',
69
70
  0x8a => 'DTS Audio',
71
+ 0x90 => 'PGS Audio', #https://www.avsforum.com/threads/bass-eq-for-filtered-movies.2995212/page-399
70
72
  0x91 => 'A52b/AC-3 Audio',
71
73
  0x92 => 'DVD_SPU vls Subtitle',
72
74
  0x94 => 'SDDS Audio',
@@ -299,6 +301,33 @@ sub ParsePID($$$$$)
299
301
  } elsif ($type == 0x81 or $type == 0x87 or $type == 0x91) {
300
302
  # AC-3 audio
301
303
  ParseAC3Audio($et, $dataPt);
304
+ } elsif ($type < 0) {
305
+ if ($$dataPt =~ /^(.{164})?(.{24})A[NS][EW]/s) {
306
+ # (Blueskysea B4K, Novatek NT96670)
307
+ # 0000: 01 00 ff 00 30 31 32 33 34 35 37 38 61 62 63 64 [....01234578abcd]
308
+ # 0010: 65 66 67 0a 00 00 00 00 00 00 00 00 00 00 00 00 [efg.............]
309
+ # 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
310
+ # 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
311
+ # 0040: 00 00 00 00 30 31 32 33 34 35 37 38 71 77 65 72 [....01234578qwer]
312
+ # 0050: 74 79 75 69 6f 70 0a 00 00 00 00 00 00 00 00 00 [tyuiop..........]
313
+ # 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
314
+ # 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
315
+ # 0080: 00 00 00 00 63 38 61 61 32 35 63 66 34 35 65 65 [....c8aa25cf45ee]
316
+ # 0090: 61 39 65 32 34 34 32 66 61 65 62 35 65 30 39 39 [a9e2442faeb5e099]
317
+ # 00a0: 30 37 64 34 15 00 00 00 10 00 00 00 1b 00 00 00 [07d4............]
318
+ # 00b0: 15 00 00 00 01 00 00 00 09 00 00 00 41 4e 57 00 [............ANW.]
319
+ # 00c0: 82 9a 57 45 98 b2 00 46 66 66 e4 41 d7 e3 14 43 [..WE...Fff.A...C]
320
+ # 00d0: 01 00 02 00 03 00 04 00 05 00 06 00 [............]
321
+ # (Viofo A119V3)
322
+ # 0000: 08 00 00 00 07 00 00 00 18 00 00 00 15 00 00 00 [................]
323
+ # 0010: 03 00 00 00 0b 00 00 00 41 4e 45 00 01 f2 ac 45 [........ANE....E]
324
+ # 0020: 2d 7f 6e 45 b8 1e 97 41 d7 23 46 43 00 00 00 00 [-.nE...A.#FC....]
325
+ # pad with dummy header and parse with existing FreeGPS code (minimum 92 bytes)
326
+ my $dat = ("\0" x 16) . substr($$dataPt, length($1 || '')) . ("\0" x 20);
327
+ my $tbl = GetTagTable('Image::ExifTool::QuickTime::Stream');
328
+ Image::ExifTool::QuickTime::ProcessFreeGPS($et, { DataPt => \$dat }, $tbl);
329
+ $more = 1;
330
+ }
302
331
  }
303
332
  return $more;
304
333
  }
@@ -352,6 +381,14 @@ sub ProcessM2TS($$)
352
381
  my %needPID = ( 0 => 1 ); # lookup for stream PID's that we still need to parse
353
382
  my $pEnd = 0;
354
383
 
384
+ # scan entire file for GPS program 0x0300 if ExtractEmbedded option is 3 or higher
385
+ # (some dashcams write this program but don't include it in the PMT)
386
+ if (($et->Options('ExtractEmbedded') || 0) > 2) {
387
+ $needPID{0x0300} = 1;
388
+ $pidType{0x0300} = -1;
389
+ $pidName{0x0300} = 'unregistered dashcam GPS';
390
+ }
391
+
355
392
  # parse packets from MPEG-2 Transport Stream
356
393
  for (;;) {
357
394
 
@@ -421,12 +458,11 @@ sub ProcessM2TS($$)
421
458
  my $adaptation_field_exists = $prefix & 0x00000020;
422
459
  my $payload_data_exists = $prefix & 0x00000010;
423
460
  # my $continuity_counter = $prefix & 0x0000000f;
424
-
425
461
  if ($verbose > 1) {
426
462
  my $i = ($raf->Tell() - length($buff) + $pEnd) / $pLen - 1;
427
463
  print $out "Transport packet $i:\n";
428
464
  $et->VerboseDump(\$buff, Len => $pLen, Addr => $i * $pLen, Start => $pos - $prePos);
429
- my $str = $pidName{$pid} ? " ($pidName{$pid})" : '';
465
+ my $str = $pidName{$pid} ? " ($pidName{$pid})" : ' <not in Program Map Table!>';
430
466
  printf $out " Timecode: 0x%.4x\n", Get32u(\$buff, $pos - $prePos) if $pLen == 192;
431
467
  printf $out " Packet ID: 0x%.4x$str\n", $pid;
432
468
  printf $out " Start Flag: %s\n", $payload_unit_start_indicator ? 'Yes' : 'No';
@@ -393,7 +393,7 @@ my %offOn = ( 0 => 'Off', 1 => 'On' );
393
393
  ValueConv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
394
394
  ValueConvInv => 'Image::ExifTool::GPS::ToDMS($self, $val, 0)',
395
395
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
396
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
396
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1, "lat")',
397
397
  },
398
398
  Longitude => {
399
399
  Name => 'GPSLongitude',
@@ -406,7 +406,7 @@ my %offOn = ( 0 => 'Off', 1 => 'On' );
406
406
  ValueConv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
407
407
  ValueConvInv => 'Image::ExifTool::GPS::ToDMS($self, $val, 0)',
408
408
  PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
409
- PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1)',
409
+ PrintConvInv => 'Image::ExifTool::GPS::ToDegrees($val, 1, "lon")',
410
410
  },
411
411
  MeasureMode => {
412
412
  Name => 'GPSMeasureMode',
@@ -0,0 +1,341 @@
1
+ #------------------------------------------------------------------------------
2
+ # File: MRC.pm
3
+ #
4
+ # Description: Read MRC (Medical Research Council) image files
5
+ #
6
+ # Revisions: 2021-04-21 - P. Harvey Created
7
+ #
8
+ # References: 1) https://www.ccpem.ac.uk/mrc_format/mrc2014.php
9
+ # 2) http://legacy.ccp4.ac.uk/html/library.html
10
+ # 3) https://github.com/ccpem/mrcfile/blob/master/mrcfile/dtypes.py
11
+ #
12
+ # Notes: The header is basically identical to the older CCP4 file format
13
+ #------------------------------------------------------------------------------
14
+
15
+ package Image::ExifTool::MRC;
16
+
17
+ use strict;
18
+ use vars qw($VERSION);
19
+ use Image::ExifTool qw(:DataAccess :Utils);
20
+
21
+ $VERSION = '1.00';
22
+
23
+ my %bool = (
24
+ Format => 'int8u',
25
+ PrintConv => { 0 => 'No', 1 => 'Yes' }
26
+ );
27
+
28
+ %Image::ExifTool::MRC::Main = (
29
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
30
+ GROUPS => { 0 => 'File', 1 => 'File', 2 => 'Image' },
31
+ VARS => { NO_LOOKUP => 1 }, # omit tags from lookup
32
+ FORMAT => 'int32u',
33
+ NOTES => q{
34
+ Tags extracted from Medical Research Council (MRC) format imaging files.
35
+ See L<https://www.ccpem.ac.uk/mrc_format/mrc2014.php> for the specification.
36
+ },
37
+ 0 => 'ImageWidth',
38
+ 1 => 'ImageHeight',
39
+ 2 => {
40
+ Name => 'ImageDepth',
41
+ Notes => q{
42
+ number of sections. Use ExtractEmbedded option to extract metadata for all
43
+ sections
44
+ },
45
+ RawConv => '$$self{ImageDepth} = $val',
46
+ },
47
+ 3 => {
48
+ Name => 'ImageMode',
49
+ PrintConv => {
50
+ 0 => '8-bit signed integer',
51
+ 1 => '16-bit signed integer',
52
+ 2 => '32-bit signed real',
53
+ 3 => 'complex 16-bit integer',
54
+ 4 => 'complex 32-bit real',
55
+ 6 => '16-bit unsigned integer',
56
+ },
57
+ },
58
+ 4 => { Name => 'StartPoint', Format => 'int32u[3]' },
59
+ 7 => { Name => 'GridSize', Format => 'int32u[3]' },
60
+ 10 => { Name => 'CellWidth', Format => 'float', Notes => 'cell size in angstroms' },
61
+ 11 => { Name => 'CellHeight',Format => 'float' },
62
+ 12 => { Name => 'CellDepth', Format => 'float' },
63
+ 13 => { Name => 'CellAlpha', Format => 'float' },
64
+ 14 => { Name => 'CellBeta', Format => 'float' },
65
+ 15 => { Name => 'CellGamma', Format => 'float' },
66
+ 16 => { Name => 'ImageWidthAxis', PrintConv => { 1 => 'X', 2 => 'Y', 3 => 'Z' } },
67
+ 17 => { Name => 'ImageHeightAxis', PrintConv => { 1 => 'X', 2 => 'Y', 3 => 'Z' } },
68
+ 18 => { Name => 'ImageDepthAxis', PrintConv => { 1 => 'X', 2 => 'Y', 3 => 'Z' } },
69
+ 19 => { Name => 'DensityMin', Format => 'float' },
70
+ 20 => { Name => 'DensityMax', Format => 'float' },
71
+ 21 => { Name => 'DensityMean',Format => 'float' },
72
+ 22 => 'SpaceGroupNumber',
73
+ 23 => { Name => 'ExtendedHeaderSize', RawConv => '$$self{ExtendedHeaderSize} = $val' },
74
+ 26 => { Name => 'ExtendedHeaderType', Format => 'string[4]', RawConv => '$$self{ExtendedHeaderType} = $val' },
75
+ 27 => 'MRCVersion',
76
+ 49 => { Name => 'Origin', Format => 'float[3]' },
77
+ 53 => { Name => 'MachineStamp', Format => 'int8u[4]', PrintConv => 'sprintf("0x%.2x 0x%.2x 0x%.2x 0x%.2x",split " ", $val)' },
78
+ 54 => { Name => 'RMSDeviation', Format => 'float' },
79
+ 55 => { Name => 'NumberOfLabels', RawConv => '$$self{NLab} = $val' },
80
+ 56 => { Name => 'Label0', Format => 'string[80]', Condition => '$$self{NLab} > 0' },
81
+ 76 => { Name => 'Label1', Format => 'string[80]', Condition => '$$self{NLab} > 1' },
82
+ 96 => { Name => 'Label2', Format => 'string[80]', Condition => '$$self{NLab} > 2' },
83
+ 116 => { Name => 'Label3', Format => 'string[80]', Condition => '$$self{NLab} > 3' },
84
+ 136 => { Name => 'Label4', Format => 'string[80]', Condition => '$$self{NLab} > 4' },
85
+ 156 => { Name => 'Label5', Format => 'string[80]', Condition => '$$self{NLab} > 5' },
86
+ 176 => { Name => 'Label6', Format => 'string[80]', Condition => '$$self{NLab} > 6' },
87
+ 196 => { Name => 'Label7', Format => 'string[80]', Condition => '$$self{NLab} > 7' },
88
+ 216 => { Name => 'Label8', Format => 'string[80]', Condition => '$$self{NLab} > 8' },
89
+ 236 => { Name => 'Label9', Format => 'string[80]', Condition => '$$self{NLab} > 9' },
90
+ );
91
+
92
+ %Image::ExifTool::MRC::FEI12 = (
93
+ PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
94
+ GROUPS => { 0 => 'File', 1 => 'File', 2 => 'Image' },
95
+ VARS => { NO_LOOKUP => 1 }, # omit tags from lookup (way too many!)
96
+ NOTES => 'Tags extracted from FEI1 and FEI2 extended headers.',
97
+ 0 => { Name => 'MetadataSize', Format => 'int32u', RawConv => '$$self{MetadataSize} = $val' },
98
+ 4 => { Name => 'MetadataVersion', Format => 'int32u' },
99
+ 8 => {
100
+ Name => 'Bitmask1',
101
+ Format => 'int32u',
102
+ RawConv => '$$self{BitM} = $val',
103
+ PrintConv => 'sprintf("0x%.8x", $val)',
104
+ },
105
+ 12 => {
106
+ Name => 'TimeStamp',
107
+ Format => 'double',
108
+ Condition => '$$self{BitM} & 0x01',
109
+ Groups => { 2 => 'Time'},
110
+ # shift from days since Dec 30, 1899 to Unix epoch of Jan 1, 1970
111
+ # (my sample looks like local time, although it should be UTC)
112
+ ValueConv => 'ConvertUnixTime(($val-25569)*24*3600)',
113
+ PrintConv => '$self->ConvertDateTime($val)',
114
+ },
115
+ 20 => { Name => 'MicroscopeType', Format => 'string[16]', Condition => '$$self{BitM} & 0x02' },
116
+ 36 => { Name => 'MicroscopeID', Format => 'string[16]', Condition => '$$self{BitM} & 0x04' },
117
+ 52 => { Name => 'Application', Format => 'string[16]', Condition => '$$self{BitM} & 0x08' },
118
+ 68 => { Name => 'AppVersion', Format => 'string[16]', Condition => '$$self{BitM} & 0x10' },
119
+ 84 => { Name => 'HighTension', Format => 'double', Condition => '$$self{BitM} & 0x20', Notes => 'volts' },
120
+ 92 => { Name => 'Dose', Format => 'double', Condition => '$$self{BitM} & 0x40', Notes => 'electrons/m2' },
121
+ 100 => { Name => 'AlphaTilt', Format => 'double', Condition => '$$self{BitM} & 0x80' },
122
+ 108 => { Name => 'BetaTilt', Format => 'double', Condition => '$$self{BitM} & 0x100' },
123
+ 116 => { Name => 'XStage', Format => 'double', Condition => '$$self{BitM} & 0x200' },
124
+ 124 => { Name => 'YStage', Format => 'double', Condition => '$$self{BitM} & 0x400' },
125
+ 132 => { Name => 'ZStage', Format => 'double', Condition => '$$self{BitM} & 0x800' },
126
+ 140 => { Name => 'TiltAxisAngle', Format => 'double', Condition => '$$self{BitM} & 0x1000' },
127
+ 148 => { Name => 'DualAxisRot', Format => 'double', Condition => '$$self{BitM} & 0x2000' },
128
+ 156 => { Name => 'PixelSizeX', Format => 'double', Condition => '$$self{BitM} & 0x4000' },
129
+ 164 => { Name => 'PixelSizeY', Format => 'double', Condition => '$$self{BitM} & 0x8000' },
130
+ 220 => { Name => 'Defocus', Format => 'double', Condition => '$$self{BitM} & 0x400000' },
131
+ 228 => { Name => 'STEMDefocus', Format => 'double', Condition => '$$self{BitM} & 0x800000' },
132
+ 236 => { Name => 'AppliedDefocus', Format => 'double', Condition => '$$self{BitM} & 0x1000000' },
133
+ 244 => { Name => 'InstrumentMode', Format => 'int32u', Condition => '$$self{BitM} & 0x2000000', PrintConv => { 1 => 'TEM', 2 => 'STEM' } },
134
+ 248 => { Name => 'ProjectionMode', Format => 'int32u', Condition => '$$self{BitM} & 0x4000000', PrintConv => { 1 => 'Diffraction', 2 => 'Imaging' } },
135
+ 252 => { Name => 'ObjectiveLens', Format => 'string[16]', Condition => '$$self{BitM} & 0x8000000' },
136
+ 268 => { Name => 'HighMagnificationMode', Format => 'string[16]', Condition => '$$self{BitM} & 0x10000000' },
137
+ 284 => { Name => 'ProbeMode', Format => 'int32u', Condition => '$$self{BitM} & 0x20000000', PrintConv => { 1 => 'Nano', 2 => 'Micro' } },
138
+ 288 => { Name => 'EFTEMOn', %bool, Condition => '$$self{BitM} & 0x40000000' },
139
+ 289 => { Name => 'Magnification', Format => 'double', Condition => '$$self{BitM} & 0x80000000' },
140
+ 297 => {
141
+ Name => 'Bitmask2',
142
+ Format => 'int32u',
143
+ RawConv => '$$self{BitM} = $val',
144
+ PrintConv => 'sprintf("0x%.8x", $val)',
145
+ },
146
+ 301 => { Name => 'CameraLength', Format => 'double', Condition => '$$self{BitM} & 0x01' },
147
+ 309 => { Name => 'SpotIndex', Format => 'int32u', Condition => '$$self{BitM} & 0x02' },
148
+ 313 => { Name => 'IlluminationArea',Format => 'double', Condition => '$$self{BitM} & 0x04' },
149
+ 321 => { Name => 'Intensity', Format => 'double', Condition => '$$self{BitM} & 0x08' },
150
+ 329 => { Name => 'ConvergenceAngle',Format => 'double', Condition => '$$self{BitM} & 0x10' },
151
+ 337 => { Name => 'IlluminationMode',Format => 'string[16]', Condition => '$$self{BitM} & 0x20' },
152
+ 353 => { Name => 'WideConvergenceAngleRange', %bool, Condition => '$$self{BitM} & 0x40' },
153
+ 354 => { Name => 'SlitInserted', %bool, Condition => '$$self{BitM} & 0x80' },
154
+ 355 => { Name => 'SlitWidth', Format => 'double', Condition => '$$self{BitM} & 0x100' },
155
+ 363 => { Name => 'AccelVoltOffset', Format => 'double', Condition => '$$self{BitM} & 0x200' },
156
+ 371 => { Name => 'DriftTubeVolt', Format => 'double', Condition => '$$self{BitM} & 0x400' },
157
+ 379 => { Name => 'EnergyShift', Format => 'double', Condition => '$$self{BitM} & 0x800' },
158
+ 387 => { Name => 'ShiftOffsetX', Format => 'double', Condition => '$$self{BitM} & 0x1000' },
159
+ 395 => { Name => 'ShiftOffsetY', Format => 'double', Condition => '$$self{BitM} & 0x2000' },
160
+ 403 => { Name => 'ShiftX', Format => 'double', Condition => '$$self{BitM} & 0x4000' },
161
+ 411 => { Name => 'ShiftY', Format => 'double', Condition => '$$self{BitM} & 0x8000' },
162
+ 419 => { Name => 'IntegrationTime', Format => 'double', Condition => '$$self{BitM} & 0x10000' },
163
+ 427 => { Name => 'BinningWidth', Format => 'int32u', Condition => '$$self{BitM} & 0x20000' },
164
+ 431 => { Name => 'BinningHeight', Format => 'int32u', Condition => '$$self{BitM} & 0x40000' },
165
+ 435 => { Name => 'CameraName', Format => 'string[16]', Condition => '$$self{BitM} & 0x80000' },
166
+ 451 => { Name => 'ReadoutAreaLeft', Format => 'int32u', Condition => '$$self{BitM} & 0x100000' },
167
+ 455 => { Name => 'ReadoutAreaTop', Format => 'int32u', Condition => '$$self{BitM} & 0x200000' },
168
+ 459 => { Name => 'ReadoutAreaRight',Format => 'int32u', Condition => '$$self{BitM} & 0x400000' },
169
+ 463 => { Name => 'ReadoutAreaBottom',Format=> 'int32u', Condition => '$$self{BitM} & 0x800000' },
170
+ 467 => { Name => 'CetaNoiseReduct', %bool, Condition => '$$self{BitM} & 0x1000000' },
171
+ 468 => { Name => 'CetaFramesSummed',Format => 'int32u', Condition => '$$self{BitM} & 0x2000000' },
172
+ 472 => { Name => 'DirectDetElectronCounting', %bool, Condition => '$$self{BitM} & 0x4000000' },
173
+ 473 => { Name => 'DirectDetAlignFrames', %bool, Condition => '$$self{BitM} & 0x8000000' },
174
+ 490 => {
175
+ Name => 'Bitmask3',
176
+ Format => 'int32u',
177
+ RawConv => '$$self{BitM} = $val',
178
+ PrintConv => 'sprintf("0x%.8x", $val)',
179
+ },
180
+ 518 => { Name => 'PhasePlate', %bool, Condition => '$$self{BitM} & 0x40' },
181
+ 519 => { Name => 'STEMDetectorName',Format => 'string[16]', Condition => '$$self{BitM} & 0x80' },
182
+ 535 => { Name => 'Gain', Format => 'double', Condition => '$$self{BitM} & 0x100' },
183
+ 543 => { Name => 'Offset', Format => 'double', Condition => '$$self{BitM} & 0x200' },
184
+ 571 => { Name => 'DwellTime', Format => 'double', Condition => '$$self{BitM} & 0x8000' },
185
+ 579 => { Name => 'FrameTime', Format => 'double', Condition => '$$self{BitM} & 0x10000' },
186
+ 587 => { Name => 'ScanSizeLeft', Format => 'int32u', Condition => '$$self{BitM} & 0x20000' },
187
+ 591 => { Name => 'ScanSizeTop', Format => 'int32u', Condition => '$$self{BitM} & 0x40000' },
188
+ 595 => { Name => 'ScanSizeRight', Format => 'int32u', Condition => '$$self{BitM} & 0x80000' },
189
+ 599 => { Name => 'ScanSizeBottom', Format => 'int32u', Condition => '$$self{BitM} & 0x100000' },
190
+ 603 => { Name => 'FullScanFOV_X', Format => 'double', Condition => '$$self{BitM} & 0x200000' },
191
+ 611 => { Name => 'FullScanFOV_Y', Format => 'double', Condition => '$$self{BitM} & 0x400000' },
192
+ 619 => { Name => 'Element', Format => 'string[16]', Condition => '$$self{BitM} & 0x800000' },
193
+ 635 => { Name => 'EnergyIntervalLower', Format => 'double', Condition => '$$self{BitM} & 0x1000000' },
194
+ 643 => { Name => 'EnergyIntervalHigher',Format => 'double', Condition => '$$self{BitM} & 0x2000000' },
195
+ 651 => { Name => 'Method', Format=> 'int32u', Condition => '$$self{BitM} & 0x4000000' },
196
+ 655 => { Name => 'IsDoseFraction', %bool, Condition => '$$self{BitM} & 0x8000000' },
197
+ 656 => { Name => 'FractionNumber', Format => 'int32u', Condition => '$$self{BitM} & 0x10000000' },
198
+ 660 => { Name => 'StartFrame', Format => 'int32u', Condition => '$$self{BitM} & 0x20000000' },
199
+ 664 => { Name => 'EndFrame', Format => 'int32u', Condition => '$$self{BitM} & 0x40000000' },
200
+ 668 => { Name =>'InputStackFilename',Format=> 'string[80]', Condition => '$$self{BitM} & 0x80000000' },
201
+ 748 => {
202
+ Name => 'Bitmask4',
203
+ Format => 'int32u',
204
+ RawConv => '$$self{BitM} = $val',
205
+ PrintConv => 'sprintf("0x%.8x", $val)',
206
+ },
207
+ 752 => { Name => 'AlphaTiltMin', Format => 'double', Condition => '$$self{BitM} & 0x01' },
208
+ 760 => { Name => 'AlphaTiltMax', Format => 'double', Condition => '$$self{BitM} & 0x02' },
209
+ #
210
+ # FEI2 header starts here
211
+ #
212
+ 768 => { Name => 'ScanRotation', Format => 'double', Condition => '$$self{BitM} & 0x04' },
213
+ 776 => { Name => 'DiffractionPatternRotation',Format=>'double', Condition => '$$self{BitM} & 0x08' },
214
+ 784 => { Name => 'ImageRotation', Format => 'double', Condition => '$$self{BitM} & 0x10' },
215
+ 792 => { Name => 'ScanModeEnumeration',Format => 'int32u', Condition => '$$self{BitM} & 0x20', PrintConv => { 0 => 'Other', 1 => 'Raster', 2 => 'Serpentine' } },
216
+ 796 => {
217
+ Name => 'AcquisitionTimeStamp',
218
+ Format => 'int64u',
219
+ Condition => '$$self{BitM} & 0x40',
220
+ Groups => { 2 => 'Time' },
221
+ # microseconds since 1970 UTC
222
+ ValueConv => 'ConvertUnixTime($val / 1e6, 1, 6)',
223
+ PrintConv => '$self->ConvertDateTime($val)',
224
+ },
225
+ 804 => { Name => 'DetectorCommercialName', Format => 'string[16]', Condition => '$$self{BitM} & 0x80' },
226
+ 820 => { Name => 'StartTiltAngle', Format => 'double', Condition => '$$self{BitM} & 0x100' },
227
+ 828 => { Name => 'EndTiltAngle', Format => 'double', Condition => '$$self{BitM} & 0x200' },
228
+ 836 => { Name => 'TiltPerImage', Format => 'double', Condition => '$$self{BitM} & 0x400' },
229
+ 844 => { Name => 'TitlSpeed', Format => 'double', Condition => '$$self{BitM} & 0x800' },
230
+ 852 => { Name => 'BeamCenterX', Format => 'int32u', Condition => '$$self{BitM} & 0x1000' },
231
+ 856 => { Name => 'BeamCenterY', Format => 'int32u', Condition => '$$self{BitM} & 0x2000' },
232
+ 860 => {
233
+ Name => 'CFEGFlashTimeStamp',
234
+ Format => 'int64u',
235
+ Condition => '$$self{BitM} & 0x4000',
236
+ Groups => { 2 => 'Time' },
237
+ ValueConv => 'ConvertUnixTime($val / 1e6, 1, 6)',
238
+ PrintConv => '$self->ConvertDateTime($val)',
239
+ },
240
+ 868 => { Name => 'PhasePlatePosition',Format => 'int32u', Condition => '$$self{BitM} & 0x8000' },
241
+ 872 => { Name => 'ObjectiveAperture', Format=>'string[16]',Condition => '$$self{BitM} & 0x10000' },
242
+ );
243
+
244
+ #------------------------------------------------------------------------------
245
+ # Extract metadata from a MRC image
246
+ # Inputs: 0) ExifTool object reference, 1) dirInfo reference
247
+ # Returns: 1 on success, 0 if this wasn't a valid MRC file
248
+ sub ProcessMRC($$)
249
+ {
250
+ my ($et, $dirInfo) = @_;
251
+ my $raf = $$dirInfo{RAF};
252
+ my ($buff, $tagTablePtr, $i);
253
+
254
+ # verify this is a valid MRC file
255
+ return 0 unless $raf->Read($buff, 1024) == 1024;
256
+ # validate axes, "MAP" file type and machine stamp
257
+ return 0 unless $buff =~ /^.{64}[\x01\x02\x03]\0\0\0[\x01\x02\x03]\0\0\0[\x01\x02\x03]\0\0\0.{132}MAP[\0 ](\x44\x44|\x44\x41|\x11\x11)\0\0/s;
258
+
259
+ $et->SetFileType();
260
+ SetByteOrder('II');
261
+ my %dirInfo = (
262
+ DataPt => \$buff,
263
+ DirStart => 0,
264
+ DirLen => length($buff),
265
+ );
266
+ $tagTablePtr = GetTagTable('Image::ExifTool::MRC::Main');
267
+ $et->ProcessDirectory(\%dirInfo, $tagTablePtr);
268
+
269
+ # (I don't have any samples with extended headers for testing, so these are not yet decoded)
270
+ if ($$et{ExtendedHeaderSize} and $$et{ExtendedHeaderType} =~ /^FEI[12]/) {
271
+ unless ($raf->Read($buff,4)==4 and $raf->Seek(-4,1)) { # read metadata size
272
+ $et->Warn('Error reading extended header');
273
+ return 1;
274
+ }
275
+ my $size = Get32u(\$buff, 0);
276
+ if ($size * $$et{ImageDepth} > $$et{ExtendedHeaderSize}) {
277
+ $et->Warn('Corrupted extended header');
278
+ return 1;
279
+ }
280
+ $dirInfo{DirLen} = $size;
281
+ $tagTablePtr = GetTagTable('Image::ExifTool::MRC::FEI12');
282
+ for ($i=0; ;) {
283
+ $dirInfo{DataPos} = $raf->Tell();
284
+ $raf->Read($buff, $size) == $size or $et->Warn("Error reading extended header $i"), last;
285
+ $et->ProcessDirectory(\%dirInfo, $tagTablePtr);
286
+ last if ++$i >= $$et{ImageDepth};
287
+ unless ($$et{OPTIONS}{ExtractEmbedded}) {
288
+ $et->Warn('Use the ExtractEmbedded option to read metadata for all frames',1);
289
+ last;
290
+ }
291
+ $$et{DOC_NUM} = ++$$et{DOC_COUNT};
292
+ }
293
+ delete $$et{DOC_NUM};
294
+ }
295
+
296
+ return 1;
297
+ }
298
+
299
+ 1; # end
300
+
301
+ __END__
302
+
303
+ =head1 NAME
304
+
305
+ Image::ExifTool::MRC - Read MRC meta information
306
+
307
+ =head1 SYNOPSIS
308
+
309
+ This module is used by Image::ExifTool
310
+
311
+ =head1 DESCRIPTION
312
+
313
+ This module contains definitions required by Image::ExifTool to read
314
+ metadata from Medical Research Council (MRC) images.
315
+
316
+ =head1 AUTHOR
317
+
318
+ Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
319
+
320
+ This library is free software; you can redistribute it and/or modify it
321
+ under the same terms as Perl itself.
322
+
323
+ =head1 REFERENCES
324
+
325
+ =over 4
326
+
327
+ =item L<https://www.ccpem.ac.uk/mrc_format/mrc2014.php>
328
+
329
+ =item L<http://legacy.ccp4.ac.uk/html/library.html>
330
+
331
+ =item L<https://github.com/ccpem/mrcfile/blob/master/mrcfile/dtypes.py>
332
+
333
+ =back
334
+
335
+ =head1 SEE ALSO
336
+
337
+ L<Image::ExifTool::TagNames/MRC Tags>,
338
+ L<Image::ExifTool(3pm)|Image::ExifTool>
339
+
340
+ =cut
341
+
@@ -460,7 +460,7 @@ my %sKeywordStruct;
460
460
  NOTES => q{
461
461
  Image region metadata defined by the MWG 2.0 specification. These tags
462
462
  may be accessed without the need to load the MWG Composite tags above. See
463
- L<https://web.archive.org/web/20181006115950/http://www.metadataworkinggroup.org/specs/>
463
+ L<https://web.archive.org/web/20180919181934/http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf>
464
464
  for the official specification.
465
465
  },
466
466
  Regions => {
@@ -490,7 +490,7 @@ my %sKeywordStruct;
490
490
  ExifTool unrolls keyword structures to an arbitrary depth of 6 to allow
491
491
  individual levels to be accessed with different tag names, and to avoid
492
492
  infinite recursion. See
493
- L<https://web.archive.org/web/20181006115950/http://www.metadataworkinggroup.org/specs/>
493
+ L<https://web.archive.org/web/20180919181934/http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf>
494
494
  for the official specification.
495
495
  },
496
496
  # arbitrarily define only the first 6 levels of the keyword hierarchy
@@ -529,7 +529,7 @@ my %sKeywordStruct;
529
529
  NAMESPACE => 'mwg-coll',
530
530
  NOTES => q{
531
531
  Collections metadata defined by the MWG 2.0 specification. See
532
- L<https://web.archive.org/web/20181006115950/http://www.metadataworkinggroup.org/specs/>
532
+ L<https://web.archive.org/web/20180919181934/http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf>
533
533
  for the official specification.
534
534
  },
535
535
  Collections => {