| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ########################################################### | 
| 2 |  |  |  |  |  |  | # A Perl package for showing/modifying JPEG (meta)data.   # | 
| 3 |  |  |  |  |  |  | # Copyright (C) 2004,2005,2006 Stefano Bettelli           # | 
| 4 |  |  |  |  |  |  | # See the COPYING and LICENSE files for license terms.    # | 
| 5 |  |  |  |  |  |  | ########################################################### | 
| 6 | 15 |  |  | 15 |  | 66 | use Image::MetaData::JPEG::data::Tables qw(:TagsAPP1_Exif :TagsAPP1_XMP); | 
|  | 15 |  |  |  |  | 24 |  | 
|  | 15 |  |  |  |  | 2813 |  | 
| 7 | 15 |  |  | 15 |  | 74 | no  integer; | 
|  | 15 |  |  |  |  | 23 |  | 
|  | 15 |  |  |  |  | 63 |  | 
| 8 | 15 |  |  | 15 |  | 257 | use strict; | 
|  | 15 |  |  |  |  | 20 |  | 
|  | 15 |  |  |  |  | 336 |  | 
| 9 | 15 |  |  | 15 |  | 63 | use warnings; | 
|  | 15 |  |  |  |  | 18 |  | 
|  | 15 |  |  |  |  | 1610 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | ########################################################### | 
| 12 |  |  |  |  |  |  | # Entry point for dumping an APP1 segment. It decides     # | 
| 13 |  |  |  |  |  |  | # between Exif APP1 and XMP and then dispatches to the    # | 
| 14 |  |  |  |  |  |  | # correct subroutine (the identifier is not yet written). # | 
| 15 |  |  |  |  |  |  | ########################################################### | 
| 16 |  |  |  |  |  |  | sub dump_app1 { | 
| 17 | 163 |  |  | 163 | 0 | 223 | my ($this) = @_; | 
| 18 |  |  |  |  |  |  | # Look for the 'Identifier' record (which should always exist and | 
| 19 |  |  |  |  |  |  | # contain the EXIF tag), and for a 'Namespace' record (Adobe XMP) | 
| 20 | 163 |  |  |  |  | 482 | my $identif   = $this->search_record_value('Identifier'); | 
| 21 | 163 |  |  |  |  | 416 | my $namespace = $this->search_record_value('Namespace'); | 
| 22 |  |  |  |  |  |  | # If the 'Identifier' record exists and contains | 
| 23 |  |  |  |  |  |  | # the EXIF tag, this is a standard Exif segment | 
| 24 | 163 | 100 | 66 |  |  | 753 | if ($identif && $identif eq $APP1_EXIF_TAG) { $this->dump_app1_exif(); } | 
|  | 161 | 50 |  |  |  | 646 |  | 
| 25 |  |  |  |  |  |  | # Otherwise, look for a 'Namespace' record; chances | 
| 26 |  |  |  |  |  |  | # are this is an Adobe XMP segment | 
| 27 | 0 |  |  |  |  | 0 | elsif ($namespace) { return 'Dumping XMP APP1 not implemented'; } | 
| 28 |  |  |  |  |  |  | # Otherwise, we have a problem | 
| 29 | 2 |  |  |  |  | 6 | else { return 'Segment dump not possible'; } | 
| 30 |  |  |  |  |  |  | # return without errors | 
| 31 | 161 |  |  |  |  | 691 | return undef; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | require 'Image/MetaData/JPEG/dumpers/app1_exif.pl'; | 
| 35 |  |  |  |  |  |  | #require 'Image/MetaData/JPEG/dumpers/app1_xmp.pl'; | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | # successful load | 
| 38 |  |  |  |  |  |  | 1; |