| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #------------------------------------------------------------------------------ | 
| 2 |  |  |  |  |  |  | # File:         JVC.pm | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | # Description:  JVC EXIF maker notes tags | 
| 5 |  |  |  |  |  |  | # | 
| 6 |  |  |  |  |  |  | # Revisions:    12/21/2005  - P. Harvey Created | 
| 7 |  |  |  |  |  |  | #------------------------------------------------------------------------------ | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | package Image::ExifTool::JVC; | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 1 |  |  | 1 |  | 4482 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 44 |  | 
| 12 | 1 |  |  | 1 |  | 5 | use vars qw($VERSION); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 44 |  | 
| 13 | 1 |  |  | 1 |  | 5 | use Image::ExifTool qw(:DataAccess :Utils); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 247 |  | 
| 14 | 1 |  |  | 1 |  | 1468 | use Image::ExifTool::Exif; | 
|  | 1 |  |  |  |  | 53 |  | 
|  | 1 |  |  |  |  | 390 |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | $VERSION = '1.03'; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub ProcessJVCText($$$); | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | # JVC EXIF-based maker notes | 
| 21 |  |  |  |  |  |  | %Image::ExifTool::JVC::Main = ( | 
| 22 |  |  |  |  |  |  | WRITE_PROC => \&Image::ExifTool::Exif::WriteExif, | 
| 23 |  |  |  |  |  |  | CHECK_PROC => \&Image::ExifTool::Exif::CheckExif, | 
| 24 |  |  |  |  |  |  | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, | 
| 25 |  |  |  |  |  |  | NOTES => 'JVC EXIF maker note tags.', | 
| 26 |  |  |  |  |  |  | #0x0001 - almost always '2', but '3' for GR-DV700 samples | 
| 27 |  |  |  |  |  |  | 0x0002 => { #PH | 
| 28 |  |  |  |  |  |  | Name => 'CPUVersions', | 
| 29 |  |  |  |  |  |  | # remove trailing nulls/spaces and split at remaining nulls/spaces | 
| 30 |  |  |  |  |  |  | ValueConv => '$_=$val; s/(\s*\0)+$//; s/(\s*\0)+/, /g; $_', | 
| 31 |  |  |  |  |  |  | }, | 
| 32 |  |  |  |  |  |  | 0x0003 => { #PH | 
| 33 |  |  |  |  |  |  | Name => 'Quality', | 
| 34 |  |  |  |  |  |  | PrintConv => { | 
| 35 |  |  |  |  |  |  | 0 => 'Low', | 
| 36 |  |  |  |  |  |  | 1 => 'Normal', | 
| 37 |  |  |  |  |  |  | 2 => 'Fine', | 
| 38 |  |  |  |  |  |  | }, | 
| 39 |  |  |  |  |  |  | }, | 
| 40 |  |  |  |  |  |  | ); | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | # JVC text-based maker notes | 
| 43 |  |  |  |  |  |  | %Image::ExifTool::JVC::Text = ( | 
| 44 |  |  |  |  |  |  | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, | 
| 45 |  |  |  |  |  |  | PROCESS_PROC => \&ProcessJVCText, | 
| 46 |  |  |  |  |  |  | NOTES => 'JVC/Victor text-based maker note tags.', | 
| 47 |  |  |  |  |  |  | VER => 'MakerNoteVersion', #PH | 
| 48 |  |  |  |  |  |  | QTY => { #PH | 
| 49 |  |  |  |  |  |  | Name => 'Quality', | 
| 50 |  |  |  |  |  |  | PrintConv => { | 
| 51 |  |  |  |  |  |  | STND => 'Normal', | 
| 52 |  |  |  |  |  |  | STD  => 'Normal', | 
| 53 |  |  |  |  |  |  | FINE => 'Fine', | 
| 54 |  |  |  |  |  |  | }, | 
| 55 |  |  |  |  |  |  | }, | 
| 56 |  |  |  |  |  |  | ); | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | #------------------------------------------------------------------------------ | 
| 59 |  |  |  |  |  |  | # Process JVC text-based maker notes | 
| 60 |  |  |  |  |  |  | # Inputs: 0) ExifTool object reference | 
| 61 |  |  |  |  |  |  | #         1) Reference to directory information hash | 
| 62 |  |  |  |  |  |  | #         2) Pointer to tag table for this directory | 
| 63 |  |  |  |  |  |  | # Returns: 1 on success, otherwise returns 0 and sets a Warning | 
| 64 |  |  |  |  |  |  | sub ProcessJVCText($$$) | 
| 65 |  |  |  |  |  |  | { | 
| 66 | 0 |  |  | 0 | 0 |  | my ($et, $dirInfo, $tagTablePtr) = @_; | 
| 67 | 0 |  |  |  |  |  | my $dataPt = $$dirInfo{DataPt}; | 
| 68 | 0 |  | 0 |  |  |  | my $dirStart = $$dirInfo{DirStart} || 0; | 
| 69 | 0 |  |  |  |  |  | my $dataLen = $$dirInfo{DataLen}; | 
| 70 | 0 |  | 0 |  |  |  | my $dirLen = $$dirInfo{DirLen} || $dataLen - $dirStart; | 
| 71 | 0 |  |  |  |  |  | my $verbose = $et->Options('Verbose'); | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 0 |  |  |  |  |  | my $data = substr($$dataPt, $dirStart, $dirLen); | 
| 74 |  |  |  |  |  |  | # validate text maker notes | 
| 75 | 0 | 0 |  |  |  |  | unless ($data =~ /^VER:/) { | 
| 76 | 0 |  |  |  |  |  | $et->Warn('Bad JVC text maker notes'); | 
| 77 | 0 |  |  |  |  |  | return 0; | 
| 78 |  |  |  |  |  |  | } | 
| 79 | 0 |  |  |  |  |  | while ($data =~ m/([A-Z]+):(.{3,4})/sg) { | 
| 80 | 0 |  |  |  |  |  | my ($tag, $val) = ($1, $2); | 
| 81 | 0 |  |  |  |  |  | my $tagInfo = $et->GetTagInfo($tagTablePtr, $tag); | 
| 82 | 0 | 0 |  |  |  |  | $et->VerboseInfo($tag, $tagInfo, | 
| 83 |  |  |  |  |  |  | Table  => $tagTablePtr, | 
| 84 |  |  |  |  |  |  | Value  => $val, | 
| 85 |  |  |  |  |  |  | ) if $verbose; | 
| 86 | 0 | 0 |  |  |  |  | unless ($tagInfo) { | 
| 87 | 0 | 0 |  |  |  |  | next unless $$et{OPTIONS}{Unknown}; | 
| 88 | 0 |  |  |  |  |  | $tagInfo = { | 
| 89 |  |  |  |  |  |  | Name => "JVC_Text_$tag", | 
| 90 |  |  |  |  |  |  | Unknown => 1, | 
| 91 |  |  |  |  |  |  | PrintConv => 'length($val) > 60 ? substr($val,0,55) . "[...]" : $val', | 
| 92 |  |  |  |  |  |  | }; | 
| 93 |  |  |  |  |  |  | # add tag information to table | 
| 94 | 0 |  |  |  |  |  | AddTagToTable($tagTablePtr, $tag, $tagInfo); | 
| 95 |  |  |  |  |  |  | } | 
| 96 | 0 |  |  |  |  |  | $et->FoundTag($tagInfo, $val); | 
| 97 |  |  |  |  |  |  | } | 
| 98 | 0 |  |  |  |  |  | return 1; | 
| 99 |  |  |  |  |  |  | } | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | 1;  # end | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | __END__ |