exiftool_vendored 12.70.0 → 12.72.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ meta information extracted from or written to a file.
12
12
  =head1 TAG TABLES
13
13
 
14
14
  The tables listed below give the names of all tags recognized by ExifTool.
15
- They contain a total of 27401 tags, with 17199 unique tag names.
15
+ They contain a total of 27451 tags, with 17222 unique tag names.
16
16
 
17
17
  B<Tag ID>, B<Index#> or B<Sequence> is given in the first column of each
18
18
  table. A B<Tag ID> is the computer-readable equivalent of a tag name, and
@@ -63,7 +63,8 @@ writable directly, but is written automatically by ExifTool (often when a
63
63
  corresponding L<Composite|Image::ExifTool::TagNames/Composite Tags> or
64
64
  L<Extra|Image::ExifTool::TagNames/Extra Tags> tag is written). A colon
65
65
  (C<:>) indicates a I<Mandatory> tag which may be added automatically when
66
- writing. Normally MakerNotes tags may not be deleted individually, but a
66
+ writing (use the API NoMandatory option to avoid creating mandatory EXIF
67
+ tags). Normally MakerNotes tags may not be deleted individually, but a
67
68
  caret (C<^>) indicates a I<Deletable> MakerNotes tag.
68
69
 
69
70
  The HTML version of these tables also lists possible B<Values> for
@@ -482,6 +483,7 @@ for the official EXIF 2.32 specification.
482
483
  0x0214 ReferenceBlackWhite IFD0 rational64u[6]
483
484
  0x022f StripRowCounts - no
484
485
  0x02bc ApplicationNotes IFD0 XMP
486
+ 0x0303 RenderingIntent - no
485
487
  0x03e7 USPTOMiscellaneous - no
486
488
  0x1000 RelatedImageFileFormat InteropIFD string!
487
489
  0x1001 RelatedImageWidth InteropIFD int16u!
@@ -814,6 +816,8 @@ for the official EXIF 2.32 specification.
814
816
  0x9403 WaterDepth ExifIFD rational64s
815
817
  0x9404 Acceleration ExifIFD rational64u
816
818
  0x9405 CameraElevationAngle ExifIFD rational64s
819
+ 0x9999 XiaomiSettings ExifIFD JSON
820
+ 0x9a00 XiaomiModel ExifIFD string!
817
821
  0x9c9b XPTitle IFD0 int8u
818
822
  0x9c9c XPComment IFD0 int8u
819
823
  0x9c9d XPAuthor IFD0 int8u
@@ -8873,7 +8877,7 @@ CameraInfo tags for the EOS R6.
8873
8877
 
8874
8878
  =head3 Canon CameraInfoG5XII Tags
8875
8879
 
8876
- CameraInfo tags for the EOS R6.
8880
+ CameraInfo tags for the PowerShot G5 X Mark II.
8877
8881
 
8878
8882
  Index1 Tag Name Writable
8879
8883
  ------ -------- --------
@@ -9464,6 +9468,7 @@ These tags are used by many EOS M and PowerShot models.
9464
9468
  255 ColorCalib2? Canon ColorCalib2
9465
9469
  264 PerChannelBlackLevel int16s[4]
9466
9470
  333 PerChannelBlackLevel int16s[4]
9471
+ 662 SpecularWhiteLevel int16u
9467
9472
  1385 NormalWhiteLevel int16u
9468
9473
  1386 SpecularWhiteLevel int16u
9469
9474
 
@@ -10122,6 +10127,7 @@ This information is new in images from the EOS 7D.
10122
10127
  4 LongExposureNoiseReduction int32s
10123
10128
  5 HighISONoiseReduction int32s
10124
10129
  10 DigitalLensOptimizer int32s
10130
+ 11 DualPixelRaw int32s
10125
10131
 
10126
10132
  =head3 Canon LensInfo Tags
10127
10133
 
@@ -12038,6 +12044,9 @@ group name for these tags is "M-RAW".
12038
12044
  Tag ID Tag Name Writable
12039
12045
  ------ -------- --------
12040
12046
  0x0001 RawImageNumber no
12047
+ 0x0005 ExposureTime no
12048
+ 0x0006 FNumber no
12049
+ 0x0007 ISO no
12041
12050
 
12042
12051
  =head3 FujiFilm FFMV Tags
12043
12052
 
@@ -15028,6 +15037,7 @@ These tags are extracted from encrypted data in images from the D6.
15028
15037
  Index1 Tag Name Writable
15029
15038
  ------ -------- --------
15030
15039
  36 IntervalShooting int16u~
15040
+ 43 ImageArea int8u
15031
15041
 
15032
15042
  =head3 Nikon IntervalInfoD6 Tags
15033
15043
 
