exiftool_vendored 11.48.0 → 11.49.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of exiftool_vendored might be problematic. Click here for more details.

@@ -89,7 +89,8 @@ my %ctboID = (
89
89
  );
90
90
 
91
91
  # mark UserData tags that don't have ItemList counterparts as Preferred
92
- # (and for now, set Writable to 0 for any tag with a RawConv)
92
+ # - and set Preferred to 0 for any Avoid-ed tag
93
+ # - also, for now, set Writable to 0 for any tag with a RawConv and no RawConvInv
93
94
  {
94
95
  my $itemList = \%Image::ExifTool::QuickTime::ItemList;
95
96
  my $userData = \%Image::ExifTool::QuickTime::UserData;
@@ -98,10 +99,12 @@ my %ctboID = (
98
99
  my $tagInfo = $$itemList{$tag};
99
100
  if (ref $tagInfo ne 'HASH') {
100
101
  next if ref $tagInfo;
101
- $tagInfo = $$userData{$tag} = { Name => $tagInfo };
102
+ $tagInfo = $$itemList{$tag} = { Name => $tagInfo };
103
+ } else {
104
+ $$tagInfo{Writable} = 0 if $$tagInfo{RawConv} and not $$tagInfo{RawConvInv};
105
+ $$tagInfo{Avoid} and $$tagInfo{Preferred} = 0, next;
106
+ next if defined $$tagInfo{Preferred} and not $$tagInfo{Preferred};
102
107
  }
103
- $$tagInfo{Writable} = 0 if $$tagInfo{RawConv};
104
- next if $$tagInfo{Avoid} or defined $$tagInfo{Preferred} and not $$tagInfo{Preferred};
105
108
  $pref{$$tagInfo{Name}} = 1;
106
109
  }
107
110
  foreach $tag (TagTableKeys($userData)) {
@@ -109,9 +112,11 @@ my %ctboID = (
109
112
  if (ref $tagInfo ne 'HASH') {
110
113
  next if ref $tagInfo;
111
114
  $tagInfo = $$userData{$tag} = { Name => $tagInfo };
115
+ } else {
116
+ $$tagInfo{Writable} = 0 if $$tagInfo{RawConv} and not $$tagInfo{RawConvInv};
117
+ $$tagInfo{Avoid} and $$tagInfo{Preferred} = 0, next;
118
+ next if defined $$tagInfo{Preferred} or $pref{$$tagInfo{Name}};
112
119
  }
113
- $$tagInfo{Writable} = 0 if $$tagInfo{RawConv};
114
- next if $$tagInfo{Avoid} or defined $$tagInfo{Preferred} or $pref{$$tagInfo{Name}};
115
120
  $$tagInfo{Preferred} = 1;
116
121
  }
117
122
  }
@@ -365,12 +370,23 @@ sub WriteKeys($$$)
365
370
  my $nvHash = $et->GetNewValueHash($tagInfo);
366
371
  # drop this tag if it is being deleted
367
372
  if ($nvHash and $et->IsOverwriting($nvHash) > 0 and not defined $et->GetNewValue($nvHash)) {
368
- # delete this key
369
- $et->VPrint(1, "$$et{INDENT}\[deleting Keys entry $index '${tag}']\n");
370
- $pos += $len;
371
- $remap{$index++} = 0;
372
- ++$$et{CHANGED};
373
- next;
373
+ # don't delete this key if we could be writing any alternate-language version of this tag
374
+ my ($t, $dontDelete);
375
+ foreach $t (keys %$newTags) {
376
+ next unless $$newTags{$t}{SrcTagInfo} and $$newTags{$t}{SrcTagInfo} eq $tagInfo;
377
+ my $nv = $et->GetNewValueHash($$newTags{$t});
378
+ next unless $et->IsOverwriting($nv) and defined $et->GetNewValue($nv);
379
+ $dontDelete = 1;
380
+ last;
381
+ }
382
+ unless ($dontDelete) {
383
+ # delete this key
384
+ $et->VPrint(1, "$$et{INDENT}\[deleting Keys entry $index '${tag}']\n");
385
+ $pos += $len;
386
+ $remap{$index++} = 0;
387
+ ++$$et{CHANGED};
388
+ next;
389
+ }
374
390
  }
375
391
  }
