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 | use strict;
|
---|
12 | use vars qw($VERSION);
|
---|
13 | use Image::ExifTool::Exif;
|
---|
14 |
|
---|
15 | $VERSION = '1.02';
|
---|
16 |
|
---|
17 | sub ProcessJVCText($$$);
|
---|
18 |
|
---|
19 | # JVC EXIF-based maker notes
|
---|
20 | %Image::ExifTool::JVC::Main = (
|
---|
21 | WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
|
---|
22 | CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
|
---|
23 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
24 | NOTES => 'JVC EXIF maker note tags.',
|
---|
25 | #0x0001 - almost always '2', but '3' for GR-DV700 samples
|
---|
26 | 0x0002 => { #PH
|
---|
27 | Name => 'CPUVersions',
|
---|
28 | # remove trailing nulls/spaces and split at remaining nulls/spaces
|
---|
29 | ValueConv => '$_=$val; s/(\s*\0)+$//; s/(\s*\0)+/, /g; $_',
|
---|
30 | },
|
---|
31 | 0x0003 => { #PH
|
---|
32 | Name => 'Quality',
|
---|
33 | PrintConv => {
|
---|
34 | 0 => 'Low',
|
---|
35 | 1 => 'Normal',
|
---|
36 | 2 => 'Fine',
|
---|
37 | },
|
---|
38 | },
|
---|
39 | );
|
---|
40 |
|
---|
41 | # JVC text-based maker notes
|
---|
42 | %Image::ExifTool::JVC::Text = (
|
---|
43 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
44 | PROCESS_PROC => \&ProcessJVCText,
|
---|
45 | NOTES => 'JVC/Victor text-based maker note tags.',
|
---|
46 | VER => 'MakerNoteVersion', #PH
|
---|
47 | QTY => { #PH
|
---|
48 | Name => 'Quality',
|
---|
49 | PrintConv => {
|
---|
50 | STND => 'Normal',
|
---|
51 | STD => 'Normal',
|
---|
52 | FINE => 'Fine',
|
---|
53 | },
|
---|
54 | },
|
---|
55 | );
|
---|
56 |
|
---|
57 | #------------------------------------------------------------------------------
|
---|
58 | # Process JVC text-based maker notes
|
---|
59 | # Inputs: 0) ExifTool object reference
|
---|
60 | # 1) Reference to directory information hash
|
---|
61 | # 2) Pointer to tag table for this directory
|
---|
62 | # Returns: 1 on success, otherwise returns 0 and sets a Warning
|
---|
63 | sub ProcessJVCText($$$)
|
---|
64 | {
|
---|
65 | my ($exifTool, $dirInfo, $tagTablePtr) = @_;
|
---|
66 | my $dataPt = $$dirInfo{DataPt};
|
---|
67 | my $dirStart = $$dirInfo{DirStart} || 0;
|
---|
68 | my $dataLen = $$dirInfo{DataLen};
|
---|
69 | my $dirLen = $$dirInfo{DirLen} || $dataLen - $dirStart;
|
---|
70 | my $verbose = $exifTool->Options('Verbose');
|
---|
71 |
|
---|
72 | my $data = substr($$dataPt, $dirStart, $dirLen);
|
---|
73 | # validate text maker notes
|
---|
74 | unless ($data =~ /^VER:/) {
|
---|
75 | $exifTool->Warn('Bad JVC text maker notes');
|
---|
76 | return 0;
|
---|
77 | }
|
---|
78 | while ($data =~ m/([A-Z]+):(.{3,4})/sg) {
|
---|
79 | my ($tag, $val) = ($1, $2);
|
---|
80 | my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $tag);
|
---|
81 | $exifTool->VerboseInfo($tag, $tagInfo,
|
---|
82 | Table => $tagTablePtr,
|
---|
83 | Value => $val,
|
---|
84 | ) if $verbose;
|
---|
85 | unless ($tagInfo) {
|
---|
86 | next unless $exifTool->{OPTIONS}->{Unknown};
|
---|
87 | $tagInfo = {
|
---|
88 | Name => "JVC_Text_$tag",
|
---|
89 | Unknown => 1,
|
---|
90 | PrintConv => 'length($val) > 60 ? substr($val,0,55) . "[...]" : $val',
|
---|
91 | };
|
---|
92 | # add tag information to table
|
---|
93 | Image::ExifTool::AddTagToTable($tagTablePtr, $tag, $tagInfo);
|
---|
94 | }
|
---|
95 | $exifTool->FoundTag($tagInfo, $val);
|
---|
96 | }
|
---|
97 | return 1;
|
---|
98 | }
|
---|
99 |
|
---|
100 | 1; # end
|
---|
101 |
|
---|
102 | __END__
|
---|
103 |
|
---|
104 | =head1 NAME
|
---|
105 |
|
---|
106 | Image::ExifTool::JVC - JVC EXIF maker notes tags
|
---|
107 |
|
---|
108 | =head1 SYNOPSIS
|
---|
109 |
|
---|
110 | This module is loaded automatically by Image::ExifTool when required.
|
---|
111 |
|
---|
112 | =head1 DESCRIPTION
|
---|
113 |
|
---|
114 | This module contains routines used by Image::ExifTool to interpret JVC maker
|
---|
115 | notes.
|
---|
116 |
|
---|
117 | =head1 AUTHOR
|
---|
118 |
|
---|
119 | Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
|
---|
120 |
|
---|
121 | This library is free software; you can redistribute it and/or modify it
|
---|
122 | under the same terms as Perl itself.
|
---|
123 |
|
---|
124 | =head1 SEE ALSO
|
---|
125 |
|
---|
126 | L<Image::ExifTool::TagNames/JVC Tags>,
|
---|
127 | L<Image::ExifTool(3pm)|Image::ExifTool>
|
---|
128 |
|
---|
129 | =cut
|
---|