@@ -15081,6 +15091,7 @@ These tags are extracted from encrypted data in images from the Z7II.
15081
15091
  Index1 Tag Name Writable
15082
15092
  ------ -------- --------
15083
15093
  36 IntervalShooting int16u~
15094
+ 43 ImageArea int8u
15084
15095
 
15085
15096
  =head3 Nikon PortraitInfoZ7II Tags
15086
15097
 
@@ -15306,8 +15317,8 @@ These tags are extracted from encrypted data in images from the Z9.
15306
15317
  ------ -------- --------
15307
15318
  3048 AFAreaInitialXPosition int8s~
15308
15319
  3049 AFAreaInitialYPosition int8s~
15309
- 3050 AFAreaInitialWidth no
15310
- 3051 AFAreaInitialHeight no
15320
+ 3050 AFAreaInitialWidth int8u
15321
+ 3051 AFAreaInitialHeight int8u
15311
15322
 
15312
15323
  =head3 Nikon AutoCaptureInfo Tags
15313
15324
 
@@ -16179,7 +16190,27 @@ cameras such as the Z6 and Z7, and NRW images from some Coolpix cameras.
16179
16190
 
16180
16191
  Tag ID Tag Name Writable
16181
16192
  ------ -------- --------
16182
- [no tags known]
16193
+ 0x0005 DistortionInfo Nikon DistortionInfo
16194
+ 0x0006 VignetteInfo Nikon VignetteInfo
16195
+
16196
+ =head3 Nikon DistortionInfo Tags
16197
+
16198
+ Index1 Tag Name Writable
16199
+ ------ -------- --------
16200
+ 0 DistortionCorrectionVersion string[4]
16201
+ 4 DistortionCorrection int8u
16202
+ 20 RadialDistortionCoefficient1 rational64s~
16203
+ 28 RadialDistortionCoefficient2 rational64s~
16204
+ 36 RadialDistortionCoefficient3 rational64s~
16205
+
16206
+ =head3 Nikon VignetteInfo Tags
16207
+
16208
+ Index1 Tag Name Writable
16209
+ ------ -------- --------
16210
+ 0 VignetteCorrectionVersion string[4]
16211
+ 36 VignetteCoefficient1 rational64s~
16212
+ 52 VignetteCoefficient2 rational64s~
16213
+ 68 VignetteCoefficient3 rational64s~
16183
16214
 
16184
16215
  =head3 Nikon AVI Tags
16185
16216
 
@@ -20623,6 +20654,7 @@ such as the Galaxy S4.
20623
20654
 
20624
20655
  Tag ID Tag Name Writable
20625
20656
  ------ -------- --------
20657
+ 'mdln' SamsungModel no
20626
20658
  'svss' SamsungSvss Samsung svss
20627
20659
 
20628
20660
  =head3 Samsung svss Tags
@@ -20806,6 +20838,43 @@ defined below, ExifTool will extract any information found here.
20806
20838
  'thum' ThumbnailImage no
20807
20839
  'ucmt' Comment no
20808
20840
 
20841
+ =head3 Ricoh RDTA Tags
20842
+
20843
+ Tag ID Tag Name Writable
20844
+ ------ -------- --------
20845
+ 0x0000 Accelerometer no
20846
+ 0x0010 TimeStamp no
20847
+
20848
+ =head3 Ricoh RDTB Tags
20849
+
20850
+ Tag ID Tag Name Writable
20851
+ ------ -------- --------
20852
+ 0x0000 Gyroscope no
20853
+ 0x0010 TimeStamp no
20854
+
20855
+ =head3 Ricoh RDTC Tags
20856
+
20857
+ Tag ID Tag Name Writable
20858
+ ------ -------- --------
20859
+ 0x0000 MagneticField no
20860
+ 0x0010 TimeStamp no
20861
+
20862
+ =head3 Ricoh RDTG Tags
20863
+
20864
+ Tag ID Tag Name Writable
20865
+ ------ -------- --------
20866
+ 0x0000 TimeStamp no
20867
+ 0x0064 FrameNumber no
20868
+
20869
+ =head3 Ricoh RDTL Tags
20870
+
20871
+ Tag ID Tag Name Writable
20872
+ ------ -------- --------
20873
+ 0x0000 GPSDateTime no
20874
+ 0x0008 GPSLatitude no
20875
+ 0x0010 GPSLongitude no
20876
+ 0x0018 GPSAltitude no
20877
+
20809
20878
  =head2 Sigma Tags
20810
20879
 
20811
20880
  These tags are written by Sigma/Foveon cameras. In the early days Sigma was
@@ -21012,6 +21081,7 @@ MakerNotes.
21012
21081
  0x2036 Clarity int32s
21013
21082
  0x2037 FocusFrameSize no
