4 # A package for manipulating MPEG video
6 # Copyright (C) 2004 David J. Goehrig
17 my $class = ref($proto) || $proto;
20 verify (%options, qw/ -name -audio / ) if $SDL::DEBUG;
22 my $n = $options{-name} || die "SDL::Video must supply a filename to SDL::Video::new\n";
23 my $a = $options{'-audio'} ? 1 : 0;
24 my $info = new SDL::MPEG();
26 my $self = \SDL::NewSMPEG($n,$$info,$a);
34 SDL::FreeSMPEG(${$_[0]});
38 SDL::SMPEGError(${$_[0]});
42 SDL::SMPEGEnableAudio( ${$_[0]}, $_[1]);
46 SDL::SMPEGEnableVideo( ${$_[0]}, $_[1]);
50 SDL::SMPEGSetVolume( ${$_[0]}, $_[1] );
54 die "SDL::Video::Display requires a SDL::Surface\n" unless $_[1]->isa('SDL::Surface');
55 SDL::SMPEGSetDisplay( ${$_[0]}, ${$_[1]}, 0);
59 return SDL::SMPEGScaleXY(${$_[0]},$_[1],$_[2]) if (@_ == 3 );
60 return SDL::SMPEGScaleXY(${$_[0]},$_[1]->width(),$_[1]->height()) if $_[1]->isa('SDL::Surface');
61 SDL::SMPEGScale(${$_[0]},$_[1]);
65 SDL::SMPEGPlay(${$_[0]});
69 SDL::SMPEGPause(${$_[0]});
73 SDL::SMPEGStop(${$_[0]});
77 SDL::SMPEGRewind(${$_[0]});
81 SDL::SMPEGSeek(${$_[0]},$_[1]);
85 SDL::SMPEGSkip(${$_[0]},$_[1]);
89 SDL::SMPEGLoop(${$_[0]},$_[1]);
93 die "SDL::Video::region requires a SDL::Rect\n" unless $_[1]->isa('SDL::Rect');
94 SDL::SMPEGDisplayRegion(${$_[0]},${$_[1]});
98 SDL::SMPEGRenderFrame(${$_[0]},$_[1]);
102 new SDL::MPEG -from => $_[0];
106 SDL::SMPEGStatus(${$_[0]});
118 SDL::Video - a SDL perl extension
122 $video = new SDL::Video ( -name => 'pr0n.mpg' );
126 C<SDL::Video> adds support for MPEG video to your
127 SDL Perl application. Videos are objects bound to
128 surfaces, whose playback is controled through the
138 C<SDL::Video::error()> returns any error messages associated with playback
142 C<SDL::Video::audio(bool)> enables or disables audio playback, (on by default)
146 C<SDL::Video::video(bool)> enables or disable video playback, (on by default)
150 C<SDL::Video::loop(bool)> enables or disable playback looping (off by default)
154 C<SDL::Video::volume(int)> set the volume as per the mixer volume
158 C<SDL::Video:display(surface)> binds the clip to a display surface
162 C<SDL::Video::scale([x,y]|[surface]|int)> scales the clip by either x,y
163 factors, scales to the image dimensions, or a single scalar.
167 C<SDL::Video::play()> plays the video clip, call C<SDL::Video::display()> before playing
171 C<SDL::Video::pause()> pauses video playback
175 C<SDL::Video::stop()> stops video playback
179 C<SDL::Video::rewind()> resets the clip to the beginning
183 C<SDL::Video::seek(offset)> seeks to a particular byte offset
187 C<SDL::Video::skip(time)> skips to a particular time
191 C<SDL::Video::region(rect)> takes a SDL::Rect and defines the display area
195 C<SDL::Video::frame(int)> renders a specific frame to the screen
199 C<SDL::Video::info()> returns a new C<SDL::MPEG> object reflecting the current status
203 C<SDL::Video::status()> returns either SMPEG_PLAYING or SMPEG_STOPPED or SMPEG_ERROR
213 perl(1) SDL::Surface(3) SDL::MPEG(3)