- Timestamp:
- 2011-06-01T12:33:42+12:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cpan/Image/ExifTool/HP.pm
r16842 r24107 13 13 use Image::ExifTool qw(:DataAccess :Utils); 14 14 15 $VERSION = '1.0 1';15 $VERSION = '1.02'; 16 16 17 17 sub ProcessHP($$$); 18 sub ProcessTDHD($$$); 18 19 19 20 # HP EXIF-format maker notes (or is it Vivitar?) … … 23 24 These tables list tags found in the maker notes of some Hewlett-Packard 24 25 camera models. 25 26 26 27 The first table lists tags found in the EXIF-format maker notes of the 27 28 PhotoSmart 720 (also used by the Vivitar ViviCam 3705, 3705B and 3715). … … 43 44 'PreviewImage' => { 44 45 Name => 'PreviewImage', 45 ValueConv => '$self->ValidateImage(\$val,$tag)',46 RawConv => '$self->ValidateImage(\$val,$tag)', 46 47 }, 47 48 'Serial Number' => 'SerialNumber', … … 110 111 }, 111 112 ); 113 114 # proprietary format TDHD data written by Photosmart R837 (ref PH) 115 %Image::ExifTool::HP::TDHD = ( 116 PROCESS_PROC => \&ProcessTDHD, 117 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, 118 NOTES => q{ 119 These tags are extracted from the APP6 "TDHD" segment of Photosmart R837 120 JPEG images. Many other unknown tags exist in is data, and can be seen with 121 the Unknown (-u) option. 122 }, 123 # (all subdirectories except TDHD and LSLV are automatically recognized 124 # by their "type" word of 0x10001) 125 TDHD => { 126 Name => 'TDHD', 127 SubDirectory => { TagTable => 'Image::ExifTool::HP::TDHD' }, 128 }, 129 LSLV => { 130 Name => 'LSLV', 131 SubDirectory => { TagTable => 'Image::ExifTool::HP::TDHD' }, 132 }, 133 FWRV => 'FirmwareVersion', 134 CMSN => 'SerialNumber', # (unverified) 135 # LTEM - some temperature? 136 ); 137 138 #------------------------------------------------------------------------------ 139 # Process HP APP6 TDHD metadata (ref PH) 140 # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref 141 # Returns: 1 on success 142 sub ProcessTDHD($$$) 143 { 144 my ($exifTool, $dirInfo, $tagTablePtr) = @_; 145 my $dataPt = $$dirInfo{DataPt}; 146 my $dataPos = $$dirInfo{DataPos}; 147 my $pos = $$dirInfo{DirStart}; 148 my $dirEnd = $pos + $$dirInfo{DirLen}; 149 my $unknown = $exifTool->Options('Unknown') || $exifTool->Options('Verbose'); 150 $exifTool->VerboseDir('TDHD', undef, $$dirInfo{DirLen}); 151 SetByteOrder('II'); 152 while ($pos + 12 < $dirEnd) { 153 my $tag = substr($$dataPt, $pos, 4); 154 my $type = Get32u($dataPt, $pos + 4); 155 my $size = Get32u($dataPt, $pos + 8); 156 $pos += 12; 157 last if $size < 0 or $pos + $size > $dirEnd; 158 if ($type == 0x10001) { 159 # this is a subdirectory containing more tags 160 my %dirInfo = ( 161 DataPt => $dataPt, 162 DataPos => $dataPos, 163 DirStart => $pos, 164 DirLen => $size, 165 ); 166 $exifTool->ProcessDirectory(\%dirInfo, $tagTablePtr); 167 } else { 168 if (not $$tagTablePtr{$tag} and $unknown) { 169 my $name = $tag; 170 $name =~ tr/-_A-Za-z0-9//dc; # remove invalid characters 171 my %tagInfo = ( 172 Name => "HP_TDHD_$name", 173 Unknown => 1, 174 ); 175 # guess format based on data size 176 if ($size == 1) { 177 $tagInfo{Format} = 'int8u'; 178 } elsif ($size == 2) { 179 $tagInfo{Format} = 'int16u'; 180 } elsif ($size == 4) { 181 $tagInfo{Format} = 'int32s'; 182 } elsif ($size > 80) { 183 $tagInfo{Binary} = 1; 184 } 185 Image::ExifTool::AddTagToTable($tagTablePtr, $tag, \%tagInfo); 186 } 187 $exifTool->HandleTag($tagTablePtr, $tag, undef, 188 DataPt => $dataPt, 189 DataPos => $dataPos, 190 Start => $pos, 191 Size => $size, 192 ); 193 } 194 $pos += $size; 195 } 196 return 1; 197 } 112 198 113 199 #------------------------------------------------------------------------------ … … 164 250 =head1 AUTHOR 165 251 166 Copyright 2003-20 07, Phil Harvey (phil at owl.phy.queensu.ca)252 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca) 167 253 168 254 This library is free software; you can redistribute it and/or modify it
Note:
See TracChangeset
for help on using the changeset viewer.