1 | #------------------------------------------------------------------------------
|
---|
2 | # File: HP.pm
|
---|
3 | #
|
---|
4 | # Description: Hewlett-Packard maker notes tags
|
---|
5 | #
|
---|
6 | # Revisions: 2007-05-03 - P. Harvey Created
|
---|
7 | #------------------------------------------------------------------------------
|
---|
8 |
|
---|
9 | package Image::ExifTool::HP;
|
---|
10 |
|
---|
11 | use strict;
|
---|
12 | use vars qw($VERSION);
|
---|
13 | use Image::ExifTool qw(:DataAccess :Utils);
|
---|
14 |
|
---|
15 | $VERSION = '1.01';
|
---|
16 |
|
---|
17 | sub ProcessHP($$$);
|
---|
18 |
|
---|
19 | # HP EXIF-format maker notes (or is it Vivitar?)
|
---|
20 | %Image::ExifTool::HP::Main = (
|
---|
21 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
22 | NOTES => q{
|
---|
23 | These tables list tags found in the maker notes of some Hewlett-Packard
|
---|
24 | camera models.
|
---|
25 |
|
---|
26 | The first table lists tags found in the EXIF-format maker notes of the
|
---|
27 | PhotoSmart 720 (also used by the Vivitar ViviCam 3705, 3705B and 3715).
|
---|
28 | },
|
---|
29 | 0x0e00 => {
|
---|
30 | Name => 'PrintIM',
|
---|
31 | Description => 'Print Image Matching',
|
---|
32 | SubDirectory => {
|
---|
33 | TagTable => 'Image::ExifTool::PrintIM::Main',
|
---|
34 | },
|
---|
35 | },
|
---|
36 | );
|
---|
37 |
|
---|
38 | # other types of HP maker notes
|
---|
39 | %Image::ExifTool::HP::Type2 = (
|
---|
40 | PROCESS_PROC => \&ProcessHP,
|
---|
41 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
42 | NOTES => 'These tags are used by the PhotoSmart E427.',
|
---|
43 | 'PreviewImage' => {
|
---|
44 | Name => 'PreviewImage',
|
---|
45 | ValueConv => '$self->ValidateImage(\$val,$tag)',
|
---|
46 | },
|
---|
47 | 'Serial Number' => 'SerialNumber',
|
---|
48 | 'Lens Shading' => 'LensShading',
|
---|
49 | );
|
---|
50 |
|
---|
51 | %Image::ExifTool::HP::Type4 = (
|
---|
52 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
53 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
54 | NOTES => 'These tags are used by the PhotoSmart M627.',
|
---|
55 | 0x0c => {
|
---|
56 | Name => 'MaxAperture',
|
---|
57 | Format => 'int16u',
|
---|
58 | ValueConv => '$val / 10',
|
---|
59 | },
|
---|
60 | 0x10 => {
|
---|
61 | Name => 'ExposureTime',
|
---|
62 | Format => 'int32u',
|
---|
63 | ValueConv => '$val / 1e6',
|
---|
64 | PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
|
---|
65 | },
|
---|
66 | 0x14 => {
|
---|
67 | Name => 'CameraDateTime',
|
---|
68 | Groups => { 2 => 'Time' },
|
---|
69 | Format => 'string[20]',
|
---|
70 | },
|
---|
71 | 0x34 => {
|
---|
72 | Name => 'ISO',
|
---|
73 | Format => 'int16u',
|
---|
74 | },
|
---|
75 | 0x5c => {
|
---|
76 | Name => 'SerialNumber',
|
---|
77 | Format => 'string[26]',
|
---|
78 | RawConv => '$val =~ s/^SERIAL NUMBER:// ? $val : undef',
|
---|
79 | },
|
---|
80 | );
|
---|
81 |
|
---|
82 | %Image::ExifTool::HP::Type6 = (
|
---|
83 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
|
---|
84 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
|
---|
85 | NOTES => 'These tags are used by the PhotoSmart M425, M525 and M527.',
|
---|
86 | 0x0c => {
|
---|
87 | Name => 'FNumber',
|
---|
88 | Format => 'int16u',
|
---|
89 | ValueConv => '$val / 10',
|
---|
90 | },
|
---|
91 | 0x10 => {
|
---|
92 | Name => 'ExposureTime',
|
---|
93 | Format => 'int32u',
|
---|
94 | ValueConv => '$val / 1e6',
|
---|
95 | PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
|
---|
96 | },
|
---|
97 | 0x14 => {
|
---|
98 | Name => 'CameraDateTime',
|
---|
99 | Groups => { 2 => 'Time' },
|
---|
100 | Format => 'string[20]',
|
---|
101 | },
|
---|
102 | 0x34 => {
|
---|
103 | Name => 'ISO',
|
---|
104 | Format => 'int16u',
|
---|
105 | },
|
---|
106 | 0x58 => {
|
---|
107 | Name => 'SerialNumber',
|
---|
108 | Format => 'string[26]',
|
---|
109 | RawConv => '$val =~ s/^SERIAL NUMBER:// ? $val : undef',
|
---|
110 | },
|
---|
111 | );
|
---|
112 |
|
---|
113 | #------------------------------------------------------------------------------
|
---|
114 | # Process HP maker notes
|
---|
115 | # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
|
---|
116 | # Returns: 1 on success, otherwise returns 0 and sets a Warning
|
---|
117 | sub ProcessHP($$$)
|
---|
118 | {
|
---|
119 | my ($exifTool, $dirInfo, $tagTablePtr) = @_;
|
---|
120 | my $dataPt = $$dirInfo{DataPt};
|
---|
121 | my $dataLen = $$dirInfo{DataLen};
|
---|
122 | my $dirStart = $$dirInfo{DirStart} || 0;
|
---|
123 | my $dirLen = $$dirInfo{DirLen} || $dataLen - $dirStart;
|
---|
124 |
|
---|
125 | # look for known text-type tags
|
---|
126 | if ($dirStart or $dirLen != length($$dataPt)) {
|
---|
127 | my $buff = substr($$dataPt, $dirStart, $dirLen);
|
---|
128 | $dataPt = \$buff;
|
---|
129 | }
|
---|
130 | my $tagID;
|
---|
131 | # brute-force scan for PreviewImage
|
---|
132 | if ($$tagTablePtr{PreviewImage} and $$dataPt =~ /(\xff\xd8\xff\xdb.*\xff\xd9)/gs) {
|
---|
133 | $exifTool->HandleTag($tagTablePtr, 'PreviewImage', $1);
|
---|
134 | # truncate preview to speed subsequent tag scans
|
---|
135 | my $buff = substr($$dataPt, 0, pos($$dataPt)-length($1));
|
---|
136 | $dataPt = \$buff;
|
---|
137 | }
|
---|
138 | # scan for other tag ID's
|
---|
139 | foreach $tagID (sort(TagTableKeys($tagTablePtr))) {
|
---|
140 | next if $tagID eq 'PreviewImage';
|
---|
141 | next unless $$dataPt =~ /$tagID:\s*([\x20-\x7f]+)/i;
|
---|
142 | $exifTool->HandleTag($tagTablePtr, $tagID, $1);
|
---|
143 | }
|
---|
144 | return 1;
|
---|
145 | }
|
---|
146 |
|
---|
147 | 1; # end
|
---|
148 |
|
---|
149 | __END__
|
---|
150 |
|
---|
151 | =head1 NAME
|
---|
152 |
|
---|
153 | Image::ExifTool::HP - Hewlett-Packard maker notes tags
|
---|
154 |
|
---|
155 | =head1 SYNOPSIS
|
---|
156 |
|
---|
157 | This module is loaded automatically by Image::ExifTool when required.
|
---|
158 |
|
---|
159 | =head1 DESCRIPTION
|
---|
160 |
|
---|
161 | This module contains definitions required by Image::ExifTool to interpret
|
---|
162 | Hewlett-Packard maker notes.
|
---|
163 |
|
---|
164 | =head1 AUTHOR
|
---|
165 |
|
---|
166 | Copyright 2003-2007, Phil Harvey (phil at owl.phy.queensu.ca)
|
---|
167 |
|
---|
168 | This library is free software; you can redistribute it and/or modify it
|
---|
169 | under the same terms as Perl itself.
|
---|
170 |
|
---|
171 | =head1 SEE ALSO
|
---|
172 |
|
---|
173 | L<Image::ExifTool::TagNames/HP Tags>,
|
---|
174 | L<Image::ExifTool(3pm)|Image::ExifTool>
|
---|
175 |
|
---|
176 | =cut
|
---|