Theora.pm 3.4 KB

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