21014
21083
  0x2039 JPEG-HEIFSwitch int16u
21084
+ 0x2044 HiddenInfo Sony HiddenInfo
21015
21085
  0x204a FocusLocation2 int16u[4]
21016
21086
  0x3000 ShotInfo Sony ShotInfo
21017
21087
  0x900b Tag900b Sony Tag900b
@@ -21984,6 +22054,13 @@ option is used.
21984
22054
  58 FocalPlaneAFPointLocation14 int16u[2]
21985
22055
  62 FocalPlaneAFPointLocation15 int16u[2]
21986
22056
 
22057
+ =head3 Sony HiddenInfo Tags
22058
+
22059
+ Index4 Tag Name Writable
22060
+ ------ -------- --------
22061
+ 0 HiddenDataOffset int32u
22062
+ 1 HiddenDataLength int32u
22063
+
21987
22064
  =head3 Sony ShotInfo Tags
21988
22065
 
21989
22066
  Index1 Tag Name Writable
@@ -22992,6 +23069,41 @@ information.
22992
23069
  2 DynamicRange no
22993
23070
  4 HintMaxOutputValue no
22994
23071
 
23072
+ =head2 JSON Tags
23073
+
23074
+ Other than a few tags in the table below, JSON tags have not been
23075
+ pre-defined. However, ExifTool will read any existing tags from basic
23076
+ JSON-formatted files.
23077
+
23078
+ Tag Name Writable
23079
+ -------- --------
23080
+ ON1_SettingsData PLIST
23081
+ ON1_SettingsMetadataCreated no
23082
+ ON1_SettingsMetadataModified no
23083
+ ON1_SettingsMetadataName no
23084
+ ON1_SettingsMetadataPluginID no
23085
+ ON1_SettingsMetadataTimestamp no
23086
+ ON1_SettingsMetadataUsage no
23087
+ ON1_SettingsMetadataVisibleToUser no
23088
+
23089
+ =head2 CBOR Tags
23090
+
23091
+ The tags below are extracted from CBOR (Concise Binary Object
23092
+ Representation) metadata. The C2PA specification uses this format for some
23093
+ metadata. As well as these tags, ExifTool will read any existing tags.
23094
+
23095
+ Tag Name Writable
23096
+ -------- --------
23097
+ AuthorIdentifier no
23098
+ AuthorName no
23099
+ DocumentID no
23100
+ Format no
23101
+ InstanceID no
23102
+ Relationship no
23103
+ ThumbnailHash no+
23104
+ ThumbnailURL no
23105
+ Title no
23106
+
22995
23107
  =head2 PLIST Tags
22996
23108
 
22997
23109
  Apple Property List tags. ExifTool reads both XML and binary-format PLIST
@@ -23850,6 +23962,7 @@ L<https://github.com/gopro/gpmf-parser> for details about this format.
23850
23962
 
23851
23963
  Tag ID Tag Name Writable
23852
23964
  ------ -------- --------
23965
+ 'AALP' AudioLevel no
23853
23966
  'ACCL' Accelerometer no
23854
23967
  'ALLD' AutoLowLightDuration no
23855
23968
  'ATTD' Attitude no
@@ -23857,6 +23970,7 @@ L<https://github.com/gopro/gpmf-parser> for details about this format.
23857
23970
  'AUDO' AudioSetting no
23858
23971
  'BPOS' Controller? no
23859
23972
  'CASN' CameraSerialNumber no
23973
+ 'CORI' CameraOrientation no
23860
23974
  'CSEN' CoyoteSense no
23861
23975
  'CYTS' CoyoteStatus no
23862
23976
  'DEVC' DeviceContainer GoPro GPMF
@@ -23874,10 +23988,14 @@ L<https://github.com/gopro/gpmf-parser> for details about this format.
23874
23988
  'GLPI' GPSPos GoPro GLPI
23875
23989
  'GPRI' GPSRaw? GoPro GPRI
23876
23990
  'GPS5' GPSInfo GoPro GPS5
23991
+ 'GPSA' GPSAltitudeSystem no
23877
23992
  'GPSF' GPSMeasureMode no
23878
23993
  'GPSP' GPSHPositioningError no
23879
23994
  'GPSU' GPSDateTime no
23995
+ 'GRAV' GravityVector no
23880
23996
  'GYRO' Gyroscope no
23997
+ 'HUES' PrediminantHue no
23998
+ 'IORI' ImageOrientation no
23881
23999
  'ISOE' ISOSpeeds no
23882
24000
  'ISOG' ImageSensorGain no
23883
24001
  'KBAT' BatteryStatus GoPro KBAT
@@ -23886,6 +24004,7 @@ L<https://github.com/gopro/gpmf-parser> for details about this format.
23886
24004
  'MINF' Model no
