source: main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Theora.pm@ 34921

Last change on this file since 34921 was 34921, checked in by anupama, 3 years ago

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File size: 3.4 KB
Line 
1#------------------------------------------------------------------------------
2# File: Theora.pm
3#
4# Description: Read Theora video meta information
5#
6# Revisions: 2011/07/13 - P. Harvey Created
7#
8# References: 1) http://www.theora.org/doc/Theora.pdf
9#------------------------------------------------------------------------------
10
11package Image::ExifTool::Theora;
12
13use strict;
14use vars qw($VERSION);
15use Image::ExifTool qw(:DataAccess :Utils);
16
17$VERSION = '1.00';
18
19# Theora header types
20%Image::ExifTool::Theora::Main = (
21 NOTES => q{
22 Information extracted from Ogg Theora video files. See
23 L<http://www.theora.org/doc/Theora.pdf> for the Theora specification.
24 },
25 0x80 => {
26 Name => 'Identification',
27 SubDirectory => {
28 TagTable => 'Image::ExifTool::Theora::Identification',
29 ByteOrder => 'BigEndian',
30 },
31 },
32 0x81 => {
33 Name => 'Comments',
34 SubDirectory => {
35 TagTable => 'Image::ExifTool::Vorbis::Comments',
36 },
37 },
38 # 0x82 - Setup
39);
40
41# tags extracted from Theora Idenfication header
42%Image::ExifTool::Theora::Identification = (
43 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
44 GROUPS => { 2 => 'Video' },
45 NOTES => 'Tags extracted from the Theora identification header.',
46 0 => {
47 Name => 'TheoraVersion',
48 Format => 'int8u[3]',
49 PrintConv => '$val =~ tr/ /./; $val',
50 },
51 7 => {
52 Name => 'ImageWidth',
53 Format => 'int32u',
54 ValueConv => '$val >> 8',
55 },
56 10 => {
57 Name => 'ImageHeight',
58 Format => 'int32u',
59 ValueConv => '$val >> 8',
60 },
61 13 => 'XOffset',
62 14 => 'YOffset',
63 15 => {
64 Name => 'FrameRate',
65 Format => 'rational64u',
66 PrintConv => 'int($val * 1000 + 0.5) / 1000',
67 },
68 23 => {
69 Name => 'PixelAspectRatio',
70 Format => 'int16u[3]',
71 ValueConv => 'my @a=split(" ",$val); (($a[0]<<8)+($a[1]>>8)) / ((($a[1]&0xff)<<8)+$a[2])',
72 PrintConv => 'int($val * 1000 + 0.5) / 1000',
73 },
74 29 => {
75 Name => 'ColorSpace',
76 PrintConv => {
77 0 => 'Undefined',
78 1 => 'Rec. 470M',
79 2 => 'Rec. 470BG',
80 },
81 },
82 30 => {
83 Name => 'NominalVideoBitrate',
84 Format => 'int32u',
85 ValueConv => '$val >> 8',
86 PrintConv => {
87 0 => 'Unspecified',
88 OTHER => \&Image::ExifTool::ConvertBitrate,
89 },
90 },
91 33 => {
92 Name => 'Quality',
93 ValueConv => '$val >> 2',
94 },
95 34 => {
96 Name => 'PixelFormat',
97 ValueConv => '($val >> 3) & 0x3',
98 PrintConv => {
99 0 => '4:2:0',
100 2 => '4:2:2',
101 3 => '4:4:4',
102 },
103 },
104);
105
1061; # end
107
108__END__
109
110=head1 NAME
111
112Image::ExifTool::Theora - Read Theora video meta information
113
114=head1 SYNOPSIS
115
116This module is used by Image::ExifTool
117
118=head1 DESCRIPTION
119
120This module contains definitions required by Image::ExifTool to extract meta
121information from Theora video streams.
122
123=head1 AUTHOR
124
125Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
126
127This library is free software; you can redistribute it and/or modify it
128under the same terms as Perl itself.
129
130=head1 REFERENCES
131
132=over 4
133
134=item L<http://www.theora.org/doc/Theora.pdf>
135
136=back
137
138=head1 SEE ALSO
139
140L<Image::ExifTool::TagNames/Theora Tags>,
141L<Image::ExifTool::TagNames/Ogg Tags>,
142L<Image::ExifTool(3pm)|Image::ExifTool>
143
144=cut
145
Note: See TracBrowser for help on using the repository browser.