Ignore:
Timestamp:
2011-06-01T12:33:42+12:00 (13 years ago)
Author:
sjm84
Message:

Updating the ExifTool perl modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Jpeg2000.pm

    r16842 r24107  
    1717use Image::ExifTool qw(:DataAccess :Utils);
    1818
    19 $VERSION = '1.12';
     19$VERSION = '1.16';
    2020
    2121sub ProcessJpeg2000Box($$$);
     
    3939    IFD0         => 'UUID-EXIF',
    4040    XMP          => 'UUID-XMP',
     41   'UUID-IPTC'   => 'JP2',
     42   'UUID-EXIF'   => 'JP2',
     43   'UUID-XMP'    => 'JP2',
    4144  # jp2h         => 'JP2',  (not yet functional)
    4245  # ICC_Profile  => 'jp2h', (not yet functional)
     
    6164);
    6265
    63 # JPEG 2000 "box" (ie. segment) names
     66# JPEG 2000 "box" (ie. atom) names
    6467%Image::ExifTool::Jpeg2000::Main = (
    6568    GROUPS => { 2 => 'Image' },
     
    7376   "jP\x1a\x1a" => 'JP2Signature', # (ref 2)
    7477    prfl => 'Profile',
    75     ftyp => { Name => 'FileType', Priority => 0 },
     78    ftyp => {
     79        Name => 'FileType',
     80        SubDirectory => { TagTable => 'Image::ExifTool::Jpeg2000::FileType' },
     81    },
    7682    rreq => 'ReaderRequirements',
    7783    jp2h => {
     
    192198                ProcessProc => \&Image::ExifTool::ProcessTIFF,
    193199                WriteProc => \&Image::ExifTool::WriteTIFF,
     200                DirName => 'EXIF',
    194201                Start => '$valuePtr + 16',
    195202            },
     
    274281            8 => 'JBIG2',
    275282        },
     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',
    276311    },
    277312);
     
    344379            my $tagTable = GetTagTable($$subdir{TagTable});
    345380            my %dirInfo = (
    346                 DirName => $dirName,
     381                DirName => $$subdir{DirName} || $dirName,
    347382                Parent => 'JP2',
    348383            );
     
    464499        if (defined $tagInfo and not $tagInfo) {
    465500            # 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);
    467502            $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $boxID, \$tmpVal);
    468503        }
     
    497532                DirStart => $subdirStart,
    498533                DirLen => $subdirLen,
    499                 DirName => $$tagInfo{Name},
     534                DirName => $$subdir{DirName} || $$tagInfo{Name},
    500535                OutFile => $outfile,
    501536                Base => $dataPos + $subdirStart,
     
    555590    my $raf = $$dirInfo{RAF};
    556591    my $outfile = $$dirInfo{OutFile};
    557     my $rtnVal = 0;
    558592    my $hdr;
    559593
     
    570604        $$exifTool{AddJp2Dirs} = \%addDirs;
    571605    } 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);
    573614    }
    574615    SetByteOrder('MM'); # JPEG 2000 files are big-endian
     
    601642=head1 AUTHOR
    602643
    603 Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
     644Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
    604645
    605646This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.