23887
24005
  'MTRX' AccelerometerMatrix no
23888
24006
  'MUID' MediaUniqueID no
24007
+ 'MWET' MicrophoneWet no
23889
24008
  'OREN' AutoRotation no
23890
24009
  'ORIN' InputOrientation no
23891
24010
  'ORIO' OutputOrientation no
@@ -23901,6 +24020,7 @@ L<https://github.com/gopro/gpmf-parser> for details about this format.
23901
24020
  'RATE' Rate no
23902
24021
  'RMRK' Comments no
23903
24022
  'SCAL' ScaleFactor? no
24023
+ 'SCEN' SceneClassification no
23904
24024
  'SCPR' ScaledPressure no
23905
24025
  'SHUT' ExposureTimes no
23906
24026
  'SIMU' ScaledIMU no
@@ -23919,7 +24039,9 @@ L<https://github.com/gopro/gpmf-parser> for details about this format.
23919
24039
  'VFOV' FieldOfView no
23920
24040
  'VFRH' VisualFlightRulesHUD no
23921
24041
  'WBAL' ColorTemperatures no
24042
+ 'WNDM' WindProcessing no
23922
24043
  'WRGB' WhiteBalanceRGB no
24044
+ 'YAVG' LumaAverage no
23923
24045
 
23924
24046
  =head3 GoPro GLPI Tags
23925
24047
 
@@ -25405,41 +25527,6 @@ Information extracted from the JUMBF description box.
25405
25527
  8 DisplayYResolutionUnit no
25406
25528
  9 DisplayXResolutionUnit no
25407
25529
 
25408
- =head2 JSON Tags
25409
-
25410
- Other than a few tags in the table below, JSON tags have not been
25411
- pre-defined. However, ExifTool will read any existing tags from basic
25412
- JSON-formatted files.
25413
-
25414
- Tag Name Writable
25415
- -------- --------
25416
- ON1_SettingsData PLIST
25417
- ON1_SettingsMetadataCreated no
25418
- ON1_SettingsMetadataModified no
25419
- ON1_SettingsMetadataName no
25420
- ON1_SettingsMetadataPluginID no
25421
- ON1_SettingsMetadataTimestamp no
25422
- ON1_SettingsMetadataUsage no
25423
- ON1_SettingsMetadataVisibleToUser no
25424
-
25425
- =head2 CBOR Tags
25426
-
25427
- The tags below are extracted from CBOR (Concise Binary Object
25428
- Representation) metadata. The C2PA specification uses this format for some
25429
- metadata. As well as these tags, ExifTool will read any existing tags.
25430
-
25431
- Tag Name Writable
25432
- -------- --------
25433
- AuthorIdentifier no
25434
- AuthorName no
25435
- DocumentID no
25436
- Format no
25437
- InstanceID no
25438
- Relationship no
25439
- ThumbnailHash no+
25440
- ThumbnailURL no
25441
- Title no
25442
-
25443
25530
  =head2 APP12 Tags
25444
25531
 
25445
25532
  =head3 APP12 PictureInfo Tags
@@ -29154,7 +29241,7 @@ for the official specification.
29154
29241
  The tags below are extracted from timed metadata in QuickTime and other
29155
29242
  formats of video files when the ExtractEmbedded option is used. Although
29156
29243
  most of these tags are combined into the single table below, ExifTool
29157
- currently reads 66 different formats of timed GPS metadata from video files.
29244
+ currently reads 67 different formats of timed GPS metadata from video files.
29158
29245
 
29159
29246
  Tag Name Writable
29160
29247
  -------- --------
@@ -29359,6 +29446,7 @@ changed via the config file.
29359
29446
  FrameReadoutTime yes
29360
29447
  'camera.identifier' CameraIdentifier yes
29361
29448
  'collection.user' UserCollection yes
29449
+ 'com.android.capture.fps' AndroidCaptureFPS yes
29362
29450
  'com.android.version' AndroidVersion yes
29363
29451
  'com.apple.photos.captureMode' CaptureMode yes
29364
29452
  'comment' Comment yes
@@ -29377,6 +29465,7 @@ changed via the config file.
29377
29465
  'direction.motion' CameraMotion yes
29378
29466
  'director' Director yes
29379
29467
  'displayname' DisplayName yes
29468
+ 'encoder' Encoder yes
29380
29469
  'genre' Genre yes
29381
29470
  'information' Information yes
29382
29471
  'keywords' Keywords yes
@@ -30336,6 +30425,11 @@ the config file.
30336
30425
  MakerNotePentaxUnknown string
30337
30426
  'PXTH' PentaxPreview Pentax PXTH
30338
30427
  'QVMI' CasioQVMI EXIF
