4 # A package for manipulating MPEG video
6 # Copyright (C) 2004 David J. Goehrig
19 my $class = ref($proto) || $proto;
22 verify (%options, qw/ -name -audio / ) if $SDL::DEBUG;
24 my $n = $options{-name} || croak "SDL::Video must supply a filename to SDL::Video::new\n";
25 my $a = $options{'-audio'} ? 1 : 0;
26 my $info = new SDL::MPEG();
28 my $self = \SDL::NewSMPEG($n,$$info,$a);
36 SDL::FreeSMPEG(${$_[0]});
40 SDL::SMPEGError(${$_[0]});
44 SDL::SMPEGEnableAudio( ${$_[0]}, $_[1]);
48 SDL::SMPEGEnableVideo( ${$_[0]}, $_[1]);
52 SDL::SMPEGSetVolume( ${$_[0]}, $_[1] );
56 croak "SDL::Video::Display requires a SDL::Surface\n" unless $_[1]->isa('SDL::Surface');
57 SDL::SMPEGSetDisplay( ${$_[0]}, ${$_[1]}, 0);
61 return SDL::SMPEGScaleXY(${$_[0]},$_[1],$_[2]) if (@_ == 3 );
62 return SDL::SMPEGScaleXY(${$_[0]},$_[1]->width(),$_[1]->height()) if $_[1]->isa('SDL::Surface');
63 SDL::SMPEGScale(${$_[0]},$_[1]);
67 SDL::SMPEGPlay(${$_[0]});
71 SDL::SMPEGPause(${$_[0]});
75 SDL::SMPEGStop(${$_[0]});
79 SDL::SMPEGRewind(${$_[0]});
83 SDL::SMPEGSeek(${$_[0]},$_[1]);
87 SDL::SMPEGSkip(${$_[0]},$_[1]);
91 SDL::SMPEGLoop(${$_[0]},$_[1]);
95 croak "SDL::Video::region requires a SDL::Rect\n" unless $_[1]->isa('SDL::Rect');
96 SDL::SMPEGDisplayRegion(${$_[0]},${$_[1]});
100 SDL::SMPEGRenderFrame(${$_[0]},$_[1]);
104 new SDL::MPEG -from => $_[0];
108 SDL::SMPEGStatus(${$_[0]});
120 SDL::Video - a SDL perl extension
124 $video = new SDL::Video ( -name => 'pr0n.mpg' );
128 C<SDL::Video> adds support for MPEG video to your
129 SDL Perl application. Videos are objects bound to
130 surfaces, whose playback is controled through the
140 C<SDL::Video::error()> returns any error messages associated with playback
144 C<SDL::Video::audio(bool)> enables or disables audio playback, (on by default)
148 C<SDL::Video::video(bool)> enables or disable video playback, (on by default)
152 C<SDL::Video::loop(bool)> enables or disable playback looping (off by default)
156 C<SDL::Video::volume(int)> set the volume as per the mixer volume
160 C<SDL::Video:display(surface)> binds the clip to a display surface
164 C<SDL::Video::scale([x,y]|[surface]|int)> scales the clip by either x,y
165 factors, scales to the image dimensions, or a single scalar.
169 C<SDL::Video::play()> plays the video clip, call C<SDL::Video::display()> before playing
173 C<SDL::Video::pause()> pauses video playback
177 C<SDL::Video::stop()> stops video playback
181 C<SDL::Video::rewind()> resets the clip to the beginning
185 C<SDL::Video::seek(offset)> seeks to a particular byte offset
189 C<SDL::Video::skip(time)> skips to a particular time
193 C<SDL::Video::region(rect)> takes a SDL::Rect and defines the display area
197 C<SDL::Video::frame(int)> renders a specific frame to the screen
201 C<SDL::Video::info()> returns a new C<SDL::MPEG> object reflecting the current status
205 C<SDL::Video::status()> returns either SMPEG_PLAYING or SMPEG_STOPPED or SMPEG_ERROR
215 perl(1) SDL::Surface(3) SDL::MPEG(3)