| 1 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 2 | # File: AIFF.pm | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # Description: Read AIFF meta information | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # Revisions: 01/06/2006 - P. Harvey Created | ||||||||||||||||||||||||||||
| 7 | # 09/22/2008 - PH Added DjVu support | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | # References: 1) http://developer.apple.com/documentation/QuickTime/INMAC/SOUND/imsoundmgr.30.htm#pgfId=3190 | ||||||||||||||||||||||||||||
| 10 | # 2) http://astronomy.swin.edu.au/~pbourke/dataformats/aiff/ | ||||||||||||||||||||||||||||
| 11 | # 3) http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/ | ||||||||||||||||||||||||||||
| 12 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | package Image::ExifTool::AIFF; | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use Image::ExifTool qw(:DataAccess :Utils); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use Image::ExifTool::ID3; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | $VERSION = '1.13'; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | # information for time/date-based tags (time zero is Jan 1, 1904) | ||||||||||||||||||||||||||||
| 24 | 2 | my %timeInfo = ( | |||||||||||||||||||||||||||
| 25 | Groups => { 2 => 'Time' }, | ||||||||||||||||||||||||||||
| 26 | ValueConv => 'ConvertUnixTime($val - ((66 * 365 + 17) * 24 * 3600))', | ||||||||||||||||||||||||||||
| 27 | PrintConv => '$self->ConvertDateTime($val)', | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # AIFF info | ||||||||||||||||||||||||||||
| 31 | 2 | %Image::ExifTool::AIFF::Main = ( | |||||||||||||||||||||||||||
| 32 | GROUPS => { 2 => 'Audio' }, | ||||||||||||||||||||||||||||
| 33 | NOTES => q{ | ||||||||||||||||||||||||||||
| 34 | Tags extracted from Audio Interchange File Format (AIFF) files. See | ||||||||||||||||||||||||||||
| 35 | L<http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/AIFF/AIFF.html> for | ||||||||||||||||||||||||||||
| 36 | the AIFF specification. | ||||||||||||||||||||||||||||
| 37 | }, | ||||||||||||||||||||||||||||
| 38 | # FORM => 'Format', | ||||||||||||||||||||||||||||
| 39 | FVER => { | ||||||||||||||||||||||||||||
| 40 | Name => 'FormatVersion', | ||||||||||||||||||||||||||||
| 41 | SubDirectory => { TagTable => 'Image::ExifTool::AIFF::FormatVers' }, | ||||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||
| 43 | COMM => { | ||||||||||||||||||||||||||||
| 44 | Name => 'Common', | ||||||||||||||||||||||||||||
| 45 | SubDirectory => { TagTable => 'Image::ExifTool::AIFF::Common' }, | ||||||||||||||||||||||||||||
| 46 | }, | ||||||||||||||||||||||||||||
| 47 | COMT => { | ||||||||||||||||||||||||||||
| 48 | Name => 'Comment', | ||||||||||||||||||||||||||||
| 49 | SubDirectory => { TagTable => 'Image::ExifTool::AIFF::Comment' }, | ||||||||||||||||||||||||||||
| 50 | }, | ||||||||||||||||||||||||||||
| 51 | NAME => { | ||||||||||||||||||||||||||||
| 52 | Name => 'Name', | ||||||||||||||||||||||||||||
| 53 | ValueConv => '$self->Decode($val, "MacRoman")', | ||||||||||||||||||||||||||||
| 54 | }, | ||||||||||||||||||||||||||||
| 55 | AUTH => { | ||||||||||||||||||||||||||||
| 56 | Name => 'Author', | ||||||||||||||||||||||||||||
| 57 | Groups => { 2 => 'Author' }, | ||||||||||||||||||||||||||||
| 58 | ValueConv => '$self->Decode($val, "MacRoman")', | ||||||||||||||||||||||||||||
| 59 | }, | ||||||||||||||||||||||||||||
| 60 | '(c) ' => { | ||||||||||||||||||||||||||||
| 61 | Name => 'Copyright', | ||||||||||||||||||||||||||||
| 62 | Groups => { 2 => 'Author' }, | ||||||||||||||||||||||||||||
| 63 | ValueConv => '$self->Decode($val, "MacRoman")', | ||||||||||||||||||||||||||||
| 64 | }, | ||||||||||||||||||||||||||||
| 65 | ANNO => { | ||||||||||||||||||||||||||||
| 66 | Name => 'Annotation', | ||||||||||||||||||||||||||||
| 67 | ValueConv => '$self->Decode($val, "MacRoman")', | ||||||||||||||||||||||||||||
| 68 | }, | ||||||||||||||||||||||||||||
| 69 | 'ID3 ' => { | ||||||||||||||||||||||||||||
| 70 | Name => 'ID3', | ||||||||||||||||||||||||||||
| 71 | SubDirectory => { | ||||||||||||||||||||||||||||
| 72 | TagTable => 'Image::ExifTool::ID3::Main', | ||||||||||||||||||||||||||||
| 73 | ProcessProc => \&Image::ExifTool::ID3::ProcessID3, | ||||||||||||||||||||||||||||
| 74 | }, | ||||||||||||||||||||||||||||
| 75 | }, | ||||||||||||||||||||||||||||
| 76 | APPL => 'ApplicationData', # (first 4 bytes are the application signature) | ||||||||||||||||||||||||||||
| 77 | # SSND => 'SoundData', | ||||||||||||||||||||||||||||
| 78 | # MARK => 'Marker', | ||||||||||||||||||||||||||||
| 79 | # INST => 'Instrument', | ||||||||||||||||||||||||||||
| 80 | # MIDI => 'MidiData', | ||||||||||||||||||||||||||||
| 81 | # AESD => 'AudioRecording', | ||||||||||||||||||||||||||||
| 82 | ); | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 2 | %Image::ExifTool::AIFF::Common = ( | |||||||||||||||||||||||||||
| 85 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | ||||||||||||||||||||||||||||
| 86 | GROUPS => { 2 => 'Audio' }, | ||||||||||||||||||||||||||||
| 87 | FORMAT => 'int16u', | ||||||||||||||||||||||||||||
| 88 | 0 => 'NumChannels', | ||||||||||||||||||||||||||||
| 89 | 1 => { Name => 'NumSampleFrames', Format => 'int32u' }, | ||||||||||||||||||||||||||||
| 90 | 3 => 'SampleSize', | ||||||||||||||||||||||||||||
| 91 | 4 => { Name => 'SampleRate', Format => 'extended' }, #3 | ||||||||||||||||||||||||||||
| 92 | 9 => { | ||||||||||||||||||||||||||||
| 93 | Name => 'CompressionType', | ||||||||||||||||||||||||||||
| 94 | Format => 'string[4]', | ||||||||||||||||||||||||||||
| 95 | PrintConv => { | ||||||||||||||||||||||||||||
| 96 | NONE => 'None', | ||||||||||||||||||||||||||||
| 97 | ACE2 => 'ACE 2-to-1', | ||||||||||||||||||||||||||||
| 98 | ACE8 => 'ACE 8-to-3', | ||||||||||||||||||||||||||||
| 99 | MAC3 => 'MAC 3-to-1', | ||||||||||||||||||||||||||||
| 100 | MAC6 => 'MAC 6-to-1', | ||||||||||||||||||||||||||||
| 101 | sowt => 'Little-endian, no compression', | ||||||||||||||||||||||||||||
| 102 | alaw => 'a-law', | ||||||||||||||||||||||||||||
| 103 | ALAW => 'A-law', | ||||||||||||||||||||||||||||
| 104 | ulaw => 'mu-law', | ||||||||||||||||||||||||||||
| 105 | ULAW => 'Mu-law', | ||||||||||||||||||||||||||||
| 106 | 'GSM '=> 'GSM', | ||||||||||||||||||||||||||||
| 107 | G722 => 'G722', | ||||||||||||||||||||||||||||
| 108 | G726 => 'G726', | ||||||||||||||||||||||||||||
| 109 | G728 => 'G728', | ||||||||||||||||||||||||||||
| 110 | }, | ||||||||||||||||||||||||||||
| 111 | }, | ||||||||||||||||||||||||||||
| 112 | 11 => { #PH | ||||||||||||||||||||||||||||
| 113 | Name => 'CompressorName', | ||||||||||||||||||||||||||||
| 114 | Format => 'pstring', | ||||||||||||||||||||||||||||
| 115 | ValueConv => '$self->Decode($val, "MacRoman")', | ||||||||||||||||||||||||||||
| 116 | }, | ||||||||||||||||||||||||||||
| 117 | ); | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 2 | %Image::ExifTool::AIFF::FormatVers = ( | |||||||||||||||||||||||||||
| 120 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | ||||||||||||||||||||||||||||
| 121 | FORMAT => 'int32u', | ||||||||||||||||||||||||||||
| 122 | 0 => { Name => 'FormatVersionTime', %timeInfo }, | ||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 2 | %Image::ExifTool::AIFF::Comment = ( | |||||||||||||||||||||||||||
| 126 | PROCESS_PROC => \&Image::ExifTool::AIFF::ProcessComment, | ||||||||||||||||||||||||||||
| 127 | GROUPS => { 2 => 'Audio' }, | ||||||||||||||||||||||||||||
| 128 | 0 => { Name => 'CommentTime', %timeInfo }, | ||||||||||||||||||||||||||||
| 129 | 1 => 'MarkerID', | ||||||||||||||||||||||||||||
| 130 | 2 => { | ||||||||||||||||||||||||||||
| 131 | Name => 'Comment', | ||||||||||||||||||||||||||||
| 132 | ValueConv => '$self->Decode($val, "MacRoman")', | ||||||||||||||||||||||||||||
| 133 | }, | ||||||||||||||||||||||||||||
| 134 | ); | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 2 | %Image::ExifTool::AIFF::Composite = ( | |||||||||||||||||||||||||||
| 137 | Duration => { | ||||||||||||||||||||||||||||
| 138 | Require => { | ||||||||||||||||||||||||||||
| 139 | 0 => 'AIFF:SampleRate', | ||||||||||||||||||||||||||||
| 140 | 1 => 'AIFF:NumSampleFrames', | ||||||||||||||||||||||||||||
| 141 | }, | ||||||||||||||||||||||||||||
| 142 | RawConv => '($val[0] and $val[1]) ? $val[1] / $val[0] : undef', | ||||||||||||||||||||||||||||
| 143 | PrintConv => 'ConvertDuration($val)', | ||||||||||||||||||||||||||||
| 144 | }, | ||||||||||||||||||||||||||||
| 145 | ); | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | # add our composite tags | ||||||||||||||||||||||||||||
| 148 | 2 | Image::ExifTool::AddCompositeTags('Image::ExifTool::AIFF'); | |||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 152 | # Process AIFF Comment chunk | ||||||||||||||||||||||||||||
| 153 | # Inputs: 0) ExifTool object reference, 1) DirInfo reference, 2) tag table ref | ||||||||||||||||||||||||||||
| 154 | # Returns: 1 on success | ||||||||||||||||||||||||||||
| 155 | sub ProcessComment($$$) | ||||||||||||||||||||||||||||
| 156 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ProcessComment: called CC=8 SCAR=21.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 157 | 1 | my ($et, $dirInfo, $tagTablePtr) = @_; | |||||||||||||||||||||||||||
| 158 | 1 | my $dataPt = $$dirInfo{DataPt}; | |||||||||||||||||||||||||||
| 159 | 1 | my $dirLen = $$dirInfo{DirLen}; | |||||||||||||||||||||||||||
| 160 | 1 | my $verbose = $et->Options('Verbose'); | |||||||||||||||||||||||||||
| 161 | 1 | ▶ | return 0 unless $dirLen > 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 1 | my $numComments = unpack('n',$$dataPt); | |||||||||||||||||||||||||||
| 163 | 1 | my $pos = 2; | |||||||||||||||||||||||||||
| 164 | 1 | my $i; | |||||||||||||||||||||||||||
| 165 | 1 | ▶ | $verbose and $et->VerboseDir('Comment', $numComments); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | 1 | ▶ | for ($i=0; $i<$numComments; ++$i) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 1 | ▶ | last if $pos + 8 > $dirLen; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | 1 | my ($time, $markerID, $size) = unpack("x${pos}Nnn", $$dataPt); | |||||||||||||||||||||||||||
| 169 | 1 | $et->HandleTag($tagTablePtr, 0, $time); | |||||||||||||||||||||||||||
| 170 | 1 | ▶ | $et->HandleTag($tagTablePtr, 1, $markerID) if $markerID; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | 1 | $pos += 8; | |||||||||||||||||||||||||||
| 172 | 1 | ▶ | last if $pos + $size > $dirLen; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | 1 | my $val = substr($$dataPt, $pos, $size); | |||||||||||||||||||||||||||
| 174 | 1 | $et->HandleTag($tagTablePtr, 2, $val); | |||||||||||||||||||||||||||
| 175 | 1 | ▶ | ++$size if $size & 0x01; # account for padding byte if necessary | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | 1 | $pos += $size; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 181 | # Extract information from a AIFF file | ||||||||||||||||||||||||||||
| 182 | # Inputs: 0) ExifTool object reference, 1) DirInfo reference | ||||||||||||||||||||||||||||
| 183 | # Returns: 1 on success, 0 if this wasn't a valid AIFF file | ||||||||||||||||||||||||||||
| 184 | sub ProcessAIFF($$) | ||||||||||||||||||||||||||||
| 185 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ProcessAIFF: called CC=30 SCAR=43.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 186 | 2 | my ($et, $dirInfo) = @_; | |||||||||||||||||||||||||||
| 187 | 2 | my $raf = $$dirInfo{RAF}; | |||||||||||||||||||||||||||
| 188 | 2 | my ($buff, $err, $tagTablePtr, $page, $type, $n); | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | # verify this is a valid AIFF file | ||||||||||||||||||||||||||||
| 191 | 2 | ▶ | return 0 unless $raf->Read($buff, 12) == 12; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 2 | ▶ | my $fast3 = $$et{OPTIONS}{FastScan} && $$et{OPTIONS}{FastScan} == 3; | ||||||||||||||||||||||||||
|
Condition33%1/3
$et->{'OPTIONS'}{'FastScan'} && $et->{'OPTIONS'}{'FastScan'} == 3
MC/DC0%0/2
$et->{'OPTIONS'}{'FastScan'} && $et->{'OPTIONS'}{'FastScan'} == 3
$et->{'OPTIONS'}{'FastScan'}
$et->{'OPTIONS'}{'FastScan'} == 3
Truth table33%1/3
A && B
A= $et->{'OPTIONS'}{'FastScan'}B= $et->{'OPTIONS'}{'FastScan'} == 3
| |||||||||||||||||||||||||||||
| 193 | 2 | my $pos = 12; | |||||||||||||||||||||||||||
| 194 | # check for DjVu image | ||||||||||||||||||||||||||||
| 195 | 2 | ▶ | if ($buff =~ /^AT&TFORM/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | # http://www.djvu.org/ | ||||||||||||||||||||||||||||
| 197 | # http://djvu.sourceforge.net/specs/djvu3changes.txt | ||||||||||||||||||||||||||||
| 198 | 1 | my $buf2; | |||||||||||||||||||||||||||
| 199 | 1 | ▶ | return 0 unless $raf->Read($buf2, 4) == 4 and $buf2 =~ /^(DJVU|DJVM)/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$raf->Read($buf2, 4) == 4 and $buf2 =~ /^(DJVU|DJVM)/
MC/DC0%0/2
$raf->Read($buf2, 4) == 4 and $buf2 =~ /^(DJVU|DJVM)/
$raf->Read($buf2, 4) == 4
$buf2 =~ /^(DJVU|DJVM)/
Truth table33%1/3
A and B
A= $raf->Read($buf2, 4) == 4B= $buf2 =~ /^(DJVU|DJVM)/
| |||||||||||||||||||||||||||||
| 200 | 1 | $pos += 4; | |||||||||||||||||||||||||||
| 201 | 1 | $buff = substr($buff, 4) . $buf2; | |||||||||||||||||||||||||||
| 202 | 1 | $et->SetFileType('DJVU'); | |||||||||||||||||||||||||||
| 203 | 1 | ▶ | return 1 if $fast3; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 1 | $tagTablePtr = GetTagTable('Image::ExifTool::DjVu::Main'); | |||||||||||||||||||||||||||
| 205 | # modify FileType to indicate a multi-page document | ||||||||||||||||||||||||||||
| 206 | 1 | ▶ | $$et{VALUE}{FileType} .= " (multi-page)" if $buf2 eq 'DJVM' and $$et{VALUE}{FileType}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$buf2 eq "DJVM" and $et->{"VALUE"}{"FileType"}
MC/DC0%0/2
$buf2 eq "DJVM" and $et->{"VALUE"}{"FileType"}
$buf2 eq "DJVM"
$et->{"VALUE"}{"FileType"}
Truth table33%1/3
A and B
A= $buf2 eq "DJVM"B= $et->{"VALUE"}{"FileType"}
| |||||||||||||||||||||||||||||
| 207 | 1 | $type = 'DjVu'; | |||||||||||||||||||||||||||
| 208 | } else { | ||||||||||||||||||||||||||||
| 209 | 1 | ▶ | return 0 unless $buff =~ /^FORM....(AIF(F|C))/s; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 1 | $et->SetFileType($1); | |||||||||||||||||||||||||||
| 211 | 1 | ▶ | return 1 if $fast3; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 1 | $tagTablePtr = GetTagTable('Image::ExifTool::AIFF::Main'); | |||||||||||||||||||||||||||
| 213 | 1 | $type = 'AIFF'; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | 2 | SetByteOrder('MM'); | |||||||||||||||||||||||||||
| 216 | 2 | my $verbose = $et->Options('Verbose'); | |||||||||||||||||||||||||||
| 217 | # | ||||||||||||||||||||||||||||
| 218 | # Read through the IFF chunks | ||||||||||||||||||||||||||||
| 219 | # | ||||||||||||||||||||||||||||
| 220 | 2 | for ($n=0;;++$n) { | |||||||||||||||||||||||||||
| 221 | 16 | ▶ | $raf->Read($buff, 8) == 8 or last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | 14 | $pos += 8; | |||||||||||||||||||||||||||
| 223 | 14 | my ($tag, $len) = unpack('a4N', $buff); | |||||||||||||||||||||||||||
| 224 | 14 | my $tagInfo = $et->GetTagInfo($tagTablePtr, $tag); | |||||||||||||||||||||||||||
| 225 | 14 | $et->VPrint(0, "AIFF '${tag}' chunk ($len bytes of data): ", $raf->Tell(),"\n"); | |||||||||||||||||||||||||||
| 226 | # AIFF chunks are padded to an even number of bytes | ||||||||||||||||||||||||||||
| 227 | 14 | my $len2 = $len + ($len & 0x01); | |||||||||||||||||||||||||||
| 228 | 14 | ▶ | if ($len2 > 100000000) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | 0 | ▶ | if ($len2 >= 0x80000000) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if (not $et->Options('LargeFileSupport')) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 231 | 0 | $et->Warn('End of processing at large chunk (LargeFileSupport not enabled)'); | |||||||||||||||||||||||||||
| 232 | 0 | last; | |||||||||||||||||||||||||||
| 233 | } elsif ($et->Options('LargeFileSupport') eq '2') { | ||||||||||||||||||||||||||||
| 234 | 0 | $et->Warn('Skipping large chunk (LargeFileSupport is 2)'); | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ($tagInfo) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 0 | $et->Warn("Skipping large $$tagInfo{Name} chunk (> 100 MB)"); | |||||||||||||||||||||||||||
| 239 | 0 | undef $tagInfo; | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | 14 | ▶ | if ($tagInfo) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 243 | 10 | ▶ | if ($$tagInfo{TypeOnly}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 244 | 2 | $len = $len2 = 4; | |||||||||||||||||||||||||||
| 245 | 2 | ▶ | $page = ($page || 0) + 1; | ||||||||||||||||||||||||||
|
Condition100%2/2
$page || 0
MC/DC100%1/1
$page || 0
$page
Truth table100%2/2
A
A= $page
| |||||||||||||||||||||||||||||
| 246 | 2 | $et->VPrint(0, $$et{INDENT} . "Page $page:\n"); | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | 10 | ▶ | $raf->Read($buff, $len2) >= $len or $err=1, last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 249 | 10 | ▶ | unless ($$tagInfo{SubDirectory} or $$tagInfo{Binary}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tagInfo->{"SubDirectory"} or $tagInfo->{"Binary"}
MC/DC50%1/2
$tagInfo->{"SubDirectory"} or $tagInfo->{"Binary"}
$tagInfo->{"SubDirectory"}
$tagInfo->{"Binary"}
Truth table66%2/3
A or B
A= $tagInfo->{"SubDirectory"}B= $tagInfo->{"Binary"}
| |||||||||||||||||||||||||||||
| 250 | 3 | $buff =~ s/\0+$//; # remove trailing nulls | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | 10 | $et->HandleTag($tagTablePtr, $tag, $buff, | |||||||||||||||||||||||||||
| 253 | DataPt => \$buff, | ||||||||||||||||||||||||||||
| 254 | DataPos => $pos, | ||||||||||||||||||||||||||||
| 255 | Start => 0, | ||||||||||||||||||||||||||||
| 256 | Size => $len, | ||||||||||||||||||||||||||||
| 257 | ); | ||||||||||||||||||||||||||||
| 258 | } elsif (not $len) { | ||||||||||||||||||||||||||||
| 259 | 0 | ▶ | next if ++$n < 100; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 260 | 0 | $et->Warn('Aborting scan. Too many empty chunks'); | |||||||||||||||||||||||||||
| 261 | 0 | last; | |||||||||||||||||||||||||||
| 262 | ▶ | } elsif ($verbose > 2 and $len2 < 1024000) { | |||||||||||||||||||||||||||
|
Condition33%1/3
$verbose > 2 and $len2 < 1024000
MC/DC0%0/2
$verbose > 2 and $len2 < 1024000
$verbose > 2
$len2 < 1024000
Truth table33%1/3
A and B
A= $verbose > 2B= $len2 < 1024000
| |||||||||||||||||||||||||||||
| 263 | 0 | ▶ | $raf->Read($buff, $len2) == $len2 or $err = 1, last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 0 | $et->VerboseDump(\$buff); | |||||||||||||||||||||||||||
| 265 | } else { | ||||||||||||||||||||||||||||
| 266 | 4 | ▶ | $raf->Seek($len2, 1) or $err=1, last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | 14 | $pos += $len2; | |||||||||||||||||||||||||||
| 269 | 14 | $n = 0; | |||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | 2 | ▶ | $err and $et->Warn("Error reading $type file (corrupted?)"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | 2 | return 1; | |||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 2 | 1; # end | |||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | __END__ | ||||||||||||||||||||||||||||