/lib/SDL/SMPEG/Info.pm

http://github.com/PerlGameDev/SDL · Perl · 105 lines · 57 code · 18 blank · 30 comment · 3 complexity · 9232d8381e668237b452fa35e8ccced4 MD5 · raw file

  1. #!/usr/bin/env perl
  2. #
  3. # MPEG.pm
  4. #
  5. # Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
  6. #
  7. # ------------------------------------------------------------------------------
  8. #
  9. # This library is free software; you can redistribute it and/or
  10. # modify it under the terms of the GNU Lesser General Public
  11. # License as published by the Free Software Foundation; either
  12. # version 2.1 of the License, or (at your option) any later version.
  13. #
  14. # This library is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. # Lesser General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Lesser General Public
  20. # License along with this library; if not, write to the Free Software
  21. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. #
  23. # ------------------------------------------------------------------------------
  24. #
  25. # Please feel free to send questions, suggestions or improvements to:
  26. #
  27. # David J. Goehrig
  28. # dgoehrig@cpan.org
  29. #
  30. package SDL::SMPEG::Info;
  31. use strict;
  32. use warnings;
  33. use Carp;
  34. use SDL;
  35. our @ISA = qw(Exporter DynaLoader);
  36. use SDL::SMPEG;
  37. use SDL::Internal::Loader;
  38. internal_load_dlls(__PACKAGE__);
  39. our $VERSION = 2.548;
  40. bootstrap SDL::SMPEG::Info;
  41. sub new {
  42. my $proto = shift;
  43. my $class = ref($proto) || $proto;
  44. my %options = @_;
  45. my $self;
  46. if ( $options{-from} ) {
  47. $self = \SDL::SMPEG::SMPEGGetInfo( $options{-from} );
  48. } else {
  49. $self = \NewSMPEGInfo();
  50. }
  51. bless $self, $class;
  52. return $self;
  53. }
  54. sub DESTROY {
  55. # FreeSMPEGInfo( $_[0] );
  56. }
  57. sub has_audio {
  58. SMPEGInfoHasAudio( $_[0] );
  59. }
  60. sub has_video {
  61. SMPEGInfoHasVideo( $_[0] );
  62. }
  63. sub width {
  64. SMPEGInfoWidth( $_[0] );
  65. }
  66. sub height {
  67. SMPEGInfoHeight( $_[0] );
  68. }
  69. sub size {
  70. SMPEGInfoTotalSize( $_[0] );
  71. }
  72. sub offset {
  73. SMPEGInfoCurrentOffset( $_[0] );
  74. }
  75. sub frame {
  76. SMPEGInfoCurrentFrame( $_[0] );
  77. }
  78. sub fps {
  79. SMPEGInfoCurrentFPS( $_[0] );
  80. }
  81. sub time {
  82. SMPEGInfoCurrentTime( $_[0] );
  83. }
  84. sub length {
  85. SMPEGInfoTotalTime( $_[0] );
  86. }
  87. 1;