X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSDL%2FVideo.pm;h=bd079453064272ab6b0839372e9ff3ed9bd891f1;hb=d817c64cf4e647cad62e7ebc3e09e88642901d9e;hp=494679c78790a392059b489fd30e6433d421fd41;hpb=cc6d0c7c898f974909b02fbf99163f5fd592cd50;p=sdlgit%2FSDL_perl.git diff --git a/lib/SDL/Video.pm b/lib/SDL/Video.pm index 494679c..bd07945 100644 --- a/lib/SDL/Video.pm +++ b/lib/SDL/Video.pm @@ -1,242 +1,185 @@ -#!/usr/bin/env perl -# -# Video.pm -# -# Copyright (C) 2005 David J. Goehrig -# -# ------------------------------------------------------------------------------ -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# -# ------------------------------------------------------------------------------ -# -# Please feel free to send questions, suggestions or improvements to: -# -# David J. Goehrig -# dgoehrig@cpan.org -# - package SDL::Video; - use strict; use warnings; -use Carp; -use SDL; -use SDL::Surface; -use SDL::MPEG; - -sub new { - my $proto = shift; - my $class = ref($proto) || $proto; - my %options = @_; - - verify (%options, qw/ -name -audio / ) if $SDL::DEBUG; - - my $n = $options{-name} || die "SDL::Video must supply a filename to SDL::Video::new\n"; - my $a = $options{'-audio'} ? 1 : 0; - my $info = new SDL::MPEG(); - - my $self = \SDL::NewSMPEG($n,$$info,$a); - croak SDL::GetError() unless $$self; - bless $self,$class; - $self->audio(1); - $self->video(1); - return $self, $info; -} - -sub DESTROY { - SDL::FreeSMPEG(${$_[0]}); -} - -sub error { - SDL::SMPEGError(${$_[0]}); -} - -sub audio { - SDL::SMPEGEnableAudio( ${$_[0]}, $_[1]); -} - -sub video { - SDL::SMPEGEnableVideo( ${$_[0]}, $_[1]); -} - -sub volume { - SDL::SMPEGSetVolume( ${$_[0]}, $_[1] ); -} - -sub display { - croak "SDL::Video::Display requires a SDL::Surface\n" unless $_[1]->isa('SDL::Surface'); - SDL::SMPEGSetDisplay( ${$_[0]}, ${$_[1]}, 0); -} - -sub scale { - return SDL::SMPEGScaleXY(${$_[0]},$_[1],$_[2]) if (@_ == 3 ); - return SDL::SMPEGScaleXY(${$_[0]},$_[1]->width(),$_[1]->height()) if $_[1]->isa('SDL::Surface'); - SDL::SMPEGScale(${$_[0]},$_[1]); -} - -sub play { - SDL::SMPEGPlay(${$_[0]}); -} - -sub pause { - SDL::SMPEGPause(${$_[0]}); -} - -sub stop { - SDL::SMPEGStop(${$_[0]}); -} - -sub rewind { - SDL::SMPEGRewind(${$_[0]}); -} - -sub seek { - SDL::SMPEGSeek(${$_[0]},$_[1]); -} - -sub skip { - SDL::SMPEGSkip(${$_[0]},$_[1]); -} - -sub loop { - SDL::SMPEGLoop(${$_[0]},$_[1]); -} - -sub region { - croak "SDL::Video::region requires a SDL::Rect\n" unless $_[1]->isa('SDL::Rect'); - SDL::SMPEGDisplayRegion(${$_[0]},${$_[1]}); -} - -sub frame { - SDL::SMPEGRenderFrame(${$_[0]},$_[1]); -} - -sub info { - new SDL::MPEG -from => $_[0]; -} - -sub status { - SDL::SMPEGStatus(${$_[0]}); -} +require Exporter; +require DynaLoader; +our @ISA = qw(Exporter DynaLoader); +bootstrap SDL::Video; 1; -__END__; +__END__ =pod - =head1 NAME -SDL::Video - a SDL perl extension +SDL::Video - Bindings to the video category in SDL API =head1 SYNOPSIS - $video = new SDL::Video ( -name => 'pr0n.mpg' ); +This module is not an object. Please read the =head1 DESCRIPTION -C adds support for MPEG video to your -SDL Perl application. Videos are objects bound to -surfaces, whose playback is controled through the -object's interface. -=head2 METHODS +=head1 METHODS + +=head2 get_video_surface + +Returns a pointer to the current display surface + +=head2 get_video_info + +Returns a pointer to information about the video hardware + +=head2 video_driver_name + +Obtain the name of the video driver + +=head2 list_modes + +Returns a pointer to an array of available screen dimensions for the given format and video flags + +=head2 set_video_mode + +Checks to see if a particular video mode is supported. + +=head2 video_mode_ok + +Sets up a video mode with the specified width, height and bits-per-pixel. + +=head2 update_rect + +Makes sure the given area is updated on the given screen. + +=head2 update_rects + +Makes sure the given list of rectangles is updated on the given screen. + +=head2 flip + +Swaps screen buffers + +=head2 set_colors + +Sets a portion of the colormap for the given 8-bit surface. + +=head2 set_palette + +Sets the colors in the palette of an 8-bit surface. -=over 4 +=head2 set_gamma -=item * +Sets the color gamma function for the display -C returns any error messages associated with playback +=head2 get_gamma_ramp -=item * +Gets the color gamma lookup tables for the display -C enables or disables audio playback, (on by default) +=head2 set_gmmma_ramp -=item * +Sets the color gamma lookup tables for the display -C enables or disable video playback, (on by default) +=head2 map_RGB -=item * +Maps a RGB color value to a pixel format. -C enables or disable playback looping (off by default) +=head2 map_RGBA -=item * +Maps a RGBA color value to a pixel format. -C set the volume as per the mixer volume +=head2 get_RGB -=item * +Gets RGB values from a pixel in the specified pixel format. -C binds the clip to a display surface +=head2 get_RGBA -=item * +Gets RGBA values from a pixel in the specified pixel format. -C scales the clip by either x,y -factors, scales to the image dimensions, or a single scalar. +=head2 create_RGB_surface_from -=item * +Creates an empty SDL::Surface from pixel data -C plays the video clip, call C before playing +=head2 lock_surface -=item * +Locks a surface for direct access. -C pauses video playback +=head2 unlock_surface -=item * +Unlocks a previously locked surface. -C stops video playback +=head2 convert_surface -=item * +Converts a surface to the same format as another surface. -C resets the clip to the beginning +=head2 display_format -=item * +Converts a surface to the display format -C seeks to a particular byte offset +=head2 display_format_alpha -=item * +Converts a surface to the display format -C skips to a particular time +=head2 load_BMP -=item * -C takes a SDL::Rect and defines the display area +=head2 save_BMP -=item * -C renders a specific frame to the screen +=head2 set_color_key -=item * -C returns a new C object reflecting the current status +=head2 set_alpha -=item * -C returns either SMPEG_PLAYING or SMPEG_STOPPED or SMPEG_ERROR +=head2 set_clip_rect -=back -=head1 AUTHOR +=head2 get_clip_rect + + +=head2 blit_surface + + +=head2 fill_rect + + +=head2 GL_load_library + + +=head2 GL_get_proc_address + + +=head2 GL_get_attribute + + +=head2 GL_set_attribute + + +=head2 GL_swap_buffers + + +=head2 GL_attr + + +=head2 lock_YUV_overlay + + +=head2 unlock_YUV_overlay + + +=head2 display_YUV_overlay + -David J. Goehrig =head1 SEE ALSO -perl(1) SDL::Surface(3) SDL::MPEG(3) +=head2 Category Objects -=cut +L, L, L, +L, L, L, +L +=cut