376
392
  }
@@ -674,8 +690,8 @@ sub WriteQuickTime($$$)
674
690
  local $_;
675
691
  my ($et, $dirInfo, $tagTablePtr) = @_;
676
692
  $et or return 1; # allow dummy access to autoload this package
677
- my ($mdat, @mdat, @mdatEdit, $edit, $track, $outBuff, $co, $term, $err, $delCount);
678
- my (%langTags, $canCreate, $delGrp, %boxPos, $createKeys, $newTags, %didDir, $writeLast);
693
+ my ($mdat, @mdat, @mdatEdit, $edit, $track, $outBuff, $co, $term, $delCount);
694
+ my (%langTags, $canCreate, $delGrp, %boxPos, %didDir, $writeLast, $err);
679
695
  my $outfile = $$dirInfo{OutFile} || return 0;
680
696
  my $raf = $$dirInfo{RAF}; # (will be null for lower-level atoms)
681
697
  my $dataPt = $$dirInfo{DataPt}; # (will be null for top-level atoms)
@@ -684,6 +700,8 @@ sub WriteQuickTime($$$)
684
700
  my $parent = $$dirInfo{Parent};
685
701
  my $addDirs = $$et{ADD_DIRS};
686
702
  my $didTag = $$et{DidTag};
703
+ my $newTags = { };
704
+ my $createKeys = 0;
687
705
  my ($rtnVal, $rtnErr) = $dataPt ? (undef, undef) : (1, 0);
688
706
 
