This file is indexed.

/usr/share/perl5/Image/ExifTool/Lytro.pm is in libimage-exiftool-perl 10.80-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#------------------------------------------------------------------------------
# File:         Lytro.pm
#
# Description:  Read Lytro LFP files
#
# Revisions:    2014-07-17 - P. Harvey Created
#
# References:   1) http://optics.miloush.net/lytro/TheFileFormat.aspx
#------------------------------------------------------------------------------

package Image::ExifTool::Lytro;

use strict;
use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::Import;

$VERSION = '1.02';

sub ExtractTags($$$);

# Lytro LFP tags (ref PH)
%Image::ExifTool::Lytro::Main = (
    GROUPS => { 2 => 'Camera' },
    VARS => { NO_ID => 1 },
    NOTES => q{
        Tag definitions for Lytro Light Field Picture (LFP) files.  ExifTool
        extracts the full JSON metadata blocks, as well as breaking them down into
        individual tags.  All available tags are extracted from the JSON metadata,
        even if they don't appear in the table below.
    },
    JSONMetadata => {
        Notes => 'the full JSON-format metadata blocks',
        Binary => 1,
        List => 1,
    },
    EmbeddedImage => {
        Notes => 'JPEG image embedded in LFP files written by Lytro Desktop',
        Groups => { 2 => 'Preview' },
        Binary => 1,
    },
    Type                => { Name => 'CameraType' },
    CameraMake          => { Name => 'Make' },
    CameraModel         => { Name => 'Model', Description => 'Camera Model Name' },
    CameraSerialNumber  => { Name => 'SerialNumber'},
    CameraFirmware      => { Name => 'FirmwareVersion'},
    DevicesAccelerometerSampleArrayTime => { Name => 'AccelerometerTime'},
    DevicesAccelerometerSampleArrayX    => { Name => 'AccelerometerX'},
    DevicesAccelerometerSampleArrayY    => { Name => 'AccelerometerY'},
    DevicesAccelerometerSampleArrayZ    => { Name => 'AccelerometerZ'},
    DevicesClockZuluTime => {
        Name => 'DateTimeOriginal',
        Groups => { 2 => 'Time' },
        ValueConv => 'require Image::ExifTool::XMP; Image::ExifTool::XMP::ConvertXMPDate($val)',
        PrintConv => '$self->ConvertDateTime($val)',
    },
    DevicesLensFNumber => {
        Name => 'FNumber',
        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
    },
    DevicesLensFocalLength => {
        Name => 'FocalLength',
        ValueConv => '$val * 1000', # convert from metres to mm
        PrintConv => 'sprintf("%.1f mm",$val)',
    },
    DevicesLensTemperature => {
        Name => 'LensTemperature',
        PrintConv => 'sprintf("%.1f C",$val)',
    },
    DevicesSocTemperature => {
        Name => 'SocTemperature',
        PrintConv => 'sprintf("%.1f C",$val)',
    },
    DevicesShutterFrameExposureDuration => {
        Name => 'FrameExposureTime',
        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
    },
    DevicesShutterPixelExposureDuration => {
        Name => 'ExposureTime',
        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
    },
    DevicesSensorPixelPitch => {
        Name => 'FocalPlaneXResolution',
        Notes => 'Y resolution is the same as X resolution',
        ValueConv => '25.4 / $val / 1000',  # convert from metres to pixels/inch
    },
    DevicesSensorSensorSerial   => { Name => 'SensorSerialNumber'},
    DevicesSensorIso            => { Name => 'ISO' },
    ImageLimitExposureBias      => { Groups => { 2 => 'Image' }, PrintConv => 'sprintf("%+.1f", $val)' },
    ImageModulationExposureBias => { Groups => { 2 => 'Image' }, PrintConv => 'sprintf("%+.1f", $val)' },
    ImageOrientation => {
        Name => 'Orientation',
        Groups => { 2 => 'Image' },
        PrintConv => {
            1 => 'Horizontal (normal)',
        },
    },
);

