- Timestamp:
- 2011-06-01T12:33:42+12:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Jpeg2000.pm
r16842 r24107 17 17 use Image::ExifTool qw(:DataAccess :Utils); 18 18 19 $VERSION = '1.1 2';19 $VERSION = '1.16'; 20 20 21 21 sub ProcessJpeg2000Box($$$); … … 39 39 IFD0 => 'UUID-EXIF', 40 40 XMP => 'UUID-XMP', 41 'UUID-IPTC' => 'JP2', 42 'UUID-EXIF' => 'JP2', 43 'UUID-XMP' => 'JP2', 41 44 # jp2h => 'JP2', (not yet functional) 42 45 # ICC_Profile => 'jp2h', (not yet functional) … … 61 64 ); 62 65 63 # JPEG 2000 "box" (ie. segment) names66 # JPEG 2000 "box" (ie. atom) names 64 67 %Image::ExifTool::Jpeg2000::Main = ( 65 68 GROUPS => { 2 => 'Image' }, … … 73 76 "jP\x1a\x1a" => 'JP2Signature', # (ref 2) 74 77 prfl => 'Profile', 75 ftyp => { Name => 'FileType', Priority => 0 }, 78 ftyp => { 79 Name => 'FileType', 80 SubDirectory => { TagTable => 'Image::ExifTool::Jpeg2000::FileType' }, 81 }, 76 82 rreq => 'ReaderRequirements', 77 83 jp2h => { … … 192 198 ProcessProc => \&Image::ExifTool::ProcessTIFF, 193 199 WriteProc => \&Image::ExifTool::WriteTIFF, 200 DirName => 'EXIF', 194 201 Start => '$valuePtr + 16', 195 202 }, … … 274 281 8 => 'JBIG2', 275 282 }, 283 }, 284 ); 285 286 # (ref fcd15444-1/2/6.pdf) 287 # (also see http://developer.apple.com/mac/library/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html) 288 %Image::ExifTool::Jpeg2000::FileType = ( 289 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, 290 GROUPS => { 2 => 'Video' }, 291 FORMAT => 'int32u', 292 0 => { 293 Name => 'MajorBrand', 294 Format => 'undef[4]', 295 PrintConv => { 296 'jp2 ' => 'JPEG 2000 Image (.JP2)', # image/jp2 297 'jpm ' => 'JPEG 2000 Compound Image (.JPM)', # image/jpm 298 'jpx ' => 'JPEG 2000 with extensions (.JPX)', # image/jpx 299 }, 300 }, 301 1 => { 302 Name => 'MinorVersion', 303 Format => 'undef[4]', 304 ValueConv => 'sprintf("%x.%x.%x", unpack("nCC", $val))', 305 }, 306 2 => { 307 Name => 'CompatibleBrands', 308 Format => 'undef[$size-8]', 309 # ignore any entry with a null, and return others as a list 310 ValueConv => 'my @a=($val=~/.{4}/sg); @a=grep(!/\0/,@a); \@a', 276 311 }, 277 312 ); … … 344 379 my $tagTable = GetTagTable($$subdir{TagTable}); 345 380 my %dirInfo = ( 346 DirName => $ dirName,381 DirName => $$subdir{DirName} || $dirName, 347 382 Parent => 'JP2', 348 383 ); … … 464 499 if (defined $tagInfo and not $tagInfo) { 465 500 # GetTagInfo() required the value for a Condition 466 my $tmpVal = substr($$dataPt, $valuePtr, $boxLen < 48 ? $boxLen : 48);501 my $tmpVal = substr($$dataPt, $valuePtr, $boxLen < 128 ? $boxLen : 128); 467 502 $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $boxID, \$tmpVal); 468 503 } … … 497 532 DirStart => $subdirStart, 498 533 DirLen => $subdirLen, 499 DirName => $$ tagInfo{Name},534 DirName => $$subdir{DirName} || $$tagInfo{Name}, 500 535 OutFile => $outfile, 501 536 Base => $dataPos + $subdirStart, … … 555 590 my $raf = $$dirInfo{RAF}; 556 591 my $outfile = $$dirInfo{OutFile}; 557 my $rtnVal = 0;558 592 my $hdr; 559 593 … … 570 604 $$exifTool{AddJp2Dirs} = \%addDirs; 571 605 } else { 572 $exifTool->SetFileType(); 606 my ($buff, $fileType); 607 # recognize JPX and JPM as unique types of JP2 608 if ($raf->Read($buff, 12) == 12 and $buff =~ /^.{4}ftyp(.{4})/s) { 609 $fileType = 'JPX' if $1 eq 'jpx '; 610 $fileType = 'JPM' if $1 eq 'jpm '; 611 } 612 $raf->Seek(-length($buff), 1) if defined $buff; 613 $exifTool->SetFileType($fileType); 573 614 } 574 615 SetByteOrder('MM'); # JPEG 2000 files are big-endian … … 601 642 =head1 AUTHOR 602 643 603 Copyright 2003-20 07, Phil Harvey (phil at owl.phy.queensu.ca)644 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca) 604 645 605 646 This library is free software; you can redistribute it and/or modify it
Note:
See TracChangeset
for help on using the changeset viewer.