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
|
|
|
|
|
|
|
package Image::MetaData::JPEG::Segment; |
7
|
15
|
|
|
15
|
|
97
|
no integer; |
|
15
|
|
|
|
|
43
|
|
|
15
|
|
|
|
|
116
|
|
8
|
15
|
|
|
15
|
|
547
|
use strict; |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
541
|
|
9
|
15
|
|
|
15
|
|
85
|
use warnings; |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
2883
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
########################################################### |
12
|
|
|
|
|
|
|
# This routine is a generic segment parsers, which saves # |
13
|
|
|
|
|
|
|
# the first 30 bytes of the segment in a record, then # |
14
|
|
|
|
|
|
|
# generates an error to inhibit update(). In this way, # |
15
|
|
|
|
|
|
|
# the segment must be rewritten to disk unchanged, but # |
16
|
|
|
|
|
|
|
# the nature of the segment is at least hinted by the # |
17
|
|
|
|
|
|
|
# initial bytes (just for debugging ...). # |
18
|
|
|
|
|
|
|
########################################################### |
19
|
|
|
|
|
|
|
sub parse_unknown { |
20
|
3
|
|
|
3
|
0
|
8
|
my ($this) = @_; |
21
|
|
|
|
|
|
|
# save the first 30 bytes and translate non-printing characters |
22
|
3
|
|
|
|
|
7
|
my $bytes = 30; |
23
|
3
|
|
|
|
|
19
|
$this->store_record("First $bytes bytes ...", $ASCII, 0, $bytes); |
24
|
|
|
|
|
|
|
# generate an error |
25
|
1
|
|
|
|
|
3
|
$this->die('Unknown segment type'); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
########################################################### |
29
|
|
|
|
|
|
|
# This method parses a COM segment. This is very simple # |
30
|
|
|
|
|
|
|
# since it is just one string. # |
31
|
|
|
|
|
|
|
########################################################### |
32
|
|
|
|
|
|
|
sub parse_com { |
33
|
91
|
|
|
91
|
0
|
205
|
my ($this) = @_; |
34
|
|
|
|
|
|
|
# save the whole comment as a single value |
35
|
91
|
|
|
|
|
326
|
$this->store_record('Comment', $ASCII, 0, $this->size()); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
########################################################### |
39
|
|
|
|
|
|
|
# Require all other segment-specific parsers. # |
40
|
|
|
|
|
|
|
########################################################### |
41
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/app0.pl'; |
42
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/app1.pl'; |
43
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/app2.pl'; |
44
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/app3.pl'; |
45
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/app12.pl'; |
46
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/app13.pl'; |
47
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/app14.pl'; |
48
|
|
|
|
|
|
|
require 'Image/MetaData/JPEG/parsers/image.pl'; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# successful package load |
51
|
|
|
|
|
|
|
1; |