Typo with - sign in constant. Causing constants to not be loaded correctly
[sdlgit/SDL_perl.git] / lib / SDL / MPEG.pm
CommitLineData
8fde61e3 1#
2# MPEG.pm
3#
4# A package for manipulating MPEG video
5#
6# Copyright (C) 2004 David J. Goehrig
7
8package SDL::MPEG;
9
10use strict;
11use SDL;
12
13sub new {
14 my $proto = shift;
15 my $class = ref($proto) || $proto;
16 my %options = @_;
17
18 verify (%options, qw/ -from / ) if $SDL::DEBUG;
19
20 my $self;
21 if ( $options{-from} ) {
22 die "SDL::MPEG::new -from requires a SDL::Video object\n"
23 unless $options{-from}->isa('SDL::Video');
24
25 $self = \SDL::SMPEGGetInfo(${$options{-from}});
26 } else {
27 $self = \SDL::NewSMPEGInfo();
28 }
29 bless $self,$class;
30 return $self;
31}
32
33sub DESTROY {
34 SDL::FreeSMPEGInfo(${$_[0]});
35}
36
37sub has_audio {
38 SDL::SMPEGInfoHasAudio(${$_[0]});
39}
40
41sub has_video {
42 SDL::SMPEGInfoHasVideo(${$_[0]});
43}
44
45sub width {
46 SDL::SMPEGInfoWidth(${$_[0]});
47}
48
49sub height {
50 SDL::SMPEGInfoHeight(${$_[0]});
51}
52
53sub size {
54 SDL::SMPEGInfoTotalSize(${$_[0]});
55}
56
57sub offset {
58 SDL::SMPEGInfoCurrentOffset(${$_[0]});
59}
60
61sub frame {
62 SDL::SMPEGInfoCurrentFrame(${$_[0]});
63}
64
65sub fps {
66 SDL::SMPEGInfoCurrentFPS(${$_[0]});
67}
68
69sub time {
70 SDL::SMPEGInfoCurrentTime(${$_[0]});
71}
72
73sub length {
74 SDL::SMPEGInfoTotalTime(${$_[0]});
75}
76
771;
78
79__END__;
80
81=pod
82
83
84=head1 NAME
85
86SDL::MPEG - a SDL perl extension
87
88=head1 SYNOPSIS
89
90 $info = new SDL::MPEG -from => $mpeg;
91
92=head1 DESCRIPTION
93
94C<SDL::MPEG> provides an interface to quering the status
95of a SMPEG stream.
96
97=head2 METHODS
98
99=over 4
100
101=item *
102
103C<SDL::MPEG::has_audio> returns true if it has audio track
104
105=item *
106
107C<SDL::MPEG::has_video> returns true if it has a video track
108
109=item *
110
111C<SDL::MPEG::width> returns the width of the video in pixels
112
113=item *
114
115C<SDL::MPEG::height> returns the height of the video in pixels
116
117=item *
118
119C<SDL::MPEG::size> returns the total size of the clip in bytes
120
121=item *
122
123C<SDL::MPEG::offset> returns the offset into the clip in bytes
124
125=item *
126
127C<SDL::MPEG::frame> returns the offset into the clip in fames
128
129=item *
130
131C<SDL::MPEG::fps> returns the play rate in frames per second
132
133=item *
134
135C<SDL::MPEG::time> returns the current play time in seconds
136
137=item *
138
139C<SDL::MPEG::length> returns the total play time in seconds
140
141=back
142
143=head1 AUTHOR
144
145David J. Goehrig
146
147=head1 SEE ALSO
148
149perl(1) SDL::Video(3)
150
151=cut
152