30428
+ 'RDTA' RicohRDTA Ricoh RDTA
30429
+ 'RDTB' RicohRDTB Ricoh RDTB
30430
+ 'RDTC' RicohRDTC Ricoh RDTC
30431
+ 'RDTG' RicohRDTG Ricoh RDTG
30432
+ 'RDTL' RicohRDTL Ricoh RDTL
30339
30433
  'RMKN' RicohRMKN EXIF
30340
30434
  'RTHU' PreviewImage no
30341
30435
  'SDLN' PlayMode string
@@ -31376,6 +31470,15 @@ ARCore accelerometer data.
31376
31470
  ------ -------- --------
31377
31471
  [no tags known]
31378
31472
 
31473
+ =head2 AAC Tags
31474
+
31475
+ Tag ID Tag Name Writable
31476
+ ------ -------- --------
31477
+ 'Bit016-017' ProfileType no
31478
+ 'Bit018-021' SampleRate no
31479
+ 'Bit023-025' Channels no
31480
+ 'Encoder' Encoder no
31481
+
31379
31482
  =head2 Ogg Tags
31380
31483
 
31381
31484
  ExifTool extracts the following types of information from Ogg files. See
@@ -39590,6 +39693,8 @@ values, may created via the ExifTool configuration file.
39590
39693
  GPSLongitudeRef XMP-exif:GPSLongitude no
39591
39694
  GPSPosition GPSLatitude yes!
39592
39695
  GPSLongitude
39696
+ HiddenData Sony:HiddenDataOffset no
39697
+ Sony:HiddenDataLength
39593
39698
  HyperfocalDistance FocalLength no
39594
39699
  Aperture
39595
39700
  CircleOfConfusion
@@ -569,6 +569,7 @@ sub WriteExif($$$)
569
569
  my $imageDataFlag = $$dirInfo{ImageData} || '';
570
570
  my $verbose = $et->Options('Verbose');
571
571
  my $out = $et->Options('TextOut');
572
+ my $noMandatory = $et->Options('NoMandatory');
572
573
  my ($nextIfdPos, %offsetData, $inMakerNotes);
573
574
  my (@offsetInfo, %validateInfo, %xDelete, $strEnc);
574
575
  my $deleteAll = 0;
@@ -698,8 +699,8 @@ sub WriteExif($$$)
698
699
  }
699
700
 
700
701
  # initialize variables to handle mandatory tags
