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/ASF.pm

    r16842 r24107  
    77#
    88# References:   1) http://www.microsoft.com/windows/windowsmedia/format/asfspec.aspx
     9#               2) http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart3.pdf (Oct 2008)
    910#------------------------------------------------------------------------------
    1011
     
    1516use Image::ExifTool qw(:DataAccess :Utils);
    1617use Image::ExifTool::Exif;
    17 
    18 $VERSION = '1.05';
     18use Image::ExifTool::RIFF;
     19
     20$VERSION = '1.17';
    1921
    2022sub ProcessMetadata($$$);
    2123sub ProcessContentDescription($$$);
    22 sub ProcessPreview($$$);
     24sub ProcessPicture($$$);
    2325sub ProcessCodecList($$$);
    2426
     
    6365    PROCESS_PROC => \&Image::ExifTool::ASF::ProcessASF,
    6466    NOTES => q{
    65         ASF format is used by Windows WMA and WMV files.  Tag ID's aren't listed
    66         because they are huge 128-bit GUID's that would ruin the formatting of this
    67         table.
     67        The ASF format is used by Windows WMA and WMV files, and DIVX videos.  Tag
     68        ID's aren't listed because they are huge 128-bit GUID's that would ruin the
     69        formatting of this table.
    6870    },
    6971    '75B22630-668E-11CF-A6D9-00AA0062CE6C' => {
     
    7678    'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C' => 'MediaIndex',
    7779    '3CB73FD0-0C4A-4803-953D-EDF7B6228F0C' => 'TimecodeIndex',
     80    'BE7ACFCB-97A9-42E8-9C71-999491E3AFAC' => { #2
     81        Name => 'XMP',
     82        SubDirectory => { TagTable => 'Image::ExifTool::XMP::Main' },
     83    },
    7884);
    7985
     
    158164    BannerImageType => {},
    159165    BannerImageURL => {},
    160     Bitrate => {},
     166    Bitrate => { PrintConv => 'ConvertBitrate($val)' },
    161167    Broadcast => {},
    162168    BufferAverage => {},
     
    165171    Copyright => { Groups => { 2 => 'Author' } },
    166172    CopyrightURL => { Groups => { 2 => 'Author' } },
    167     CurrentBitrate => {},
     173    CurrentBitrate => { PrintConv => 'ConvertBitrate($val)' },
    168174    Description => {},
    169175    DRM_ContentID => {},
     
    183189    DRM_LicenseAcqURL => {},
    184190    DRM_V1LicenseAcqURL => {},
    185     Duration => {},
     191    Duration => { PrintConv => 'ConvertDuration($val)' },
    186192    FileSize => {},
    187193    HasArbitraryDataStream => {},
     
    201207    NSC_Phone => {},
    202208    NumberOfFrames => {},
    203     OptimalBitrate => {},
     209    OptimalBitrate => { PrintConv => 'ConvertBitrate($val)' },
    204210    PeakValue => {},
    205211    Rating => {},
     
    268274    ParentalRatingReason => {},
    269275    PartOfSet => {},
    270     PeakBitrate => {},
     276    PeakBitrate => { PrintConv => 'ConvertBitrate($val)' },
    271277    Period => {},
    272278    Picture => {
    273279        SubDirectory => {
    274             TagTable => 'Image::ExifTool::ASF::Preview',
     280            TagTable => 'Image::ExifTool::ASF::Picture',
    275281        },
    276282    },
     
    313319);
    314320
    315 %Image::ExifTool::ASF::Preview = (
    316     PROCESS_PROC => \&ProcessPreview,
    317     GROUPS => { 2 => 'Video' },
     321%Image::ExifTool::ASF::Picture = (
     322    PROCESS_PROC => \&ProcessPicture,
     323    GROUPS => { 2 => 'Image' },
    318324    0 => {
    319         Name => 'PreviewType',
    320         PrintConv => {
    321             0 => 'Other picture type',
    322             1 => '32x32 PNG file icon',
    323             2 => 'Other file icon',
    324             3 => 'Front album cover',
    325             4 => 'Back album cover',
    326             5 => 'Leaflet page',
    327             6 => 'Media label',
    328             7 => 'Lead artist, performer, or soloist',
    329             8 => 'Artists or performers',
     325        Name => 'PictureType',
     326        PrintConv => { # (Note: Duplicated in ID3, ASF and FLAC modules!)
     327            0 => 'Other',
     328            1 => '32x32 PNG Icon',
     329            2 => 'Other Icon',
     330            3 => 'Front Cover',
     331            4 => 'Back Cover',
     332            5 => 'Leaflet',
     333            6 => 'Media',
     334            7 => 'Lead Artist',
     335            8 => 'Artist',
    330336            9 => 'Conductor',
    331             10 => 'Band or orchestra',
     337            10 => 'Band',
    332338            11 => 'Composer',
    333             12 => 'Lyricist or writer',
    334             13 => 'Recording studio or location',
    335             14 => 'Recording session',
     339            12 => 'Lyricist',
     340            13 => 'Recording Studio or Location',
     341            14 => 'Recording Session',
    336342            15 => 'Performance',
    337             16 => 'Capture from movie or video',
    338             17 => 'A bright colored fish',
     343            16 => 'Capture from Movie or Video',
     344            17 => 'Bright(ly) Colored Fish',
    339345            18 => 'Illustration',
    340             19 => 'Band or artist logo',
    341             20 => 'Publisher or studio logo',
     346            19 => 'Band Logo',
     347            20 => 'Publisher Logo',
    342348        },
    343349    },
    344     1 => 'PreviewMimeType',
    345     2 => 'PreviewDescription',
     350    1 => 'PictureMimeType',
     351    2 => 'PictureDescription',
    346352    3 => {
    347         Name => 'PreviewImage',
    348         ValueConv => '$self->ValidateImage(\$val,$tag)',
     353        Name => 'Picture',
     354        Binary => 1,
    349355    },
    350356);
     
    358364        ValueConv => 'Image::ExifTool::ASF::GetGUID($val)',
    359365    },
    360     16 => { Name => 'FileSize',     Format => 'int64u' },
     366    16 => { Name => 'FileLength',   Format => 'int64u' },
    361367    24 => {
    362368        Name => 'CreationDate',
     
    374380        Format => 'int64u',
    375381        ValueConv => '$val / 1e7',
    376         PrintConv => '"$val sec"',
     382        PrintConv => 'ConvertDuration($val)',
    377383    },
    378384    48 => {
     
    380386        Format => 'int64u',
    381387        ValueConv => '$val / 1e7',
    382         PrintConv => '"$val sec"',
     388        PrintConv => 'ConvertDuration($val)',
    383389    },
    384390    56 => { Name => 'Preroll',      Format => 'int64u' },
     
    386392    68 => { Name => 'MinPacketSize',Format => 'int32u' },
    387393    72 => { Name => 'MaxPacketSize',Format => 'int32u' },
    388     76 => { Name => 'MaxBitrate',   Format => 'int32u' },
     394    76 => { Name => 'MaxBitrate',   Format => 'int32u', PrintConv => 'ConvertBitrate($val)' },
    389395);
    390396
     
    414420        Format => 'int64u',
    415421        ValueConv => '$val / 1e7',
    416         PrintConv => '"$val sec"',
     422        PrintConv => '"$val s"',
    417423    },
    418424    48 => {
     
    427433            Format => 'int16u',
    428434            PrintHex => 1,
    429             # from http://www.iana.org/assignments/wave-avi-codec-registry
    430             # and http://developers.videolan.org/vlc/vlc/doc/doxygen/html/codecs_8h-source.html
    431             PrintConv => {
    432                 0x0001 => 'Microsoft PCM',
    433                 0x0002 => 'Microsoft ADPCM',
    434                 0x0003 => 'IEEE Float',
    435                 0x0004 => 'Cmpaq VSELP',
    436                 0x0005 => 'IBM CVSD',
    437                 0x0006 => 'Microsoft A-Law',
    438                 0x0007 => 'Microsoft Mu-Law',
    439                 0x0008 => 'DTS Coherent Acoustics 1',
    440                 0x0010 => 'OKI ADPCM',
    441                 0x0011 => 'Intel DVI ADPCM',
    442                 0x0012 => 'Videologic MediaSpace ADPCM',
    443                 0x0013 => 'Sierra ADPCM',
    444                 0x0014 => 'G.723 ADPCM',
    445                 0x0015 => 'DSP Solution DIGISTD',
    446                 0x0016 => 'DSP Solution DIGIFIX',
    447                 0x0017 => 'Dialogic OKI ADPCM',
    448                 0x0018 => 'MediaVision ADPCM',
    449                 0x0019 => 'HP CU',
    450                 0x0020 => 'Yamaha ADPCM',
    451                 0x0021 => 'Speech Compression Sonarc',
    452                 0x0022 => 'DSP Group True Speech',
    453                 0x0023 => 'Echo Speech EchoSC1',
    454                 0x0024 => 'Audiofile AF36',
    455                 0x0025 => 'APTX',
    456                 0x0026 => 'AudioFile AF10',
    457                 0x0027 => 'Prosody 1612',
    458                 0x0028 => 'LRC',
    459                 0x0030 => 'Dolby AC2',
    460                 0x0031 => 'GSM610',
    461                 0x0032 => 'MSNAudio',
    462                 0x0033 => 'Antex ADPCME',
    463                 0x0034 => 'Control Res VQLPC',
    464                 0x0035 => 'Digireal',
    465                 0x0036 => 'DigiADPCM',
    466                 0x0037 => 'Control Res CR10',
    467                 0x0038 => 'NMS VBXADPCM',
    468                 0x0039 => 'Roland RDAC',
    469                 0x003a => 'EchoSC3',
    470                 0x003b => 'Rockwell ADPCM',
    471                 0x003c => 'Rockwell Digit LK',
    472                 0x003d => 'Xebec',
    473                 0x0040 => 'Antex Electronics G.721',
    474                 0x0041 => 'G.728 CELP',
    475                 0x0042 => 'MSG723',
    476                 0x0045 => 'G.726 ADPCM',
    477                 0x0050 => 'MPEG',
    478                 0x0052 => 'RT24',
    479                 0x0053 => 'PAC',
    480                 0x0055 => 'MPEG Layer 3',
    481                 0x0059 => 'Lucent G.723',
    482                 0x0060 => 'Cirrus',
    483                 0x0061 => 'ESPCM',
    484                 0x0062 => 'Voxware',
    485                 0x0063 => 'Canopus Atrac',
    486                 0x0064 => 'G.726 ADPCM',
    487                 0x0066 => 'DSAT',
    488                 0x0067 => 'DSAT Display',
    489                 0x0069 => 'Voxware Byte Aligned',
    490                 0x0070 => 'Voxware AC8',
    491                 0x0071 => 'Voxware AC10',
    492                 0x0072 => 'Voxware AC16',
    493                 0x0073 => 'Voxware AC20',
    494                 0x0074 => 'Voxware MetaVoice',
    495                 0x0075 => 'Voxware MetaSound',
    496                 0x0076 => 'Voxware RT29HW',
    497                 0x0077 => 'Voxware VR12',
    498                 0x0078 => 'Voxware VR18',
    499                 0x0079 => 'Voxware TQ40',
    500                 0x0080 => 'Softsound',
    501                 0x0081 => 'Voxware TQ60',
    502                 0x0082 => 'MSRT24',
    503                 0x0083 => 'G.729A',
    504                 0x0084 => 'MVI MV12',
    505                 0x0085 => 'DF G.726',
    506                 0x0086 => 'DF GSM610',
    507                 0x0088 => 'ISIAudio',
    508                 0x0089 => 'Onlive',
    509                 0x0091 => 'SBC24',
    510                 0x0092 => 'Dolby AC3 SPDIF',
    511                 0x0097 => 'ZyXEL ADPCM',
    512                 0x0098 => 'Philips LPCBB',
    513                 0x0099 => 'Packed',
    514                 0x00FF => 'MPEG-4',
    515                 0x0100 => 'Rhetorex ADPCM',
    516                 0x0101 => 'BeCubed Software IRAT',
    517                 0x0111 => 'Vivo G.723',
    518                 0x0112 => 'Vivo Siren',
    519                 0x0123 => 'Digital G.723',
    520                 0x0160 => 'Windows Media v1',
    521                 0x0161 => 'Windows Media v2',
    522                 0x0162 => 'Windows Media 9 Professional',
    523                 0x0163 => 'Windows Media 9 Lossless',
    524                 0x0200 => 'Creative ADPCM',
    525                 0x0202 => 'Creative FastSpeech8',
    526                 0x0203 => 'Creative FastSpeech10',
    527                 0x0220 => 'Quarterdeck',
    528                 0x0300 => 'FM Towns Snd',
    529                 0x0400 => 'BTV Digital',
    530                 0x0680 => 'VME VMPCM',
    531                 0x1000 => 'OLIGSM',
    532                 0x1001 => 'OLIADPCM',
    533                 0x1002 => 'OLICELP',
    534                 0x1003 => 'OLISBC',
    535                 0x1004 => 'OLIOPR',
    536                 0x1100 => 'LH Codec',
    537                 0x1400 => 'Norris',
    538                 0x1401 => 'ISIAudio',
    539                 0x1500 => 'Soundspace Music Compression',
    540                 0x2000 => 'DVM',
    541                 0x2001 => 'DTS Coherent Acoustics 2',
    542                 0x4143 => 'MPEG-4 (Divio)',
    543             },
     435            SeparateTable => 'RIFF AudioEncoding',
     436            PrintConv => \%Image::ExifTool::RIFF::audioEncoding,
    544437        },
    545438        {
     
    624517{
    625518    my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    626     my $verbose = $exifTool->Options('Verbose');
    627519    my $dataPt = $$dirInfo{DataPt};
    628520    my $dirLen = $$dirInfo{DirLen};
     
    635527        next unless $len;
    636528        return 0 if $pos + $len > $dirLen;
    637         my $val = $exifTool->Unicode2Charset(substr($$dataPt,$pos,$len),'II');
     529        my $val = $exifTool->Decode(substr($$dataPt,$pos,$len),'UCS2','II');
    638530        $exifTool->HandleTag($tagTablePtr, $tag, $val);
    639531        $pos += $len;
     
    649541{
    650542    my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    651     my $verbose = $exifTool->Options('Verbose');
    652543    my $dataPt = $$dirInfo{DataPt};
    653544    my $dirLen = $$dirInfo{DirLen};
     
    681572    my @vals;
    682573    if ($format == 0) { # unicode string
    683         $vals[0] = $exifTool->Unicode2Charset(substr($$dataPt,$pos,$size),'II');
     574        $vals[0] = $exifTool->Decode(substr($$dataPt,$pos,$size),'UCS2','II');
    684575    } elsif ($format == 2) { # 4-byte boolean
    685576        @vals = ReadValue($dataPt, $pos, 'int32u', undef, $size);
     
    706597{
    707598    my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    708     my $verbose = $exifTool->Options('Verbose');
    709599    my $dataPt = $$dirInfo{DataPt};
    710600    my $dirLen = $$dirInfo{DirLen};
     
    719609        $pos += 2;
    720610        return 0 if $pos + $nameLen + 4 > $dirLen;
    721         my $tag = Image::ExifTool::Unicode2Latin(substr($$dataPt,$pos,$nameLen),'v');
     611        my $tag = Image::ExifTool::Decode(undef,substr($$dataPt,$pos,$nameLen),'UCS2','II','Latin');
    722612        $tag =~ s/^WM\///; # remove leading "WM/"
    723613        $pos += $nameLen;
     
    738628# Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table reference
    739629# Returns: 1 on success
    740 sub ProcessPreview($$$)
     630sub ProcessPicture($$$)
    741631{
    742632    my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    743     my $verbose = $exifTool->Options('Verbose');
    744633    my $dataPt = $$dirInfo{DataPt};
    745634    my $dirStart = $$dirInfo{DirStart};
     
    755644    if ($str =~ /^((?:..)*?)\0\0((?:..)*?)\0\0/) {
    756645        my ($mime, $desc) = ($1, $2);
    757         $exifTool->HandleTag($tagTablePtr, 1, $mime);
    758         $exifTool->HandleTag($tagTablePtr, 2, $desc) if length $desc;
     646        $exifTool->HandleTag($tagTablePtr, 1, $exifTool->Decode($mime,'UCS2','II'));
     647        $exifTool->HandleTag($tagTablePtr, 2, $exifTool->Decode($desc,'UCS2','II')) if length $desc;
    759648    }
    760649    $exifTool->HandleTag($tagTablePtr, 3, substr($$dataPt, $dirStart+5+$n, $picLen));
     
    769658{
    770659    my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    771     my $verbose = $exifTool->Options('Verbose');
    772660    my $dataPt = $$dirInfo{DataPt};
    773661    my $dirLen = $$dirInfo{DirLen};
     
    785673        $pos += 4;
    786674        return 0 if $pos + $nameLen + 2 > $dirLen;
    787         my $name = $exifTool->Unicode2Charset(substr($$dataPt,$pos,$nameLen),'II');
     675        my $name = $exifTool->Decode(substr($$dataPt,$pos,$nameLen),'UCS2','II');
    788676        $exifTool->HandleTag($tagTablePtr, "${type}Name", $name);
    789677        my $descLen = Get16u($dataPt, $pos + $nameLen) * 2;
    790678        $pos += $nameLen + 2;
    791679        return 0 if $pos + $descLen + 2 > $dirLen;
    792         my $desc = $exifTool->Unicode2Charset(substr($$dataPt,$pos,$descLen),'II');
     680        my $desc = $exifTool->Decode(substr($$dataPt,$pos,$descLen),'UCS2','II');
    793681        $exifTool->HandleTag($tagTablePtr, "${type}Description", $desc);
    794682        my $infoLen = Get16u($dataPt, $pos + $descLen);
     
    805693{
    806694    my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    807     my $verbose = $exifTool->Options('Verbose');
    808695    my $dataPt = $$dirInfo{DataPt};
    809696    my $dirLen = $$dirInfo{DirLen};
     
    818705        $pos += 12;
    819706        return 0 if $pos + $nameLen + $dLen > $dirLen;
    820         my $tag = Image::ExifTool::Unicode2Latin(substr($$dataPt,$pos,$nameLen),'v');
     707        my $tag = Image::ExifTool::Decode(undef,substr($$dataPt,$pos,$nameLen),'UCS2','II','Latin');
    821708        my $val = ReadASF($exifTool,$dataPt,$pos+$nameLen,$dType,$dLen);
    822709        $exifTool->HandleTag($tagTablePtr, $tag, $val,
     
    841728    my $rtnVal = 0;
    842729    my $pos = 0;
    843     my ($buff, $err, @parentTable, @childEnd, %dumpParms);
    844 
    845     if ($verbose > 2) {
    846         $dumpParms{MaxLen} = 96 unless $verbose > 3;
    847         $dumpParms{Prefix} = $$exifTool{INDENT};
    848         $dumpParms{Out} = $exifTool->Options('TextOut');
    849     }
     730    my ($buff, $err, @parentTable, @childEnd);
     731
    850732    for (;;) {
    851733        last unless $raf->Read($buff, 24) == 24;
     
    856738            last unless $tag eq '75B22630-668E-11CF-A6D9-00AA0062CE6C';
    857739            my $fileType = $exifTool->{FILE_EXT};
    858             $fileType = 'ASF' unless $fileType and $fileType =~ /^(ASF|WMV|WMA)$/;
     740            $fileType = 'ASF' unless $fileType and $fileType =~ /^(ASF|WMV|WMA|DIVX)$/;
    859741            $exifTool->SetFileType($fileType);
    860742            SetByteOrder('II');
     
    868750        }
    869751        if ($size > 0x7fffffff) {
    870             $err = 'Large ASF objects not supported';
     752            if ($size > 0x7fffffff * 4294967296) {
     753                $err = 'Invalid ASF object size';
     754            } elsif ($exifTool->Options('LargeFileSupport')) {
     755                if ($raf->Seek($size, 1)) {
     756                    $exifTool->VPrint(0, "  Skipped large ASF object ($size bytes)\n");
     757                    $pos += $size;
     758                    next;
     759                }
     760                $err = 'Error seeking past large ASF object';
     761            } else {
     762                $err = 'Large ASF objects not supported (LargeFileSupport not set)';
     763            }
    871764            last;
    872765        }
     
    876769            $tagTablePtr = pop @parentTable;
    877770            $exifTool->{INDENT} = substr($exifTool->{INDENT},0,-2);
    878             $dumpParms{Prefix} = $exifTool->{INDENT};
    879771        }
    880772        my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $tag);
     
    889781                        if ($verbose > 2) {
    890782                            $raf->Read($buff, $s) == $s or $err = 'Truncated file', last;
    891                             Image::ExifTool::HexDump(\$buff, undef, %dumpParms);
     783                            $exifTool->VerboseDump(\$buff);
    892784                        } elsif (not $raf->Seek($s, 1)) {
    893785                            $err = 'Seek error';
     
    901793                        if ($verbose) {
    902794                            $exifTool->{INDENT} .= '| ';
    903                             $dumpParms{Prefix} = $exifTool->{INDENT};
    904795                            $exifTool->VerboseDir($$tagInfo{Name});
    905796                        }
     
    913804                        DirName => $$tagInfo{Name},
    914805                    );
    915                     if ($verbose > 2) {
    916                         Image::ExifTool::HexDump(\$buff, undef, %dumpParms);
    917                     }
     806                    $exifTool->VerboseDump(\$buff) if $verbose > 2;
    918807                    unless ($exifTool->ProcessDirectory(\%subdirInfo, $subTable)) {
    919808                        $exifTool->Warn("Error processing $$tagInfo{Name} directory");
     
    929818        if ($verbose > 2) {
    930819            $raf->Read($buff, $size) == $size or $err = 'Truncated file', last;
    931             Image::ExifTool::HexDump(\$buff, undef, %dumpParms);
     820            $exifTool->VerboseDump(\$buff);
    932821        } elsif (not $raf->Seek($size, 1)) { # skip the block
    933822            $err = 'Seek error';
     
    960849=head1 AUTHOR
    961850
    962 Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
     851Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
    963852
    964853This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.