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

    r16842 r24107  
    1515#               8) http://graphics.cs.uni-sb.de/NMM/dist-0.9.1/Docs/Doxygen/html/mmreg_8h-source.html
    1616#               9) http://developers.videolan.org/vlc/vlc/doc/doxygen/html/codecs_8h-source.html
     17#              10) http://wiki.multimedia.cx/index.php?title=TwoCC
     18#              11) Andreas Winter (SCLive) private communication
     19#              12) http://abcavi.kibi.ru/infotags.htm
     20#              13) http://tech.ebu.ch/docs/tech/tech3285.pdf
    1721#------------------------------------------------------------------------------
    1822
     
    2327use Image::ExifTool qw(:DataAccess :Utils);
    2428
    25 $VERSION = '1.10';
     29$VERSION = '1.28';
     30
     31sub ConvertTimecode($);
    2632
    2733# type of current stream
    2834$Image::ExifTool::RIFF::streamType = '';
    2935
    30 my %riffEncoding = ( #2
     36%Image::ExifTool::RIFF::audioEncoding = ( #2
     37    Notes => 'These "TwoCC" audio encoding codes are used in RIFF and ASF files.',
    3138    0x01 => 'Microsoft PCM',
    3239    0x02 => 'Microsoft ADPCM',
     
    3946    0x09 => 'DRM', #4
    4047    0x0a => 'WMA 9 Speech', #9
     48    0x0b => 'Microsoft Windows Media RT Voice', #10
    4149    0x10 => 'OKI-ADPCM',
    4250    0x11 => 'Intel IMA/DVI-ADPCM',
     
    4957    0x18 => 'Media Vision ADPCM', #6
    5058    0x19 => 'HP CU', #7
     59    0x1a => 'HP Dynamic Voice', #10
    5160    0x20 => 'Yamaha ADPCM', #6
    5261    0x21 => 'SONARC Speech Compression', #6
     
    7584    0x41 => 'Antex G.728 CELP',
    7685    0x42 => 'Microsoft MSG723', #7
     86    0x43 => 'IBM AVC ADPCM', #10
    7787    0x45 => 'ITU-T G.726', #9
    7888    0x50 => 'Microsoft MPEG',
     
    101111    0x78 => 'Voxware VR18', #7
    102112    0x79 => 'Voxware TQ40', #7
     113    0x7a => 'Voxware SC3', #10
     114    0x7b => 'Voxware SC3', #10
    103115    0x80 => 'Soundsoft', #6
    104116    0x81 => 'Voxware TQ60', #7
     
    110122    0x88 => 'Iterated Systems Audio', #7
    111123    0x89 => 'Onlive', #7
     124    0x8a => 'Multitude, Inc. FT SX20', #10
     125    0x8b => 'Infocom ITS A/S G.721 ADPCM', #10
     126    0x8c => 'Convedia G729', #10
     127    0x8d => 'Not specified congruency, Inc.', #10
    112128    0x91 => 'Siemens SBC24', #7
    113129    0x92 => 'Sonic Foundry Dolby AC3 APDIF', #7
     
    118134    0x99 => 'Studer Professional Audio Packed', #7
    119135    0xa0 => 'Malden PhonyTalk', #8
     136    0xa1 => 'Racal Recorder GSM', #10
     137    0xa2 => 'Racal Recorder G720.a', #10
     138    0xa3 => 'Racal G723.1', #10
     139    0xa4 => 'Racal Tetra ACELP', #10
     140    0xb0 => 'NEC AAC NEC Corporation', #10
     141    0xff => 'AAC', #10
    120142    0x100 => 'Rhetorex ADPCM', #6
    121143    0x101 => 'IBM u-Law', #3
     
    124146    0x111 => 'Vivo G.723', #7
    125147    0x112 => 'Vivo Siren', #7
     148    0x120 => 'Philips Speech Processing CELP', #10
     149    0x121 => 'Philips Speech Processing GRUNDIG', #10
    126150    0x123 => 'Digital G.723', #7
    127151    0x125 => 'Sanyo LD ADPCM', #8
     
    132156    0x134 => 'Sipro Lab G.729A', #8
    133157    0x135 => 'Sipro Lab Kelvin', #8
     158    0x136 => 'VoiceAge AMR', #10
    134159    0x140 => 'Dictaphone G.726 ADPCM', #8
    135160    0x150 => 'Qualcomm PureVoice', #8
     
    137162    0x155 => 'Ring Zero Systems TUBGSM', #8
    138163    0x160 => 'Microsoft Audio1', #8
     164    0x161 => 'Windows Media Audio V2 V7 V8 V9 / DivX audio (WMA) / Alex AC3 Audio', #10
     165    0x162 => 'Windows Media Audio Professional V9', #10
     166    0x163 => 'Windows Media Audio Lossless V9', #10
     167    0x164 => 'WMA Pro over S/PDIF', #10
     168    0x170 => 'UNISYS NAP ADPCM', #10
     169    0x171 => 'UNISYS NAP ULAW', #10
     170    0x172 => 'UNISYS NAP ALAW', #10
     171    0x173 => 'UNISYS NAP 16K', #10
     172    0x174 => 'MM SYCOM ACM SYC008 SyCom Technologies', #10
     173    0x175 => 'MM SYCOM ACM SYC701 G726L SyCom Technologies', #10
     174    0x176 => 'MM SYCOM ACM SYC701 CELP54 SyCom Technologies', #10
     175    0x177 => 'MM SYCOM ACM SYC701 CELP68 SyCom Technologies', #10
     176    0x178 => 'Knowledge Adventure ADPCM', #10
     177    0x180 => 'Fraunhofer IIS MPEG2AAC', #10
     178    0x190 => 'Digital Theater Systems DTS DS', #10
    139179    0x200 => 'Creative Labs ADPCM', #6
    140180    0x202 => 'Creative Labs FASTSPEECH8', #6
    141181    0x203 => 'Creative Labs FASTSPEECH10', #6
    142182    0x210 => 'UHER ADPCM', #8
     183    0x215 => 'Ulead DV ACM', #10
     184    0x216 => 'Ulead DV ACM', #10
    143185    0x220 => 'Quarterdeck Corp.', #6
    144186    0x230 => 'I-Link VC', #8
    145187    0x240 => 'Aureal Semiconductor Raw Sport', #8
     188    0x241 => 'ESST AC3', #10
    146189    0x250 => 'Interactive Products HSX', #8
    147190    0x251 => 'Interactive Products RPELP', #8
    148191    0x260 => 'Consistent CS2', #8
    149192    0x270 => 'Sony SCX', #8
     193    0x271 => 'Sony SCY', #10
     194    0x272 => 'Sony ATRAC3', #10
     195    0x273 => 'Sony SPC', #10
     196    0x280 => 'TELUM Telum Inc.', #10
     197    0x281 => 'TELUMIA Telum Inc.', #10
     198    0x285 => 'Norcom Voice Systems ADPCM', #10
    150199    0x300 => 'Fujitsu FM TOWNS SND', #6
     200    0x301 => 'Fujitsu (not specified)', #10
     201    0x302 => 'Fujitsu (not specified)', #10
     202    0x303 => 'Fujitsu (not specified)', #10
     203    0x304 => 'Fujitsu (not specified)', #10
     204    0x305 => 'Fujitsu (not specified)', #10
     205    0x306 => 'Fujitsu (not specified)', #10
     206    0x307 => 'Fujitsu (not specified)', #10
     207    0x308 => 'Fujitsu (not specified)', #10
     208    0x350 => 'Micronas Semiconductors, Inc. Development', #10
     209    0x351 => 'Micronas Semiconductors, Inc. CELP833', #10
    151210    0x400 => 'Brooktree Digital', #6
     211    0x401 => 'Intel Music Coder (IMC)', #10
     212    0x402 => 'Ligos Indeo Audio', #10
    152213    0x450 => 'QDesign Music', #8
     214    0x500 => 'On2 VP7 On2 Technologies', #10
     215    0x501 => 'On2 VP6 On2 Technologies', #10
    153216    0x680 => 'AT&T VME VMPCM', #7
    154217    0x681 => 'AT&T TCP', #8
     218    0x700 => 'YMPEG Alpha (dummy for MPEG-2 compressor)', #10
     219    0x8ae => 'ClearJump LiteWave (lossless)', #10
    155220    0x1000 => 'Olivetti GSM', #6
    156221    0x1001 => 'Olivetti ADPCM', #6
     
    159224    0x1004 => 'Olivetti OPR', #6
    160225    0x1100 => 'Lernout & Hauspie', #6
     226    0x1101 => 'Lernout & Hauspie CELP codec', #10
     227    0x1102 => 'Lernout & Hauspie SBC codec', #10
     228    0x1103 => 'Lernout & Hauspie SBC codec', #10
     229    0x1104 => 'Lernout & Hauspie SBC codec', #10
    161230    0x1400 => 'Norris Comm. Inc.', #6
    162231    0x1401 => 'ISIAudio', #7
    163232    0x1500 => 'AT&T Soundspace Music Compression', #7
     233    0x181c => 'VoxWare RT24 speech codec', #10
     234    0x181e => 'Lucent elemedia AX24000P Music codec', #10
     235    0x1971 => 'Sonic Foundry LOSSLESS', #10
     236    0x1979 => 'Innings Telecom Inc. ADPCM', #10
     237    0x1c07 => 'Lucent SX8300P speech codec', #10
     238    0x1c0c => 'Lucent SX5363S G.723 compliant codec', #10
     239    0x1f03 => 'CUseeMe DigiTalk (ex-Rocwell)', #10
     240    0x1fc4 => 'NCT Soft ALF2CD ACM', #10
    164241    0x2000 => 'FAST Multimedia DVM', #7
     242    0x2001 => 'Dolby DTS (Digital Theater System)', #10
     243    0x2002 => 'RealAudio 1 / 2 14.4', #10
     244    0x2003 => 'RealAudio 1 / 2 28.8', #10
     245    0x2004 => 'RealAudio G2 / 8 Cook (low bitrate)', #10
     246    0x2005 => 'RealAudio 3 / 4 / 5 Music (DNET)', #10
     247    0x2006 => 'RealAudio 10 AAC (RAAC)', #10
     248    0x2007 => 'RealAudio 10 AAC+ (RACP)', #10
     249    0x2500 => 'Reserved range to 0x2600 Microsoft', #10
     250    0x3313 => 'makeAVIS (ffvfw fake AVI sound from AviSynth scripts)', #10
     251    0x4143 => 'Divio MPEG-4 AAC audio', #10
     252    0x4201 => 'Nokia adaptive multirate', #10
     253    0x4243 => 'Divio G726 Divio, Inc.', #10
     254    0x434c => 'LEAD Speech', #10
     255    0x564c => 'LEAD Vorbis', #10
     256    0x5756 => 'WavPack Audio', #10
     257    0x674f => 'Ogg Vorbis (mode 1)', #10
     258    0x6750 => 'Ogg Vorbis (mode 2)', #10
     259    0x6751 => 'Ogg Vorbis (mode 3)', #10
     260    0x676f => 'Ogg Vorbis (mode 1+)', #10
     261    0x6770 => 'Ogg Vorbis (mode 2+)', #10
     262    0x6771 => 'Ogg Vorbis (mode 3+)', #10
     263    0x7000 => '3COM NBX 3Com Corporation', #10
     264    0x706d => 'FAAD AAC', #10
     265    0x7a21 => 'GSM-AMR (CBR, no SID)', #10
     266    0x7a22 => 'GSM-AMR (VBR, including SID)', #10
     267    0xa100 => 'Comverse Infosys Ltd. G723 1', #10
     268    0xa101 => 'Comverse Infosys Ltd. AVQSBC', #10
     269    0xa102 => 'Comverse Infosys Ltd. OLDSBC', #10
     270    0xa103 => 'Symbol Technologies G729A', #10
     271    0xa104 => 'VoiceAge AMR WB VoiceAge Corporation', #10
     272    0xa105 => 'Ingenient Technologies Inc. G726', #10
     273    0xa106 => 'ISO/MPEG-4 advanced audio Coding', #10
     274    0xa107 => 'Encore Software Ltd G726', #10
     275    0xa109 => 'Speex ACM Codec xiph.org', #10
     276    0xdfac => 'DebugMode SonicFoundry Vegas FrameServer ACM Codec', #10
     277    0xe708 => 'Unknown -', #10
     278    0xf1ac => 'Free Lossless Audio Codec FLAC', #10
    165279    0xfffe => 'Extensible', #7
    166280    0xffff => 'Development', #4
     
    171285    PROCESS_PROC => \&Image::ExifTool::RIFF::ProcessChunks,
    172286    NOTES => q{
    173         Windows WAV and AVI files are RIFF format files.  Meta information embedded
    174         in two types of RIFF C<LIST> chunks: C<INFO> and C<exif>.  As well, some
    175         information about the audio content is extracted from the C<fmt > chunk.
     287        The RIFF container format is used various types of fines including WAV, AVI
     288        and WEBP.  According to the EXIF specification, Meta information is embedded
     289        in two types of RIFF C<LIST> chunks: C<INFO> and C<exif>, and information
     290        about the audio content is stored in the C<fmt > chunk.  As well as this
     291        information, some video information and proprietary manufacturer-specific
     292        information is also extracted.
    176293    },
    177294   'fmt ' => {
     
    179296        SubDirectory => { TagTable => 'Image::ExifTool::RIFF::AudioFormat' },
    180297    },
     298   'bext' => {
     299        Name => 'BroadcastExtension',
     300        SubDirectory => { TagTable => 'Image::ExifTool::RIFF::BroadcastExt' },
     301    },
    181302    LIST_INFO => {
    182303        Name => 'Info',
     
    191312        SubDirectory => { TagTable => 'Image::ExifTool::RIFF::Hdrl' },
    192313    },
     314    LIST_Tdat => { #PH (Adobe CS3 Bridge)
     315        Name => 'Tdat',
     316        SubDirectory => { TagTable => 'Image::ExifTool::RIFF::Tdat' },
     317    },
     318    LIST_ncdt => { #PH (Nikon metadata)
     319        Name => 'NikonData',
     320        SubDirectory => {
     321            TagTable => 'Image::ExifTool::Nikon::AVI',
     322            # define ProcessProc here so we don't need to load RIFF.pm from Nikon.pm
     323            ProcessProc => \&Image::ExifTool::RIFF::ProcessChunks,
     324        },
     325    },
     326    LIST_hydt => { #PH (Pentax metadata)
     327        Name => 'PentaxData',
     328        SubDirectory => {
     329            TagTable => 'Image::ExifTool::Pentax::AVI',
     330            ProcessProc => \&Image::ExifTool::RIFF::ProcessChunks,
     331        },
     332    },
     333    JUNK => [
     334        {
     335            Name => 'OlympusJunk',
     336            Condition => '$$valPt =~ /^OLYMDigital Camera/',
     337            SubDirectory => { TagTable => 'Image::ExifTool::Olympus::AVI' },
     338        },
     339        {
     340            Name => 'CasioJunk',
     341            Condition => '$$valPt =~ /^QVMI/',
     342            # Casio stores standard EXIF-format information in AVI videos (EX-S600)
     343            SubDirectory => {
     344                TagTable => 'Image::ExifTool::Exif::Main',
     345                DirName => 'IFD0',
     346                Multi => 0, # (IFD1 is not written)
     347                Start => 10,
     348                ByteOrder => 'BigEndian',
     349            },
     350        },
     351        {
     352            Name => 'RicohJunk',
     353            # the Ricoh Caplio GX stores sub-chunks in here
     354            Condition => '$$valPt =~ /^ucmt/',
     355            SubDirectory => {
     356                TagTable => 'Image::ExifTool::Ricoh::AVI',
     357                ProcessProc => \&Image::ExifTool::RIFF::ProcessChunks,
     358            },
     359        },
     360        {
     361            Name => 'PentaxJunk', # (Optio RS1000)
     362            Condition => '$$valPt =~ /^IIII\x01\0/',
     363            SubDirectory => { TagTable => 'Image::ExifTool::Pentax::Junk' },
     364        },
     365        {
     366            Name => 'TextJunk',
     367            # try to interpret unknown junk as an ASCII string
     368            RawConv => '$val =~ /^([^\0-\x1f\x7f-\xff]+)\0*$/ ? $1 : undef',
     369        }
     370    ],
     371    _PMX => { #PH (Adobe CS3 Bridge)
     372        Name => 'XMP',
     373        SubDirectory => { TagTable => 'Image::ExifTool::XMP::Main' },
     374    },
     375    JUNQ => { #PH (Adobe CS3 Bridge)
     376        # old XMP is preserved when metadata is replaced in Bridge
     377        Name => 'OldXMP',
     378        Binary => 1,
     379    },
     380    olym => {
     381        Name => 'Olym',
     382        SubDirectory => { TagTable => 'Image::ExifTool::Olympus::WAV' },
     383    },
     384);
     385
     386# the maker notes used by some digital cameras
     387%Image::ExifTool::RIFF::Junk = (
     388    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     389    GROUPS => { 2 => 'Audio' },
    193390);
    194391
     
    201398        Name => 'Encoding',
    202399        PrintHex => 1,
    203         PrintConv => \%riffEncoding,
     400        PrintConv => \%Image::ExifTool::RIFF::audioEncoding,
     401        SeparateTable => 'AudioEncoding',
    204402    },
    205403    1 => 'NumChannels',
     
    217415);
    218416
     417# Broadcast Audio Extension 'bext' information (ref 13)
     418%Image::ExifTool::RIFF::BroadcastExt = (
     419    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     420    GROUPS => { 2 => 'Audio' },
     421    NOTES => q{
     422        Information found in the Broadcast Audio Extension chunk (see
     423        L<http://tech.ebu.ch/docs/tech/tech3285.pdf>).
     424    },
     425    0 => {
     426        Name => 'Description',
     427        Format => 'string[256]',
     428    },
     429    256 => {
     430        Name => 'Originator',
     431        Format => 'string[32]',
     432    },
     433    288 => {
     434        Name => 'OriginatorReference',
     435        Format => 'string[32]',
     436    },
     437    320 => {
     438        Name => 'DateTimeOriginal',
     439        Description => 'Date/Time Original',
     440        Groups => { 2 => 'Time' },
     441        Format => 'string[18]',
     442        ValueConv => '$_=$val; tr/-/:/; s/^(\d{4}:\d{2}:\d{2})/$1 /; $_',
     443        PrintConv => '$self->ConvertDateTime($val)',
     444    },
     445    338 => {
     446        Name => 'TimeReference',
     447        Notes => 'first sample count since midnight',
     448        Format => 'int32u[2]',
     449        ValueConv => 'my @v=split(" ",$val); $v[0] + $v[1] * 4294967296',
     450    },
     451    346 => {
     452        Name => 'BWFVersion',
     453        Format => 'int16u',
     454    },
     455    # 348 - int8u[64] - SMPTE 330M UMID (Unique Material Identifier)
     456    # 412 - int8u[190] - reserved
     457    602 => {
     458        Name => 'CodingHistory',
     459        Format => 'string[$size-602]',
     460    },
     461);
     462
    219463# Sub chunks of INFO LIST chunk
    220464%Image::ExifTool::RIFF::Info = (
    221465    PROCESS_PROC => \&Image::ExifTool::RIFF::ProcessChunks,
    222466    GROUPS => { 2 => 'Audio' },
     467    NOTES => q{
     468        RIFF INFO tags found in WAV audio and AVI video files.  Tags which are part
     469        of the EXIF 2.3 specification have an underlined Tag Name in the HTML
     470        version of this documentation.  Other tags are found in AVI files generated
     471        by some software.
     472    },
    223473    IARL => 'ArchivalLocation',
    224474    IART => { Name => 'Artist',    Groups => { 2 => 'Author' } },
     
    229479        Name => 'DateCreated',
    230480        Groups => { 2 => 'Time' },
    231         ValueConv => '$_=$val; s/-/:/g; s/\0.*//s; $_',
     481        ValueConv => '$_=$val; s/-/:/g; $_',
    232482    },
    233483    ICRP => 'Cropped',
     
    243493    IPRD => 'Product',
    244494    ISBJ => 'Subject',
    245     ISFT => 'Software',
     495    ISFT => {
     496        Name => 'Software',
     497        # remove trailing nulls/spaces and split at first null
     498        # (Casio writes "CASIO" in unicode after the first null)
     499        ValueConv => '$_=$val; s/(\s*\0)+$//; s/(\s*\0)/, /; s/\0+//g; $_',
     500    },
    246501    ISHP => 'Sharpness',
    247502    ISRC => 'Source',
    248503    ISRF => 'SourceForm',
    249504    ITCH => 'Technician',
     505#
     506# 3rd party tags
     507#
     508    # internet movie database (ref 12)
     509    ISGN => 'SecondaryGenre',
     510    IWRI => 'WrittenBy',
     511    IPRO => 'ProducedBy',
     512    ICNM => 'Cinematographer',
     513    IPDS => 'ProductionDesigner',
     514    IEDT => 'EditedBy',
     515    ICDS => 'CostumeDesigner',
     516    IMUS => 'MusicBy',
     517    ISTD => 'ProductionStudio',
     518    IDST => 'DistributedBy',
     519    ICNT => 'Country',
     520    ILNG => 'Language',
     521    IRTD => 'Rating',
     522    ISTR => 'Starring',
     523    # MovieID (ref12)
     524    TITL => 'Title',
     525    DIRC => 'Directory',
     526    YEAR => 'Year',
     527    GENR => 'Genre',
     528    COMM => 'Comments',
     529    LANG => 'Language',
     530    AGES => 'Rated',
     531    STAR => 'Starring',
     532    CODE => 'EncodedBy',
     533    PRT1 => 'Part',
     534    PRT2 => 'NumberOfParts',
     535    # Morgan Multimedia INFO tags (ref 12)
     536    IAS1 => 'FirstLanguage',
     537    IAS2 => 'SecondLanguage',
     538    IAS3 => 'ThirdLanguage',
     539    IAS4 => 'FourthLanguage',
     540    IAS5 => 'FifthLanguage',
     541    IAS6 => 'SixthLanguage',
     542    IAS7 => 'SeventhLanguage',
     543    IAS8 => 'EighthLanguage',
     544    IAS9 => 'NinthLanguage',
     545    ICAS => 'DefaultAudioStream',
     546    IBSU => 'BaseURL',
     547    ILGU => 'LogoURL',
     548    ILIU => 'LogoIconURL',
     549    IWMU => 'WatermarkURL',
     550    IMIU => 'MoreInfoURL',
     551    IMBI => 'MoreInfoBannerImage',
     552    IMBU => 'MoreInfoBannerURL',
     553    IMIT => 'MoreInfoText',
     554    # GSpot INFO tags (ref 12)
     555    IENC => 'EncodedBy',
     556    IRIP => 'RippedBy',
     557    # Sound Forge Pro tags
     558    DISP => 'SoundSchemeTitle',
     559    TLEN => { Name => 'Length', ValueConv => '$val/1000', PrintConv => '"$val s"' },
     560    TRCK => 'TrackNumber',
     561    TURL => 'URL',
     562    TVER => 'Version',
     563    LOCA => 'Location',
     564    TORG => 'Organization',
     565    # Sony Vegas AVI tags, also used by SCLive and Adobe Premier (ref 11)
     566    TAPE => {
     567        Name => 'TapeName',
     568        Groups => { 2 => 'Video' },
     569    },
     570    TCOD => {
     571        Name => 'StartTimecode',
     572        # this is the tape time code for the start of the video
     573        Groups => { 2 => 'Video' },
     574        ValueConv => '$val * 1e-7',
     575        PrintConv => \&ConvertTimecode,
     576    },
     577    TCDO => {
     578        Name => 'EndTimecode',
     579        Groups => { 2 => 'Video' },
     580        ValueConv => '$val * 1e-7',
     581        PrintConv => \&ConvertTimecode,
     582    },
     583    VMAJ => {
     584        Name => 'VegasVersionMajor',
     585        Groups => { 2 => 'Video' },
     586    },
     587    VMIN => {
     588        Name => 'VegasVersionMinor',
     589        Groups => { 2 => 'Video' },
     590    },
     591    CMNT => {
     592        Name => 'Comment',
     593        Groups => { 2 => 'Video' },
     594    },
     595    RATE => {
     596        Name => 'Rate', #? (video? units?)
     597        Groups => { 2 => 'Video' },
     598    },
     599    STAT => {
     600        Name => 'Statistics',
     601        Groups => { 2 => 'Video' },
     602        # ("7318 0 3.430307 1", "0 0 3500.000000 1", "7 0 3.433228 1")
     603        PrintConv => [
     604            '"$val frames captured"',
     605            '"$val dropped"',
     606            '"Data rate $val"',
     607            { 0 => 'Bad', 1 => 'OK' }, # capture OK?
     608        ],
     609    },
     610    DTIM => {
     611        Name => 'DateTimeOriginal',
     612        Description => 'Date/Time Original',
     613        Groups => { 2 => 'Time' },
     614        ValueConv => q{
     615            my @v = split ' ', $val;
     616            return undef unless @v == 2;
     617            # get time in seconds
     618            $val = 1e-7 * ($v[0] * 4294967296 + $v[1]);
     619            # shift from Jan 1, 1601 to Jan 1, 1970
     620            $val -= 134774 * 24 * 3600 if $val != 0;
     621            return Image::ExifTool::ConvertUnixTime($val);
     622        },
     623        PrintConv => '$self->ConvertDateTime($val)',
     624    },
    250625);
    251626
     
    254629    PROCESS_PROC => \&Image::ExifTool::RIFF::ProcessChunks,
    255630    GROUPS => { 2 => 'Audio' },
     631    NOTES => 'These tags are part of the EXIF 2.3 specification for WAV audio files.',
    256632    ever => 'ExifVersion',
    257633    erel => 'RelatedImageFile',
     
    281657        PrintConv => '$self->ConvertDateTime($val)',
    282658    },
    283     ISMP => 'TimeCode',
     659    ISMP => 'Timecode',
    284660    LIST_strl => {
    285661        Name => 'Stream',
    286662        SubDirectory => { TagTable => 'Image::ExifTool::RIFF::Stream' },
    287663    },
     664    LIST_odml => {
     665        Name => 'OpenDML',
     666        SubDirectory => { TagTable => 'Image::ExifTool::RIFF::OpenDML' },
     667    },
     668);
     669
     670# Sub chunks of Tdat LIST chunk (ref PH)
     671%Image::ExifTool::RIFF::Tdat = (
     672    PROCESS_PROC => \&Image::ExifTool::RIFF::ProcessChunks,
     673    GROUPS => { 2 => 'Video' },
     674    # (have seen tc_O, tc_A, rn_O and rn_A)
    288675);
    289676
     
    295682    0 => {
    296683        Name => 'FrameRate',
    297         ValueConv => '$val ? 1e6 / $val : undef',
     684        # (must use RawConv because raw value used in Composite tag)
     685        RawConv => '$val ? 1e6 / $val : undef',
    298686        PrintConv => 'int($val * 1000 + 0.5) / 1000',
    299687    },
     
    338726);
    339727
     728# Open DML tags (ref http://www.morgan-multimedia.com/download/odmlff2.pdf)
     729%Image::ExifTool::RIFF::OpenDML = (
     730    PROCESS_PROC => \&Image::ExifTool::RIFF::ProcessChunks,
     731    GROUPS => { 2 => 'Video' },
     732    dmlh => {
     733        Name => 'ExtendedAVIHeader',
     734        SubDirectory => { TagTable => 'Image::ExifTool::RIFF::ExtAVIHdr' },
     735    },
     736);
     737
     738# Extended AVI Header tags (ref http://www.morgan-multimedia.com/download/odmlff2.pdf)
     739%Image::ExifTool::RIFF::ExtAVIHdr = (
     740    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     741    GROUPS => { 2 => 'Video' },
     742    FORMAT => 'int32u',
     743    0 => 'TotalFrameCount',
     744);
     745
    340746%Image::ExifTool::RIFF::StreamHeader = (
    341747    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     
    343749    FORMAT => 'int32u',
    344750    FIRST_ENTRY => 0,
     751    PRIORITY => 0,  # so we get values from the first stream
    345752    0 => {
    346753        Name => 'StreamType',
     
    354761        },
    355762    },
    356     1 => {
    357         Name => 'Codec',
    358         Format => 'string[4]',
    359     },
     763    1 => [
     764        {
     765            Name => 'AudioCodec',
     766            Condition => '$Image::ExifTool::RIFF::streamType eq "auds"',
     767            Format => 'string[4]',
     768        },
     769        {
     770            Name => 'VideoCodec',
     771            Condition => '$Image::ExifTool::RIFF::streamType eq "vids"',
     772            Format => 'string[4]',
     773        },
     774        {
     775            Name => 'Codec',
     776            Format => 'string[4]',
     777        },
     778    ],
    360779  # 2 => 'StreamFlags',
    361780  # 3 => 'StreamPriority',
    362781  # 3.5 => 'Language',
    363782  # 4 => 'InitialFrames',
    364   # 5 => 'Scale',
    365   # 6 => 'Rate',
     783    5 => [
     784        {
     785            Name => 'AudioSampleRate',
     786            Condition => '$Image::ExifTool::RIFF::streamType eq "auds"',
     787            Format => 'rational64u',
     788            ValueConv => '$val ? 1/$val : 0',
     789            PrintConv => 'int($val * 100 + 0.5) / 100',
     790        },
     791        {
     792            Name => 'VideoFrameRate',
     793            Condition => '$Image::ExifTool::RIFF::streamType eq "vids"',
     794            Format => 'rational64u',
     795            # (must use RawConv because raw value used in Composite tag)
     796            RawConv => '$val ? 1/$val : undef',
     797            PrintConv => 'int($val * 1000 + 0.5) / 1000',
     798        },
     799        {
     800            Name => 'StreamSampleRate',
     801            Format => 'rational64u',
     802            ValueConv => '$val ? 1/$val : 0',
     803            PrintConv => 'int($val * 1000 + 0.5) / 1000',
     804        },
     805    ],
    366806  # 7 => 'Start',
    367   # 8 => 'Length',
     807    8 => [
     808        {
     809            Name => 'AudioSampleCount',
     810            Condition => '$Image::ExifTool::RIFF::streamType eq "auds"',
     811        },
     812        {
     813            Name => 'VideoFrameCount',
     814            Condition => '$Image::ExifTool::RIFF::streamType eq "vids"',
     815        },
     816        {
     817            Name => 'StreamSampleCount',
     818        },
     819    ],
    368820  # 9 => 'SuggestedBufferSize',
    369     10 => 'Quality',
     821    10 => {
     822        Name => 'Quality',
     823        PrintConv => '$val eq 0xffffffff ? "Default" : $val',
     824    },
    370825    11 => {
    371826        Name => 'SampleSize',
     
    378833    PROCESS_PROC => \&Image::ExifTool::RIFF::ProcessStreamData,
    379834    GROUPS => { 2 => 'Video' },
    380     NOTES => 'This chunk contains EXIF information in FujiFilm F30 AVI files.',
     835    NOTES => q{
     836        This chunk is used to store proprietary information in AVI videos from some
     837        cameras.  The first 4 characters of the data are used as the Tag ID below.
     838    },
    381839    AVIF => {
    382840        Name => 'AVIF',
     
    385843            DirName => 'IFD0',
    386844            Start => 8,
    387             ByteOrder => 'II',
    388         },
     845            ByteOrder => 'LittleEndian',
     846        },
     847    },
     848    CASI => { # (used by Casio GV-10)
     849        Name => 'CasioData',
     850        SubDirectory => { TagTable => 'Image::ExifTool::Casio::AVI' },
     851    },
     852    Zora => 'VendorName',   # (Samsung PL90 AVI files)
     853    unknown => {
     854        Name => 'UnknownData',
     855        # try to interpret unknown stream data as a string
     856        RawConv => '$_=$val; /^[^\0-\x1f\x7f-\xff]+$/ ? $_ : undef',
    389857    },
    390858);
     
    394862    Duration => {
    395863        Require => {
    396             0 => 'FrameRate',
    397             1 => 'FrameCount',
    398         },
    399         ValueConv => '$val[0] ? $val[1] / $val[0] : undef',
    400         PrintConv => 'sprintf("%.2fs",$val)',
     864            0 => 'RIFF:FrameRate',
     865            1 => 'RIFF:FrameCount',
     866        },
     867        Desire => {
     868            2 => 'VideoFrameRate',
     869            3 => 'VideoFrameCount',
     870        },
     871        # this is annoying.  Apparently (although I couldn't verify this), FrameCount
     872        # in the RIFF header includes multiple video tracks if they exist (ie. with the
     873        # FujiFilm REAL 3D AVI's), but the video stream information isn't reliable for
     874        # some cameras (ie. Olympus FE models), so use the video stream information
     875        # only if the RIFF header duration is 2 to 3 times longer
     876        RawConv => q {
     877            my ($dur1, $dur2);
     878            $dur1 = $val[1] / $val[0] if $val[0];
     879            return $dur1 unless $val[2] and $val[3];
     880            $dur2 = $val[3] / $val[2];
     881            my $rat = $dur1 / $dur2;
     882            return ($rat > 1.9 and $rat < 3.1) ? $dur2 : $dur1;
     883        },
     884        PrintConv => 'ConvertDuration($val)',
     885    },
     886    Duration2 => {
     887        Name => 'Duration',
     888        Require => {
     889            0 => 'RIFF:AvgBytesPerSec',
     890            1 => 'FileSize',
     891        },
     892        Desire => {
     893            # check FrameCount because this calculation only applies
     894            # to audio-only files (ie. WAV)
     895            2 => 'FrameCount',
     896            3 => 'VideoFrameCount',
     897        },
     898        RawConv => '($val[0] and not ($val[2] or $val[3])) ? $val[1] / $val[0] : undef',
     899        PrintConv => 'ConvertDuration($val)',
    401900    },
    402901);
     
    430929
    431930#------------------------------------------------------------------------------
     931# Print time
     932# Inputs: 0) time in seconds
     933# Returns: time string
     934sub ConvertTimecode($)
     935{
     936    my $val = shift;
     937    my $hr = int($val / 3600);
     938    $val -= $hr * 3600;
     939    my $min = int($val / 60);
     940    $val -= $min * 60;
     941    return sprintf("%d:%.2d:%05.2f", $hr, $min, $val);
     942}
     943
     944#------------------------------------------------------------------------------
    432945# Process stream data
    433946# Inputs: 0) ExifTool object ref, 1) dirInfo reference, 2) tag table ref
     
    445958    my $tag = substr($$dataPt, $start, 4);
    446959    my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $tag);
     960    unless ($tagInfo) {
     961        $tagInfo = $exifTool->GetTagInfo($tagTablePtr, 'unknown');
     962        return 1 unless $tagInfo;
     963    }
    447964    my $subdir = $$tagInfo{SubDirectory};
    448     if ($subdir) {
     965    if ($$tagInfo{SubDirectory}) {
    449966        my $offset = $$subdir{Start} || 0;
    450967        my $baseShift = $$dirInfo{DataPos} + $$dirInfo{DirStart} + $offset;
     
    459976            Parent  => $$dirInfo{DirName},
    460977        );
     978        unless ($offset) {
     979            # allow processing of 2nd directory at the same address
     980            my $addr = $subdirInfo{DirStart} + $subdirInfo{DataPos} + $subdirInfo{Base};
     981            delete $exifTool->{PROCESSED}->{$addr}
     982        }
    461983        # (we could set FIRST_EXIF_POS to $subdirInfo{Base} here to make
    462984        #  htmlDump offsets relative to EXIF base if we wanted...)
    463985        my $subTable = GetTagTable($$subdir{TagTable});
    464986        $exifTool->ProcessDirectory(\%subdirInfo, $subTable);
     987    } else {
     988        $exifTool->HandleTag($tagTablePtr, $tag, undef,
     989            DataPt  => $dataPt,
     990            DataPos => $$dirInfo{DataPos},
     991            Start   => $start,
     992            Size    => $size,
     993            TagInfo => $tagInfo,
     994        );
    465995    }
    466996    return 1;
     
    4791009    my $size = $$dirInfo{DirLen};
    4801010    my $end = $start + $size;
     1011    my $base = $$dirInfo{Base};
    4811012
    4821013    if ($exifTool->Options('Verbose')) {
     
    4961027            $start += 4;
    4971028        }
    498         $exifTool->HandleTag($tagTablePtr, $tag, undef,
    499             DataPt => $dataPt,
    500             DataPos => $$dirInfo{DataPos},
    501             Start => $start,
    502             Size => $len,
     1029        my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $tag);
     1030        my $baseShift = 0;
     1031        my $val;
     1032        if ($tagInfo) {
     1033            if ($$tagInfo{SubDirectory}) {
     1034                # adjust base if necessary (needed for Ricoh maker notes)
     1035                my $newBase = $tagInfo->{SubDirectory}{Base};
     1036                if (defined $newBase) {
     1037                    # different than your average Base eval...
     1038                    # here we use an absolute $start address
     1039                    $start += $base;
     1040                    #### eval Base ($start)
     1041                    $newBase = eval $newBase;
     1042                    $baseShift = $newBase - $base;
     1043                    $start -= $base;
     1044                }
     1045            } elsif (not $$tagInfo{Binary}) {
     1046                $val = substr($$dataPt, $start, $len);
     1047                $val =~ s/\0+$//;   # remove trailing nulls from strings
     1048            }
     1049        }
     1050        $exifTool->HandleTag($tagTablePtr, $tag, $val,
     1051            DataPt  => $dataPt,
     1052            DataPos => $$dirInfo{DataPos} - $baseShift,
     1053            Start   => $start,
     1054            Size    => $len,
     1055            Base    => $base + $baseShift,
    5031056        );
    5041057        ++$len if $len & 0x01;  # must account for padding if odd number of bytes
     
    5171070    my $raf = $$dirInfo{RAF};
    5181071    my ($buff, $err);
    519     my %types = ( 'WAVE' => 'WAV', 'AVI ' => 'AVI' );
     1072    my %types = ( 'WAVE' => 'WAV', 'AVI ' => 'AVI', 'WEBP' => 'WEBP' );
     1073    my $verbose = $exifTool->Options('Verbose');
    5201074
    5211075    # verify this is a valid RIFF file
    5221076    return 0 unless $raf->Read($buff, 12) == 12;
    5231077    return 0 unless $buff =~ /^RIFF....(.{4})/s;
    524     $exifTool->SetFileType($types{$1}); # set type to 'WAV', 'AVI' or 'RIFF'
     1078    $exifTool->SetFileType($types{$1}); # set type to 'WAV', 'AVI', 'WEBP' or 'RIFF'
    5251079    $Image::ExifTool::RIFF::streamType = '';    # initialize stream type
    5261080    SetByteOrder('II');
     
    5281082    my $pos = 12;
    5291083#
    530 # Read chunks in RIFF image until we get to the 'data' chunk
     1084# Read chunks in RIFF image
    5311085#
    5321086    for (;;) {
    533         $raf->Read($buff, 8) == 8 or $err=1, last;
     1087        my $num = $raf->Read($buff, 8);
     1088        if ($num < 8) {
     1089            $err = 1 if $num;
     1090            last;
     1091        }
    5341092        $pos += 8;
    5351093        my ($tag, $len) = unpack('a4V', $buff);
     
    5431101        $exifTool->VPrint(0, "RIFF '$tag' chunk ($len bytes of data):\n");
    5441102        # stop when we hit the audio data or AVI index or AVI movie data
    545         if ($tag eq 'data' or $tag eq 'idx1' or $tag eq 'LIST_movi') {
     1103        # --> no more because Adobe Bridge stores XMP after this!!
     1104        # (so now we only do this on the FastScan option)
     1105        if (($tag eq 'data' or $tag eq 'idx1' or $tag eq 'LIST_movi') and
     1106            $exifTool->Options('FastScan'))
     1107        {
    5461108            $exifTool->VPrint(0, "(end of parsing)\n");
    5471109            last;
    5481110        }
    549         my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $tag);
    5501111        # RIFF chunks are padded to an even number of bytes
    5511112        my $len2 = $len + ($len & 0x01);
    552         if ($tagInfo and $$tagInfo{SubDirectory}) {
     1113        if ($$tagTablePtr{$tag} or ($verbose and $tag !~ /^(data|idx1|LIST_movi)$/)) {
    5531114            $raf->Read($buff, $len2) == $len2 or $err=1, last;
    554             my %dirInfo = (
    555                 DataPt => \$buff,
    556                 DataPos => $pos,
    557                 DirStart => 0,
    558                 DirLen => $len,
     1115            $exifTool->HandleTag($tagTablePtr, $tag, $buff,
     1116                DataPt  => \$buff,
     1117                DataPos => 0,   # (relative to Base)
     1118                Start   => 0,
     1119                Size    => $len2,
     1120                Base    => $pos,
    5591121            );
    560             my $tagTablePtr = GetTagTable($tagInfo->{SubDirectory}->{TagTable});
    561             $exifTool->ProcessDirectory(\%dirInfo, $tagTablePtr);
    5621122        } else {
    5631123            $raf->Seek($len2, 1) or $err=1, last;
     
    5891149=head1 AUTHOR
    5901150
    591 Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
     1151Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
    5921152
    5931153This library is free software; you can redistribute it and/or modify it
     
    6081168=item L<http://msdn.microsoft.com/archive/en-us/directx9_c/directx/htm/avirifffilereference.asp>
    6091169
     1170=item L<http://wiki.multimedia.cx/index.php?title=TwoCC>
     1171
    6101172=back
    6111173
Note: See TracChangeset for help on using the changeset viewer.