701
- my $mandatory = $mandatory{$dirName};
702
- my ($allMandatory, $addMandatory);
702
+ my ($mandatory, $allMandatory, $addMandatory);
703
+ $mandatory = $mandatory{$dirName} unless $noMandatory;
703
704
  if ($mandatory) {
704
705
  # use X/Y resolution values from JFIF if available
705
706
  if ($dirName eq 'IFD0' and defined $$et{JFIFYResolution}) {
@@ -1152,7 +1153,7 @@ Entry: for (;;) {
1152
1153
  }
1153
1154
  my $nvHash;
1154
1155
  $nvHash = $et->GetNewValueHash($curInfo, $dirName) if $isNew >= 0;
1155
- unless ($nvHash or defined $$mandatory{$newID}) {
1156
+ unless ($nvHash or (defined $$mandatory{$newID} and not $noMandatory)) {
1156
1157
  goto NoWrite unless $wrongDir; # GOTO !
1157
1158
  # delete stuff from the wrong directory if setting somewhere else
1158
1159
  $nvHash = $et->GetNewValueHash($curInfo, $wrongDir);
@@ -2235,6 +2236,19 @@ NoOverwrite: next if $isNew > 0;
2235
2236
 
2236
2237
  # do our fixups now so we can more easily calculate offsets below
2237
2238
  $fixup->ApplyFixup(\$newData);
2239
+ # write Sony HiddenData now if this is an ARW file
2240
+ if ($$et{HiddenData} and not $$dirInfo{Fixup} and $$et{FILE_TYPE} eq 'TIFF') {
2241
+ $fixup->SetMarkerPointers(\$newData, 'HiddenData', length($newData));
2242
+ my $hbuf;
2243
+ my $hd = $$et{HiddenData};
2244
+ if ($raf->Seek($$hd{Offset}, 0) and $raf->Read($hbuf, $$hd{Size}) == $$hd{Size} and
2245
+ $hbuf =~ /^\x55\x26\x11\x05\0/)
2246
+ {
2247
+ $newData .= $hbuf;
2248
+ } else {
2249
+ $et->Error('Error copying hidden data', 1);
2250
+ }
2251
+ }
2238
2252
  #
2239
2253
  # determine total block size for deferred data
2240
2254
  #
@@ -2625,8 +2639,9 @@ NoOverwrite: next if $isNew > 0;
2625
2639
  $$fixup{Shift} += $newDataPos;
2626
2640
  $fixup->ApplyFixup(\$newData);
2627
2641
  }
2628
- # save fixup for adjusting Leica trailer offset if necessary
2642
+ # save fixup for adjusting Leica trailer and Sony HiddenData offsets if necessary
2629
2643
  $$et{LeicaTrailer}{Fixup}->AddFixup($fixup) if $$et{LeicaTrailer};
2644
+ $$et{HiddenData}{Fixup}->AddFixup($fixup) if $$et{HiddenData};
2630
2645
  # save fixup for PreviewImage in JPEG file if necessary
2631
2646
  my $previewInfo = $$et{PREVIEW_INFO};
2632
2647
  if ($previewInfo) {
@@ -690,6 +690,12 @@ TAG: foreach $tagInfo (@matchingTags) {
690
690
  $writeProc = $$src{WRITE_PROC} unless $writeProc;
691
691
  }
692
692
  {
693
+ # make sure module is loaded if the writeProc is a string
694
+ unless (ref $writeProc) {
695
+ my $module = $writeProc;
696
+ $module =~ s/::\w+$//;
697
+ eval "require $module";
698
+ }
693
699
  no strict 'refs';
694
700
  next unless $writeProc and &$writeProc();
695
701
  }
@@ -3239,9 +3245,15 @@ sub InsertTagValues($$$;$$$)
3239
3245
  $tag = $docGrp . ':' . $tag;
3240
3246
  $lcTag = lc $tag;
3241
3247
  }
3242
- my $et = $self;
3248
+ my ($et, $fileTags) = ($self, $foundTags);
3243
3249
  if ($tag =~ s/(\bfile\d+)://i) {
3244
- $et = $$self{ALT_EXIFTOOL}{ucfirst lc $1} or $et=$self, $tag = 'no_alt_file';
3250
+ $et = $$self{ALT_EXIFTOOL}{ucfirst lc $1};
3251
+ if ($et) {
3252
+ $fileTags = $$et{FoundTags};
3253
+ } else {
3254
+ $et = $self;
3255
+ $tag = 'no_alt_file';
3256
+ }
3245
3257
  }
3246
3258
  if ($lcTag eq 'all') {
3247
3259
  $val = 1; # always some tag available
@@ -3252,11 +3264,11 @@ sub InsertTagValues($$$;$$$)
3252
3264
  ($group, $tag) = ($1, $2);
3253
3265
  if (lc $tag eq 'all') {
3254
3266
  # see if any tag from the specified group exists
3255
- my $match = $et->GroupMatches($group, $foundTags);
3267
+ my $match = $et->GroupMatches($group, $fileTags);
3256
3268
  $val = $match ? 1 : 0;
3257
3269
  } else {
3258
3270
  # find the specified tag
3259
- my @matches = grep /^$tag(\s|$)/i, @$foundTags;
3271
+ my @matches = grep /^$tag(\s|$)/i, @$fileTags;
3260
3272
  @matches = $et->GroupMatches($group, \@matches);
3261
3273
  foreach $tg (@matches) {
3262
3274
  if (defined $val and $tg =~ / \((\d+)\)$/) {
@@ -3276,7 +3288,7 @@ sub InsertTagValues($$$;$$$)
3276
3288
  $val = $et->GetValue($tag, $type);
3277
3289
  unless (defined $val) {
3278
3290
  # check for tag name with different case
3279
- ($tg) = grep /^$tag$/i, @$foundTags;
3291
+ ($tg) = grep /^$tag$/i, @$fileTags;
3280
3292
  if (defined $tg) {
3281
3293
  $val = $et->GetValue($tg, $type);
3282
3294
  $tag = $tg;
@@ -3927,7 +3939,7 @@ sub RemoveNewValuesForGroup($$)
3927
3939
  my $wgrp = $$nvHash{WriteGroup};
3928
3940
  # use group1 if write group is not specific
3929
3941
  $wgrp = $grp1 if $wgrp eq $grp0;
3930
- if (grep /^($grp0|$wgrp)$/i, @groups) {
3942
+ if ($grp0 eq '*' or $wgrp eq '*' or grep /^($grp0|$wgrp)$/i, @groups) {
3931
3943
  $out and print $out "Removed new value for $wgrp:$$tagInfo{Name}\n";
3932
3944
  # remove from linked list
3933
3945
  $self->RemoveNewValueHash($nvHash, $tagInfo);
@@ -4663,9 +4675,18 @@ sub DumpUnknownTrailer($$)
4663
4675
  # account for preview/MPF image trailer
4664
4676
  my $prePos = $$self{VALUE}{PreviewImageStart} || $$self{PreviewImageStart};
4665
4677
  my $preLen = $$self{VALUE}{PreviewImageLength} || $$self{PreviewImageLength};
4678
+ my $hidPos = $$self{VALUE}{HiddenDataOffset};
4679
+ my $hidLen = $$self{VALUE}{HiddenDataLength};
4666
4680
  my $tag = 'PreviewImage';
4667
4681
  my $mpImageNum = 0;
4668
4682
  my (%image, $lastOne);
4683
+ # add HiddenData to list of known trailer blocks
4684
+ if ($hidPos and $hidLen) {
4685
+ # call ReadHiddenData to validate hidden data and fix offset if necessary
4686
+ require Image::ExifTool::Sony;
4687
+ my $datPt = Image::ExifTool::Sony::ReadHiddenData($self, $hidPos, $hidLen);
4688
+ $image{$hidPos} = ['HiddenData', $hidLen] if $datPt;
4689
+ }
4669
4690
  for (;;) {
4670
4691
  # add to Preview block list if valid and in the trailer
4671
4692
  $image{$prePos} = [$tag, $preLen] if $prePos and $preLen and $prePos+$preLen > $pos;
@@ -5780,13 +5801,16 @@ sub WriteJPEG($$)
5780
5801
  }
5781
5802
  }
5782
5803
  # switch to buffered output if required
5783
- if (($$self{PREVIEW_INFO} or $$self{LeicaTrailer}) and not $oldOutfile) {
5804
+ if (($$self{PREVIEW_INFO} or $$self{LeicaTrailer} or $$self{HiddenData}) and
5805
+ not $oldOutfile)
5806
+ {
5784
5807
  $writeBuffer = '';
5785
5808
  $oldOutfile = $outfile;
5786
5809
  $outfile = \$writeBuffer;
5787
5810
  # account for segment, EXIF and TIFF headers
5788
5811
  $$self{PREVIEW_INFO}{Fixup}{Start} += 18 if $$self{PREVIEW_INFO};
5789
5812
  $$self{LeicaTrailer}{Fixup}{Start} += 18 if $$self{LeicaTrailer};
5813
+ $$self{HiddenData}{Fixup}{Start} += 18 if $$self{HiddenData};
5790
5814
  }
5791
5815
  # write as multi-segment
5792
5816
  my $n = WriteMultiSegment($outfile, 0xe1, $exifAPP1hdr, \$buff, 'EXIF');
@@ -5932,7 +5956,9 @@ sub WriteJPEG($$)
5932
5956
  my $delPreview = $$self{DEL_PREVIEW};
5933
5957
  $trailInfo = IdentifyTrailer($raf) unless $$delGroup{Trailer};
5934
5958
  my $nvTrail = $self->GetNewValueHash($Image::ExifTool::Extra{Trailer});
5935
- unless ($oldOutfile or $delPreview or $trailInfo or $$delGroup{Trailer} or $nvTrail) {
5959
+ unless ($oldOutfile or $delPreview or $trailInfo or $$delGroup{Trailer} or $nvTrail or
5960
+ $$self{HiddenData})
5961
+ {
5936
5962
  # blindly copy the rest of the file
5937
5963
  while ($raf->Read($buff, 65536)) {
5938
5964
  Write($outfile, $buff) or $err = 1, last;
@@ -5962,7 +5988,7 @@ sub WriteJPEG($$)
5962
5988
  $endedWithFF = substr($buff, 65535, 1) eq "\xff" ? 1 : 0;
5963
5989
  }
5964
5990
  # remember position of last data copied
5965
- $endPos = $raf->Tell() - length($buff);
5991
+ $endPos = $$self{TrailerStart} = $raf->Tell() - length($buff);
5966
5992
  # write new trailer if specified
5967
5993
  if ($nvTrail) {
5968
5994
  # access new value directly to avoid copying a potentially very large data block
@@ -5976,6 +6002,34 @@ sub WriteJPEG($$)
5976
6002
  }
5977
6003
  last; # all done
5978
6004
  }
6005
+ # copy HiddenData if necessary
6006
+ if ($$self{HiddenData}) {
6007
+ my $pad;
6008
+ my $hd = $$self{HiddenData};
6009
+ my $hdOff = $$hd{Offset} + $$hd{Base};
6010
+ require Image::ExifTool::Sony;
6011
+ # read HiddenData, updating $hdOff with actual offset if necessary
6012
+ my $dataPt = Image::ExifTool::Sony::ReadHiddenData($self, $hdOff, $$hd{Size});
6013
+ if ($dataPt) {
6014
+ # preserve padding to avoid invalidating MPF pointers (yuk!)
6015
+ my $padLen = $hdOff - $endPos;
6016
+ unless ($padLen >= 0 and $raf->Seek($endPos,0) and $raf->Read($pad,$padLen)==$padLen) {
6017
+ $self->Error('Error reading HiddenData padding',1);
6018
+ $pad = '';
6019
+ }
6020
+ $endPos += length($pad) + length($$dataPt); # update end position
6021
+ } else {
6022
+ $$dataPt = $pad = '';
6023
+ }
6024
+ my $fixup = $$self{HiddenData}{Fixup};
6025
+ # set MakerNote pointer and size (subtract 10 for segment and EXIF headers)
6026
+ $fixup->SetMarkerPointers($outfile, 'HiddenData', length($$outfile) + length($pad) - 10);
6027
+ # clean up and write the buffered data
6028
+ $outfile = $oldOutfile;
6029
+ undef $oldOutfile;
6030
+ Write($outfile, $writeBuffer, $pad, $$dataPt) or $err = 1;
6031
+ undef $writeBuffer;
6032
+ }
5979
6033
  # rewrite existing trailers
5980
6034
  if ($trailInfo) {
5981
6035
  my $tbuf = '';
@@ -6085,7 +6139,7 @@ sub WriteJPEG($$)
6085
6139
  $delPreview = 1; # remove old preview
6086
6140
  }
6087
6141
  }
6088
- # copy over preview image if necessary
6142
+ # copy over preview image (or other data) if necessary
6089
6143
  unless ($delPreview) {
6090
6144
  my $extra;
6091
6145
  if ($trailInfo) {
@@ -6252,13 +6306,16 @@ sub WriteJPEG($$)
6252
6306
  }
6253
6307
  }
6254
6308
  # switch to buffered output if required
6255
- if (($$self{PREVIEW_INFO} or $$self{LeicaTrailer}) and not $oldOutfile) {
6309
+ if (($$self{PREVIEW_INFO} or $$self{LeicaTrailer} or $$self{HiddenData}) and
6310
+ not $oldOutfile)
6311
+ {
6256
6312
  $writeBuffer = '';
6257
6313
  $oldOutfile = $outfile;
6258
6314
  $outfile = \$writeBuffer;
6259
6315
  # must account for segment, EXIF and TIFF headers
6260
6316
  $$self{PREVIEW_INFO}{Fixup}{Start} += 18 if $$self{PREVIEW_INFO};
6261
6317
  $$self{LeicaTrailer}{Fixup}{Start} += 18 if $$self{LeicaTrailer};
6318
+ $$self{HiddenData}{Fixup}{Start} += 18 if $$self{HiddenData};
6262
6319
  }
6263
6320
  # write as multi-segment
6264
6321
  my $n = WriteMultiSegment($outfile, $marker, $exifAPP1hdr, $segDataPt, 'EXIF');
@@ -7123,14 +7180,24 @@ sub WriteBinaryData($$$)
7123
7180
  # ignore if offset is zero (eg. Ricoh DNG uses this to indicate no preview)
7124
7181
  next unless $offset;
7125
7182
  $fixup->AddFixup($entry, $$tagInfo{DataTag}, $format);
7126
- # handle the preview image now if this is a JPEG file
7127
- next unless $$self{FILE_TYPE} eq 'JPEG' and $$tagInfo{DataTag} and
7128
- $$tagInfo{DataTag} eq 'PreviewImage' and defined $$tagInfo{OffsetPair};
7183
+ next unless $$tagInfo{DataTag} and defined $$tagInfo{OffsetPair};
7129
7184
  # NOTE: here we assume there are no var-sized tags between the
7130
7185
  # OffsetPair tags. If this ever becomes possible we must recalculate
7131
7186
  # $varSize for the OffsetPair tag here!
7132
7187
  $entry = $$tagInfo{OffsetPair} * $increment + $varSize;
7133
7188
  my $size = ReadValue($dataPt, $entry, $format, 1, $dirLen-$entry);
7189
+ next unless defined $size;
7190
+ if ($$tagInfo{DataTag} eq 'HiddenData') {
7191
+ $$self{HiddenData} = {
7192
+ Offset => $offset,
7193
+ Size => $size,
7194
+ Fixup => new Image::ExifTool::Fixup,
7195
+ Base => $$dirInfo{Base},
7196
+ };
7197
+ next;
7198
+ }
7199
+ # handle the preview image now if this is a JPEG file
7200
+ next unless $$tagInfo{DataTag} eq 'PreviewImage' and $$self{FILE_TYPE} eq 'JPEG';
7134
7201
  my $previewInfo = $$self{PREVIEW_INFO};
7135
7202
  $previewInfo or $previewInfo = $$self{PREVIEW_INFO} = {
7136
7203
  Fixup => new Image::ExifTool::Fixup,