#------------------------------------------------------------------------------
# Extract tags from a parsed JSON hash
# Inputs: 0) ExifTool ref, 1) tag hash ref, 2) base tag name
sub ExtractTags($$$)
{
    my ($et, $meta, $parent) = @_;
    ref $meta eq 'HASH' or $et->Warn('Invalid LFP metadata'), return;
    my ($key, $val, $name, $tagTablePtr);
    foreach $key (sort keys %$meta) {
        my $tag = $parent . ucfirst($key);
        foreach $val (ref $$meta{$key} eq 'ARRAY' ? @{$$meta{$key}} : $$meta{$key}) {
            ref $val eq 'HASH' and ExtractTags($et, $val, $tag), next;
            $tagTablePtr or $tagTablePtr = GetTagTable('Image::ExifTool::Lytro::Main');
            unless ($$tagTablePtr{$tag}) {
                ($name = $tag) =~ s/[^-_a-zA-Z0-9](.?)/\U$1/g;
                $name =~ s/ParametersVendorContentComLytroTags//;
                my %tagInfo;
                $tagInfo{Groups} = { 2 => 'Image' } unless $name =~ s/^Devices//;
                $tagInfo{List} = 1 if ref $$meta{$key} eq 'ARRAY';
                $tagInfo{Name} = $name;
                my $str = $tag eq $name ? '' : " as $name";
                $et->VPrint(0, "  [adding $tag$str]\n");
                AddTagToTable($tagTablePtr, $tag, \%tagInfo);
            }
            $et->HandleTag($tagTablePtr, $tag, $val);
        }
    }
}

#------------------------------------------------------------------------------
# Process segments from a Lytro LFP image
# Inputs: 0) ExifTool object reference, 1) dirInfo reference
# Returns: 1 on success, 0 if this wasn't a valid Lytro image
sub ProcessLFP($$)
{
    my ($et, $dirInfo) = @_;
    my $raf = $$dirInfo{RAF};
    my $verbose = $et->Options('Verbose');
    my ($buff, $id, %dumpParms);

    # validate the Lytro file header
    return 0 unless $raf->Read($buff, 16) == 16 and $buff =~ /^\x89LFP\x0d\x0a\x1a\x0a/;
    $et->SetFileType();   # set the FileType tag
    SetByteOrder('MM');
    if ($verbose > 2) {
        %dumpParms = ( Out => $$et{OPTIONS}{TextOut} );
        $dumpParms{MaxLen} = 128 if $verbose < 4;
    }
    my $tagTablePtr = GetTagTable('Image::ExifTool::Lytro::Main');
    while ($raf->Read($buff, 16) == 16) {
        $buff =~ /^\x89LF/ or $et->Warn('LFP format error'), last;
        my $size = Get32u(\$buff, 12);
        $size & 0x80000000 and $et->Warn('Invalid LFP segment size'), last;
        $raf->Read($id, 80) == 80 or $et->Warn('Truncated LFP segment'), last;  # ignore the sha1
        if ($verbose) {
            $id =~ s/\0.*//s;
            $et->VPrint(0, substr($buff,1,3), " segment ($size bytes, $id)\n");
        }
        if ($size > 20000000) {
            $raf->Seek($size, 1) or $et->Warn('Seek error in LFP file'), last;
        } else {
            $raf->Read($buff,$size) == $size or $et->Warn('Truncated LFP data'), last;
            HexDump(\$buff, undef, %dumpParms, Addr=>$raf->Tell()-$size) if $verbose > 2;
            if ($buff =~ /^\{\s+"/) { # JSON metadata?
                pos($buff) = 0;
                $et->HandleTag($tagTablePtr, 'JSONMetadata', $buff);
                my $meta = Image::ExifTool::Import::ReadJSONObject(undef, \$buff);
                ExtractTags($et, $meta, '');
            } elsif ($buff =~ /^\xff\xd8\xff/) { # embedded JPEG image?
                $et->HandleTag($tagTablePtr, 'EmbeddedImage', $buff);
            }
        }
        # skip padding if necessary
        my $pad = 16 - ($size % 16);
        $raf->Seek($pad, 1) if $pad != 16;
    }
    return 1;
}

1;  # end

__END__

=head1 NAME

Image::ExifTool::Lytro - Read Lytro LFP files

=head1 SYNOPSIS

This module is used by Image::ExifTool

=head1 DESCRIPTION

This module contains routines required by Image::ExifTool to read metadata
from Lytro Light Field Picture (LFP) files.

=head1 AUTHOR

Copyright 2003-2018, Phil Harvey (phil at owl.phy.queensu.ca)

This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=head1 REFERENCES

=over 4

=item L<http://optics.miloush.net/lytro/TheFileFormat.aspx>

=back

=head1 SEE ALSO

L<Image::ExifTool::TagNames/Lytro Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>

=cut