689
707
  if ($dataPt) {
@@ -700,18 +718,15 @@ sub WriteQuickTime($$$)
700
718
  my $curPath = join '-', @{$$et{PATH}};
701
719
  my ($dir, $writePath) = ($dirName, $dirName);
702
720
  $writePath = "$dir-$writePath" while defined($dir = $$et{DirMap}{$dir});
703
- # hack for Keys write path (its containing Meta is in a different location)
704
- $createKeys = 1 if $$addDirs{Keys} and $curPath =~ /^MOV-Movie(-Meta(-ItemList)?)?$/;
705
- if ($curPath eq $writePath or $createKeys) {
706
- $canCreate = 1;
707
- $delGrp = $$et{DEL_GROUP}{$dirName};
708
- }
709
- # edit existing Keys tags in ItemList if we are at the correct path
710
- if ($curPath eq 'MOV-Movie-Meta-ItemList') {
711
- $newTags = { };
721
+ # hack to create Keys directories if necessary (its containing Meta is in a different location)
722
+ if ($$addDirs{Keys} and $curPath =~ /^MOV-Movie(-Meta)?$/) {
723
+ $createKeys = 1; # create new Keys directories
724
+ } elsif ($curPath eq 'MOV-Movie-Meta-ItemList') {
725
+ $createKeys = 2; # create new Keys tags
712
726
  my $keys = $$et{Keys};
713
727
  if ($keys) {
714
728
  # add new tag entries for existing Keys tags, now that we know their ID's
729
+ # - first make lookup to convert Keys tagInfo ref to index number
715
730
  my ($index, %keysInfo);
716
731
  foreach $index (keys %{$$keys{Info}}) {
717
732
  $keysInfo{$$keys{Info}{$index}} = $index if $$keys{Remap}{$index};
@@ -723,22 +738,30 @@ sub WriteQuickTime($$$)
723
738
  $index = $keysInfo{$tagInfo} || ($$tagInfo{SrcTagInfo} and $keysInfo{$$tagInfo{SrcTagInfo}});
724
739
  next unless $index;
725
740
  my $id = Set32u($index);
726
- $id .= '-' . $$tagInfo{LangCode} if $$tagInfo{LangCode};
741
+ if ($$tagInfo{LangCode}) {
742
+ # add to lookup of language tags we are writing with this ID
743
+ $langTags{$id} = { } unless $langTags{$id};
744
+ $langTags{$id}{$_} = $tagInfo;
745
+ $id .= '-' . $$tagInfo{LangCode};
746
+ }
727
747
  $$newTags{$id} = $tagInfo;
728
748
  }
729
749
  }
730
750
  } else {
731
751
  # get hash of new tags to edit/create in this directory
732
752
  $newTags = $et->GetNewTagInfoHash($tagTablePtr);
753
+ # make lookup of language tags for each ID
754
+ foreach (keys %$newTags) {
755
+ next unless $$newTags{$_}{LangCode} and $$newTags{$_}{SrcTagInfo};
756
+ my $id = $$newTags{$_}{SrcTagInfo}{TagID};
757
+ $langTags{$id} = { } unless $langTags{$id};
758
+ $langTags{$id}{$_} = $$newTags{$_};
759
+ }
733
760
  }
734
- # make lookup of language tags for each ID
735
- foreach (keys %$newTags) {
736
- next unless $$newTags{$_}{LangCode} and $$newTags{$_}{SrcTagInfo};
737
- my $id = $$newTags{$_}{SrcTagInfo}{TagID};
738
- $langTags{$id} = { } unless $langTags{$id};
739
- $langTags{$id}{$_} = $$newTags{$_};
761
+ if ($curPath eq $writePath or $createKeys) {
762
+ $canCreate = 1;
763
+ $delGrp = $$et{DEL_GROUP}{$dirName};
740
764
  }
741
-
742
765
  for (;;) { # loop through all atoms at this level
743
766
  my ($hdr, $buff, $keysIndex);
744
767
  my $n = $raf->Read($hdr, 8);
@@ -820,12 +843,15 @@ sub WriteQuickTime($$$)
820
843
 
821
844
  # if this atom stores offsets, save its location so we can fix up offsets later
822
845
  # (are there any other atoms that may store absolute file offsets?)
823
- if ($tag =~ /^(stco|co64|iloc|mfra|gps |CTBO|uuid)$/) {
846
+ if ($tag =~ /^(stco|co64|iloc|mfra|moof|sidx|saio|gps |CTBO|uuid)$/) {
824
847
  # (note that we only need to do this if the movie data is stored in this file)
825
848
  my $flg = $$et{QtDataFlg};
826
- if ($tag eq 'mfra') {
849
+ if ($tag eq 'mfra' or $tag eq 'moof') {
827
850
  $et->Error("Can't yet handle movie fragments when writing");
828
851
  return $rtnVal;
852
+ } elsif ($tag eq 'sidx' or $tag eq 'saio') {
853
+ $et->Error("Can't yet handle $tag box when writing");
854
+ return $rtnVal;
829
855
  } elsif ($tag eq 'iloc') {
830
856
  Handle_iloc($et, $dirInfo, \$buff, $outfile) or $et->Error('Error parsing iloc atom');
831
857
  } elsif ($tag eq 'gps ') {
@@ -1083,7 +1109,6 @@ sub WriteQuickTime($$$)
1083
1109
  my $grp = $et->GetGroup($langInfo, 1);
1084
1110
  $et->VerboseValue("- $grp:$$langInfo{Name}", $val);
1085
1111
  $et->VerboseValue("+ $grp:$$langInfo{Name}", $prVal);
1086
- $$didTag{$nvHash} = 1 if $nvHash;
1087
1112
  $newData = substr($buff, 0, $pos-16) unless defined $newData;
1088
1113
  $newData .= pack('Na4Nnn', length($newVal)+16, $type, $flags, $ctry, $lang);
1089
1114
  $newData .= $newVal;
@@ -1094,6 +1119,7 @@ sub WriteQuickTime($$$)
1094
1119
  } elsif (defined $newData) {
1095
1120
  $newData .= substr($buff, $pos, $len);
1096
1121
  }
1122
+ $$didTag{$nvHash} = 1 if $nvHash;
1097
1123
  }
1098
1124
  $newData .= substr($buff, $pos) if defined $newData and $pos < $size;
1099
1125
  undef $val; # (already constructed $newData)
@@ -1136,24 +1162,26 @@ sub WriteQuickTime($$$)
1136
1162
  } else {
1137
1163
  $val = $buff;
1138
1164
  }
1139
- if ($nvHash and defined $val and $et->IsOverwriting($nvHash, $val)) {
1140
- $newData = $et->GetNewValue($nvHash);
1141
- $newData = '' unless defined $newData or $canCreate;
1142
- ++$$et{CHANGED};
1143
- my $grp = $et->GetGroup($langInfo, 1);
1144
- $et->VerboseValue("- $grp:$$langInfo{Name}", $val);
1145
- next unless defined $newData and not $$didTag{$nvHash};
1146
- $et->VerboseValue("+ $grp:$$langInfo{Name}", $newData);
1147
- $$didTag{$nvHash} = 1; # set flag so we don't add this tag again
1148
- # add back necessary header and encode as necessary
1149
- if (defined $lang) {
1150
- $newData = $et->Encode($newData, $lang < 0x400 ? $charsetQuickTime : 'UTF8');
1151
- if ($$tagInfo{IText} and $$tagInfo{IText} == 6) {
1152
- $newData = pack('Nn', 0, $lang) . $newData . "\0";
1153
- } else {
1154
- $newData = pack('nn', length($newData), $lang) . $newData;
1165
+ if ($nvHash and defined $val) {
1166
+ if ($et->IsOverwriting($nvHash, $val)) {
1167
+ $newData = $et->GetNewValue($nvHash);
1168
+ $newData = '' unless defined $newData or $canCreate;
1169
+ ++$$et{CHANGED};
1170
+ my $grp = $et->GetGroup($langInfo, 1);
1171
+ $et->VerboseValue("- $grp:$$langInfo{Name}", $val);
1172
+ next unless defined $newData and not $$didTag{$nvHash};
1173
+ $et->VerboseValue("+ $grp:$$langInfo{Name}", $newData);
1174
+ # add back necessary header and encode as necessary
1175
+ if (defined $lang) {
1176
+ $newData = $et->Encode($newData, $lang < 0x400 ? $charsetQuickTime : 'UTF8');
1177
+ if ($$tagInfo{IText} and $$tagInfo{IText} == 6) {
1178
+ $newData = pack('Nn', 0, $lang) . $newData . "\0";
1179
+ } else {
1180
+ $newData = pack('nn', length($newData), $lang) . $newData;
1181
+ }
1155
1182
  }
1156
1183
  }
1184
+ $$didTag{$nvHash} = 1; # set flag so we don't add this tag again
1157
1185
  }
1158
1186
  }
1159
1187
  }
@@ -1221,7 +1249,7 @@ sub WriteQuickTime($$$)
1221
1249
  }
1222
1250
  $et->VPrint(0, " [deleting $delCount $dirName tag".($delCount==1 ? '' : 's')."]\n") if $delCount;
1223
1251
 
1224
- undef $createKeys unless $$addDirs{Keys}; # (Keys may have been written)
1252
+ $createKeys &= ~0x01 unless $$addDirs{Keys}; # (Keys may have been written)
1225
1253
 
1226
1254
  # add new directories/tags at this level if necessary
1227
1255
  if ($canCreate and (exists $$et{EDIT_DIRS}{$dirName} or $createKeys)) {
@@ -1696,7 +1724,7 @@ sub WriteMOV($$)
1696
1724
  $ftype = 'MOV';
1697
1725
  }
1698
1726
  $et->SetFileType($ftype); # need to set "FileType" tag for a Condition
1699
- $et->InitWriteDirs($dirMap{$ftype}, 'XMP');
1727
+ $et->InitWriteDirs($dirMap{$ftype}, 'XMP', 'QuickTime');
1700
1728
  $$et{DirMap} = $dirMap{$ftype}; # need access to directory map when writing
1701
1729
  # track tags globally to avoid creating multiple tags in the case of duplicate directories
1702
1730
  $$et{DidTag} = { };
@@ -3801,14 +3801,14 @@ sub GetLangInfo($$)
3801
3801
  # initialize ADD_DIRS and EDIT_DIRS hashes for all directories that need
3802
3802
  # to be created or will have tags changed in them
3803
3803
  # Inputs: 0) ExifTool object reference, 1) file type string (or map hash ref)
3804
- # 2) preferred family 0 group name for creating tags
3804
+ # 2) preferred family 0 group for creating tags, 3) alternate preferred group
3805
3805
  # Notes:
3806
3806
  # - the ADD_DIRS and EDIT_DIRS keys are the directory names, and the values
3807
3807
  # are the names of the parent directories (undefined for a top-level directory)
3808
3808
  # - also initializes FORCE_WRITE lookup
3809
- sub InitWriteDirs($$;$)
3809
+ sub InitWriteDirs($$;$$)
3810
3810
  {
3811
- my ($self, $fileType, $preferredGroup) = @_;
3811
+ my ($self, $fileType, $preferredGroup, $altGroup) = @_;
3812
3812
  my $editDirs = $$self{EDIT_DIRS} = { };
3813
3813
  my $addDirs = $$self{ADD_DIRS} = { };
3814
3814
  my $fileDirs = $dirMap{$fileType};
@@ -3827,19 +3827,21 @@ sub InitWriteDirs($$;$)
3827
3827
  for ($nvHash=$self->GetNewValueHash($tagInfo); $nvHash; $nvHash=$$nvHash{Next}) {
3828
3828
  # are we creating this tag? (otherwise just deleting or editing it)
3829
3829
  my $isCreating = $$nvHash{IsCreating};
3830
- if ($isCreating) {
3831
- # if another group is taking priority, only create
3832
- # directory if specifically adding tags to this group
3833
- # or if this tag isn't being added to the priority group
3834
- $isCreating = 0 if $preferredGroup and
3835
- $preferredGroup ne $self->GetGroup($tagInfo, 0) and
3836
- $$nvHash{CreateGroups}{$preferredGroup};
3837
- } else {
3838
- # creating this directory if any tag is preferred and has a value
3839
- # (unless group creation is disabled via the WriteMode option)
3840
- $isCreating = 1 if ($preferredGroup and $$nvHash{Value} and
3841
- $preferredGroup eq $self->GetGroup($tagInfo, 0)) and
3842
- not $$nvHash{EditOnly} and $$self{OPTIONS}{WriteMode} =~ /g/;
3830
+ if ($preferredGroup) {
3831
+ my $g0 = $self->GetGroup($tagInfo, 0);
3832
+ if ($isCreating) {
3833
+ # if another group is taking priority, only create
3834
+ # directory if specifically adding tags to this group
3835
+ # or if this tag isn't being added to the priority group
3836
+ $isCreating = 0 if $preferredGroup ne $g0 and
3837
+ $$nvHash{CreateGroups}{$preferredGroup} and
3838
+ (not $altGroup or $altGroup ne $g0);
3839
+ } else {
3840
+ # create this directory if any tag is preferred and has a value
3841
+ # (unless group creation is disabled via the WriteMode option)
3842
+ $isCreating = 1 if $$nvHash{Value} and $preferredGroup eq $g0 and
3843
+ not $$nvHash{EditOnly} and $$self{OPTIONS}{WriteMode} =~ /g/;
3844
+ }
3843
3845
  }
3844
3846
  # tag belongs to directory specified by WriteGroup, or by
3845
3847
  # the Group0 name if WriteGroup not defined
@@ -1,6 +1,6 @@
1
1
  Summary: perl module for image data extraction
2
2
  Name: perl-Image-ExifTool
3
- Version: 11.48
3
+ Version: 11.49
4
4
  Release: 1
5
5
  License: Artistic/GPL
6
6
  Group: Development/Libraries/Perl
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ExiftoolVendored
4
- VERSION = Gem::Version.new('11.48.0')
4
+ VERSION = Gem::Version.new('11.49.0')
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exiftool_vendored
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.48.0
4
+ version: 11.49.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew McEachen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-06-01 00:00:00.000000000 Z
12
+ date: 2019-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: exiftool