| 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 | |||
| 11 | package Image::ExifTool::Theora; | ||
| 12 | |||
| 13 | use strict; | ||
| 14 | use vars qw($VERSION); | ||
| 15 | use 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 | |||
| 106 | 1; # end | ||
| 107 | |||
| 108 | __END__ |