aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos')
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/GLMovie/glmovie.dpr434
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Campus.jpgbin0 -> 4836 bytes
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/MPEGPlay.dpr26
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.dfmbin0 -> 1314 bytes
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.pas91
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.xfm106
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/README.1ST21
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/sdlmpegpanel.pas149
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video40.dpk33
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video50.dpk33
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video60.dpk35
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.cfg38
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dof136
-rw-r--r--Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dpr278
14 files changed, 1380 insertions, 0 deletions
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/GLMovie/glmovie.dpr b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/GLMovie/glmovie.dpr
new file mode 100644
index 00000000..375e0b79
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/GLMovie/glmovie.dpr
@@ -0,0 +1,434 @@
+program glmovie;
+{******************************************************************}
+{ }
+{ Object Pascal Example of using smpeg with OpenGL }
+{ Conversion of the glmovie Demo }
+{ }
+{ Portions created by Sam Lantinga <slouken@devolution.com>, are }
+{ Copyright (C) 1998 Sam Lantinga. }
+{ All Rights Reserved. }
+{ }
+{ The original files are : glmovie.c }
+{ }
+{ The original Pascal code is : glmovie.dpr }
+{ The initial developer of the Pascal code is : }
+{ Dominique Louis <Dominique@SavageSoftware.com.au> }
+{ }
+{ Portions created by Dominique Louis are }
+{ Copyright (C) 2001 Dominique Louis. }
+{ }
+{ Contributor(s) }
+{ -------------- }
+{ Romi Kuntsman <romik@users.sourceforge.net> }
+{ }
+{ Obtained through: }
+{ Joint Endeavour of Delphi Innovators ( Project JEDI ) }
+{ }
+{ You may retrieve the latest version of this file at the Project }
+{ JEDI home page, located at http://delphi-jedi.org }
+{ }
+{ The contents of this file are used with permission, subject to }
+{ the Mozilla Public License Version 1.1 (the "License"); you may }
+{ not use this file except in compliance with the License. You may }
+{ obtain a copy of the License at }
+{ http://www.mozilla.org/NPL/NPL-1_1Final.html }
+{ }
+{ Software distributed under the License is distributed on an }
+{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
+{ implied. See the License for the specific language governing }
+{ rights and limitations under the License. }
+{ }
+{ Description }
+{ ----------- }
+{ GLMovie : Shows how to load and play an Mpeg file using OpenGL }
+{ }
+{ }
+{ Requires }
+{ -------- }
+{ SDL runtime libary for SDL, smpeg and OpenGL somewhere }
+{ in your path . }
+{ The Latest SDL runtimes can be found on http://www.libsdl.org }
+{ }
+{ Programming Notes }
+{ ----------------- }
+{ This demo shows how to load and play an mpeg file using smpeg }
+{ with OpenGLv }
+{ You will need Smpeg libraris and OpenGL in order for this demo }
+{ }
+{ Revision History }
+{ ---------------- }
+{ December 02 2001 - DL : Initial translation. }
+{ June 21 2002 - RK : Fixed DL's silly mistakes }
+{ }
+{ }
+{******************************************************************}
+
+uses
+ SysUtils,
+ gl,
+ glu,
+ smpeg,
+ sdl,
+ logger;
+
+type
+ { Some data is redundant at this stage. }
+ PGLMovieTexture = ^TGLMovieTexture;
+ TGLMovieTexture = record
+ id : GLuint; (* OpenGL texture id. *)
+ poly_width : GLuint; (* Quad width for tile. *)
+ poly_height : GLuint; (* Quad height for tile. *)
+ movie_width : GLuint; (* Width of movie inside tile. *)
+ movie_height : GLuint; (* Height of movie inside tile. *)
+ skip_rows : GLuint; (* Number of rows of movie to skip *)
+ skip_pixels : GLuint; (* Number of columns of movie to skip *)
+ row : GLuint; (* Row number of tile in scheme. *)
+ col : GLuint; (* Column number of tile in scheme. *)
+ end;
+
+type
+ TGLuintArray = array of GLuint;
+ PGLuintArray = ^TGLuintArray;
+ TGLMovieTextureArray = array of TGLMovieTexture;
+ PGLMovieTextureArray = ^TGLMovieTextureArray;
+
+var
+ (* Our evil maximum texture size. Boo 3Dfxnot *)
+ texture_size : GLuint = 256; (* Keep this around for easy freeing later. *)
+ texture_ids : TGLuintArray; (* Our main data. *)
+ textures : TGLMovieTextureArray;
+ num_texture_rows : GLuint = 0;
+ num_texture_cols : GLuint = 0; (* Width and height of all tiling. *)
+ tiled_width : GLuint = 0;
+ tiled_height : GLuint = 0; (* Width and height of entire movie. *)
+ movie_width : GLuint = 0;
+ movie_height : GLuint = 0;
+
+ (*
+ * Draw the frame data.
+ *
+ * Parameters:
+ * frame: Actual RGBA frame data
+ *)
+
+procedure glmovie_draw( frame : PGLubyte );
+var
+ i : GLuint;
+ shift : GLdouble;
+begin
+ glClear( GL_COLOR_BUFFER_BIT );
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity;
+ shift := 1 / ( texture_size );
+ for i := 0 to num_texture_rows * num_texture_cols - 1 do
+ begin
+ glBindTexture( GL_TEXTURE_2D, textures[ i ].id );
+ glPixelStorei( GL_UNPACK_ROW_LENGTH, movie_width );
+ glPixelStorei( GL_UNPACK_SKIP_ROWS, textures[ i ].skip_rows );
+ glPixelStorei( GL_UNPACK_SKIP_PIXELS, textures[ i ].skip_pixels );
+ glTexSubImage2D( GL_TEXTURE_2D, 0, 0, (* offset_x *) 0, (* offset_y *) textures[ i ].movie_width + 2, textures[ i ].movie_height + 2, GL_RGBA, GL_UNSIGNED_BYTE, frame );
+ glBegin( GL_QUADS );
+ glTexCoord2f( shift, shift );
+ glVertex2i( textures[ i ].col * texture_size, textures[ i ].row * texture_size );
+ glTexCoord2f( shift, shift + ( textures[ i ].movie_height ) / ( texture_size ) );
+ glVertex2i( textures[ i ].col * texture_size, ( textures[ i ].row + 1 ) * texture_size );
+ glTexCoord2f( shift + ( textures[ i ].movie_width ) / ( texture_size ), shift + ( textures[ i ].movie_height ) / ( texture_size ) );
+ glVertex2i( ( textures[ i ].col + 1 ) * texture_size, ( textures[ i ].row + 1 ) * texture_size );
+ glTexCoord2f( shift + ( textures[ i ].movie_width ) / ( texture_size ), shift );
+ glVertex2i( ( textures[ i ].col + 1 ) * texture_size, textures[ i ].row * texture_size );
+ glEnd;
+ end;
+end;
+
+{*
+ * Calculates the next power of 2 given a particular value.
+ * Useful for calculating proper texture sizes for non power-of-2
+ * aligned texures.
+ * Parameters:
+ * seed: Value to begin from
+ * Returns:
+ * Next power of 2 beginning from 'seed'
+ *}
+
+function glmovie_next_power_of_2( seed : GLuint ) : GLuint;
+var
+ i : GLuint;
+begin
+ i := 1;
+ while ( i < seed ) do
+ begin
+ i := i * 2;
+ end;
+
+ result := i;
+end;
+
+(*
+ * Initialize the movie player subsystem with the width and height
+ * of the *movie data* (as opposed to the window).
+ *
+ * Parameters:
+ * width: Width of movie in pixels
+ * height: Height of movie in pixels
+ * result :=s:
+ * GL_NO_ERROR on success
+ * Any of the enumerated GL errors on failure
+ *)
+
+function glmovie_init( Width : GLuint; Height : GLuint ) : GLenum;
+type
+ PGLubyteArray = ^TGLubyteArray;
+ TGLubyteArray = array of GLubyte;
+var
+ (* Initial black texels. *)
+ pixels : TGLubyteArray;
+ (* Absolute offsets from within tiled frame. *)
+ //offset_x: GLuint;
+ //offset_y: GLuint;
+ skip_rows : GLuint;
+ skip_pixels : GLuint;
+ i, j, current : GLuint;
+begin
+ skip_rows := 0;
+ current := 0;
+ (* Save original movie dimensions. *)
+ movie_width := width;
+ movie_height := height;
+ (* Get the power of 2 dimensions. *)
+ tiled_width := glmovie_next_power_of_2( width );
+ tiled_height := glmovie_next_power_of_2( height );
+ while ( ( texture_size > tiled_width ) or ( texture_size > tiled_height ) ) do
+ begin
+ texture_size := texture_size div 2;
+ end;
+ (* Now break it up into quads. *)
+ num_texture_rows := tiled_height div texture_size;
+ num_texture_cols := tiled_width div texture_size;
+ (* Time for fun with data type = record *)
+ glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
+ glEnable( GL_TEXTURE_2D );
+ glEnable( GL_DITHER );
+
+ SetLength( texture_ids, num_texture_rows * num_texture_cols );
+ if ( texture_ids = nil ) then
+ begin
+ result := GL_OUT_OF_MEMORY;
+ exit;
+ end;
+
+ glGenTextures( num_texture_rows * num_texture_cols, @texture_ids[0] );
+ SetLength( textures, num_texture_rows * num_texture_cols );
+
+ if ( textures = nil ) then
+ begin
+ glDeleteTextures( num_texture_rows * num_texture_cols, @texture_ids[0] );
+ SetLength( texture_ids, 0 );
+ result := GL_OUT_OF_MEMORY;
+ exit;
+ end;
+
+ for i := 0 to num_texture_rows - 1 do
+ begin
+ skip_pixels := 0;
+ for j := 0 to num_texture_cols - 1 do
+ begin
+ current := i * num_texture_cols + j;
+ (* Setup texture. *)
+ textures[ current ].id := texture_ids[ current ];
+ textures[ current ].poly_width := texture_size;
+ textures[ current ].poly_height := texture_size;
+ textures[ current ].movie_width := ( movie_width - 2 ) * ( j + 1 ) div num_texture_cols - skip_pixels;
+ textures[ current ].movie_height := ( movie_height - 2 ) * ( i + 1 ) div num_texture_rows - skip_rows;
+ textures[ current ].row := i;
+ textures[ current ].col := j;
+ textures[ current ].skip_pixels := skip_pixels;
+ textures[ current ].skip_rows := skip_rows;
+ skip_pixels := skip_pixels + textures[ current ].movie_width;
+
+ SetLength( pixels, textures[ current ].poly_width * textures[ current ].poly_height * 4 );
+ if ( pixels = nil ) then
+ begin
+ glDeleteTextures( num_texture_rows * num_texture_cols, @texture_ids[0] );
+ SetLength( texture_ids, 0 );
+ SetLength( textures, 0 );
+ result := GL_OUT_OF_MEMORY;
+ exit;
+ end;
+ //FillChar( pixels^, textures[ current ].poly_width * textures[ current ].poly_height * 4, 0 );
+
+ (* Do all of our useful binding. *)
+ glBindTexture( GL_TEXTURE_2D, textures[ current ].id );
+ glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+ (* Specify our 256x256 black texture. *)
+ glTexImage2D( GL_TEXTURE_2D,
+ 0,
+ GL_RGB,
+ textures[ current ].poly_width,
+ textures[ current ].poly_height,
+ 0,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ @pixels[0] );
+ SetLength( pixels, 0 );
+ end;
+ skip_rows := skip_rows + textures[ current ].movie_height;
+ end;
+ (* Simple state setup at the end. *)
+ glClearColor( 0.0, 0.0, 0.0, 0.0 );
+ result := glGetError( );
+end;
+
+//******************* glmpeg_update *************************
+
+procedure glmpeg_update( surface : PSDL_Surface; x : Sint32; y : Sint32; w : Uint32;
+ h : Uint32 ); cdecl;
+var
+ error : GLenum;
+begin
+ glmovie_draw( PGLubyte( surface.pixels ) );
+ error := glGetError( );
+ if ( error <> GL_NO_ERROR ) then
+ begin
+ Log.LogError( Format( 'glmovie: GL error: %s', [ gluErrorString( error ) ] ),
+ 'glmpeg_update' );
+ Exit;
+ end;
+ SDL_GL_SwapBuffers;
+end;
+
+{*
+ * Here we need to center the OpenGL viewport within the
+ * window size that we are given.
+ *
+ * Parameters:
+ * width: Width of the window in pixels
+ * height: Height of the window in pixels
+ *}
+
+procedure glmovie_resize( width : GLuint; height : GLuint );
+begin
+ glViewport( 0, 0, width, height );
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity;
+ gluOrtho2D( 0, tiled_width, tiled_height, 0 );
+end;
+
+{*
+ * Free any resources associated with the movie player.
+ *}
+
+procedure glmovie_quit;
+begin
+ glDeleteTextures( num_texture_rows * num_texture_cols, @texture_ids );
+ SetLength( texture_ids, 0 );
+ SetLength( textures, 0 );
+end;
+
+var
+ mpeg : PSMPEG;
+ mpeg_info : TSMPEG_Info;
+ screen : PSDL_Surface;
+ surface : PSDL_Surface;
+ event : TSDL_Event;
+begin
+ if ( ParamCount < 1 ) then
+ begin
+ Log.LogError( Format( 'Usage: %s file.mpg', [ ParamStr( 0 ) ] ), 'Main' );
+ Exit;
+ end;
+
+ if ( SDL_Init( SDL_INIT_VIDEO or SDL_INIT_AUDIO ) < 0 ) then
+ begin
+ Log.LogError( 'glmovie: I couldn''t initizlize SDL(shrug)', 'Main' );
+ Exit;
+ end;
+
+ mpeg := SMPEG_new( PChar( ParamStr( 1 ) ), @mpeg_info, 1 );
+ if ( mpeg = nil ) then
+ begin
+ Log.LogError( Format( 'glmovie: I''m not so sure about this %s file...',
+ [ ParamStr( 1 ) ] ), 'Main' );
+ SDL_Quit;
+ Exit;
+ end;
+ (* Grab the mouse and input and set the video mode *)
+ SDL_ShowCursor( 0 );
+ SDL_WM_GrabInput( SDL_GRAB_ON );
+
+ SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
+ SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
+ SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
+ SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
+ SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+
+ // Set the title bar in environments that support it
+ SDL_WM_SetCaption('SDL GLMovie Demo using JEDI-SDL', nil
+ );
+
+ screen := SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL { or SDL_FULLSCREEN } );
+ if ( Screen = nil ) then
+ begin
+ Log.LogError( Format( 'glmovie: Couldn''t set 640 x 480 GL video mode : %s',
+ [ SDL_GetError ] ), 'Main' );
+ SDL_Quit;
+ Exit;
+ end;
+
+ (* Everything needs to be in RGB for GL, but needs to be 32-bit for SMPEG. *)
+ surface := SDL_AllocSurface( SDL_SWSURFACE,
+ mpeg_info.width,
+ mpeg_info.height,
+ 32,
+ $000000FF,
+ $0000FF00,
+ $00FF0000,
+ $FF000000 );
+
+ if ( surface = nil ) then
+ begin
+ Log.LogError( 'glmovie: I couldn''t make a surface(boo hoo)', 'Main' );
+ SDL_Quit;
+ Exit;
+ end;
+
+ (* *Initialize* with mpeg size. *)
+ if ( glmovie_init( mpeg_info.width, mpeg_info.height ) <> GL_NO_ERROR ) then
+ begin
+ Log.LogError( 'glmovie: glmovie_init failed ', 'Main' );
+ SDL_Quit;
+ Exit;
+ end;
+
+ (* *Resize* with window size. *)
+ glmovie_resize( screen.w, screen.h );
+ SMPEG_setdisplay( mpeg, surface, nil, @glmpeg_update );
+ SMPEG_play( mpeg );
+
+ while ( SMPEG_status( mpeg ) = STATUS_SMPEG_PLAYING ) do
+ begin
+
+ while ( SDL_PollEvent( @event ) <> 0 ) do
+ begin
+ case ( event.type_ ) of
+ SDL_KEYDOWN :
+ begin
+ if ( event.key.keysym.sym = SDLK_ESCAPE ) then
+ begin
+ SMPEG_stop( mpeg );
+ end;
+ end;
+ SDL_MOUSEBUTTONDOWN, SDL_QUITEV :
+ SMPEG_stop( mpeg );
+ end;
+ SDL_Delay( 100 );
+ end;
+ end;
+
+ glmovie_quit;
+ SDL_Quit;
+end.
+
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Campus.jpg b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Campus.jpg
new file mode 100644
index 00000000..366d7e91
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Campus.jpg
Binary files differ
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/MPEGPlay.dpr b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/MPEGPlay.dpr
new file mode 100644
index 00000000..a0687f4e
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/MPEGPlay.dpr
@@ -0,0 +1,26 @@
+program MPEGPlay;
+
+{$IFDEF VER140}
+{$DEFINE CLX}
+{$ELSE}
+{$DEFINE VCL}
+{$ENDIF}
+
+uses
+
+{$IFDEF CLX}
+ QForms,
+{$ENDIF}
+{$IFDEF VCL}
+ Forms,
+{$ENDIF}
+ Main in 'Main.pas' {Form1};
+
+{$R *.res}
+
+begin
+ Application.Initialize;
+ Application.CreateForm( TForm1, Form1 );
+ Application.Run;
+end.
+
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.dfm b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.dfm
new file mode 100644
index 00000000..f881f626
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.dfm
Binary files differ
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.pas b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.pas
new file mode 100644
index 00000000..5c2bd4f5
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.pas
@@ -0,0 +1,91 @@
+unit Main;
+
+interface
+
+{$IFDEF UNIX}
+{$DEFINE CLX}
+{$ELSE}
+{$DEFINE VCL}
+{$ENDIF}
+
+uses
+ SysUtils,
+ Classes,
+{$IFDEF CLX}
+ Types,
+ QGraphics,
+ QControls,
+ QForms,
+ QDialogs,
+ QExtCtrls,
+ QStdCtrls,
+{$ENDIF}
+{$IFDEF VCL}
+ Forms,
+ Graphics,
+ Dialogs,
+ StdCtrls,
+ Controls,
+ ExtCtrls,
+{$ENDIF}
+ sdlmpegpanel;
+
+type
+ TForm1 = class( TForm )
+ Panel1 : TPanel;
+ Panel2 : TPanel;
+ Button1 : TButton;
+ Button2 : TButton;
+ Button3 : TButton;
+ Panel3 : TPanel;
+ CheckBox1 : TCheckBox;
+ OpenDialog: TOpenDialog;
+ SDLMPEGPanel: TSDLMPEGPanel;
+ procedure Button1Click( Sender : TObject );
+ procedure Button2Click( Sender : TObject );
+ procedure Button3Click( Sender : TObject );
+ private
+ { Private declarations }
+ public
+ { Public declarations }
+ end;
+
+var
+ Form1 : TForm1;
+
+implementation
+
+{$IFDEF WIN32}
+{$R *.dfm}
+{$ENDIF}
+
+{$IFDEF UNIX}
+{$R *.xfm}
+{$ENDIF}
+
+procedure TForm1.Button1Click( Sender : TObject );
+begin
+ with OpenDialog do
+ begin
+ if Execute then
+ begin
+ SDLMPEGPanel.MPEGFile := FileName;
+ SDLMPEGPanel.Sound := CheckBox1.Checked;
+ SDLMPEGPanel.Play;
+ end;
+ end;
+end;
+
+procedure TForm1.Button2Click( Sender : TObject );
+begin
+ SDLMPEGPanel.Pause;
+end;
+
+procedure TForm1.Button3Click( Sender : TObject );
+begin
+ SDLMPEGPanel.Stop;
+end;
+
+end.
+
+ \ No newline at end of file
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.xfm b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.xfm
new file mode 100644
index 00000000..6b581787
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/Main.xfm
@@ -0,0 +1,106 @@
+object Form1: TForm1
+ Left = 377
+ Top = 273
+ Width = 351
+ Height = 308
+ VertScrollBar.Range = 44
+ ActiveControl = Button1
+ AutoScroll = False
+ Caption = 'The Tube'
+ Color = clBackground
+ Font.Color = clText
+ Font.Height = 11
+ Font.Name = 'MS Sans Serif'
+ Font.Pitch = fpVariable
+ Font.Style = []
+ ParentFont = False
+ Position = poScreenCenter
+ PixelsPerInch = 96
+ TextHeight = 18
+ TextWidth = 5
+ object Panel1: TPanel
+ Left = 0
+ Top = 264
+ Width = 351
+ Height = 44
+ Align = alBottom
+ TabOrder = 0
+ object Panel2: TPanel
+ Left = 1
+ Top = 1
+ Width = 282
+ Height = 42
+ Align = alClient
+ BevelOuter = bvNone
+ TabOrder = 0
+ object Button1: TButton
+ Left = 5
+ Top = 21
+ Width = 48
+ Height = 16
+ Caption = 'Play'
+ TabOrder = 0
+ OnClick = Button1Click
+ end
+ object Button2: TButton
+ Left = 57
+ Top = 21
+ Width = 48
+ Height = 16
+ Caption = 'Pause'
+ TabOrder = 1
+ OnClick = Button2Click
+ end
+ object Button3: TButton
+ Left = 109
+ Top = 21
+ Width = 48
+ Height = 16
+ Caption = 'Stop'
+ TabOrder = 2
+ OnClick = Button3Click
+ end
+ object CheckBox1: TCheckBox
+ Left = 5
+ Top = 0
+ Width = 65
+ Height = 20
+ Caption = 'Sound'
+ Checked = True
+ State = cbChecked
+ TabOrder = 3
+ end
+ end
+ object Panel3: TPanel
+ Left = 283
+ Top = 1
+ Width = 67
+ Height = 42
+ Align = alRight
+ Anchors = [akLeft, akTop, akRight, akBottom]
+ BevelOuter = bvNone
+ TabOrder = 1
+ end
+ end
+ object SDLMPEGPanel: TSDLMPEGPanel
+ Left = 0
+ Top = 0
+ Width = 351
+ Height = 264
+ Align = alClient
+ BevelInner = bvRaised
+ BevelOuter = bvLowered
+ Caption = 'You Movie should play here...'
+ TabOrder = 1
+ Sound = False
+ end
+ object OpenDialog: TOpenDialog
+ Filter = 'MPEGs|*.mpeg;*.mpg|All Files|*.*'
+ FilterIndex = 0
+ Height = 0
+ Title = 'Open'
+ Width = 0
+ Left = 40
+ Top = 32
+ end
+end
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/README.1ST b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/README.1ST
new file mode 100644
index 00000000..07e09117
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/README.1ST
@@ -0,0 +1,21 @@
+0. This demo app makes use of SDL Beta 4 from the JEDI group.
+ Their full library is on this companion CD as well.
+
+1. You need to install libSDL-1.2 - www.libsdl.org if it is not already
+ installed on your system
+
+2. You need to install smpeg 0.4.4 - www.lokigames.com if it is not already
+ installed on your system.
+ Once smpeg is installed, navigate to your /usr/lib/ directory via a commandline and
+ create a symbolic link from libsmpeg-0.4.so.0 to libsmpeg.so. This is done
+ with the following command ( assuming you are in /usr/lib/ )...
+ ln -s libsmpeg-0.4.so.0 libsmpeg.so
+
+
+3. Then compile using:
+ dcc video60.dpk - Kylix or D6, video40.dpk - D4, video50 - D5
+ dcc MPEGPlay.dpr
+
+4. Run the app and play some MPEGs.
+
+
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/sdlmpegpanel.pas b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/sdlmpegpanel.pas
new file mode 100644
index 00000000..6e7e87de
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/sdlmpegpanel.pas
@@ -0,0 +1,149 @@
+unit sdlmpegpanel;
+
+interface
+
+{$IFDEF UNIX}
+{$DEFINE CLX}
+{$ELSE}
+{$DEFINE VCL}
+{$ENDIF}
+
+uses
+ SysUtils,
+ Classes,
+{$IFDEF VCL}
+ Graphics,
+ Controls,
+ Forms,
+ Dialogs,
+ ExtCtrls,
+{$ENDIF}
+{$IFDEF CLX}
+ Types,
+ QGraphics,
+ QControls,
+ QForms,
+ QDialogs,
+ QExtCtrls,
+{$ENDIF}
+ sdl,
+ smpeg;
+
+type
+ TSDLMPEGPanel = class( TPanel )
+ private
+ { Private declarations }
+ FSurface : PSDL_Surface;
+ FSMPEGHandle : PSMPEG;
+ FMPEGFile : TFileName;
+ FMPEGInfo : TSMPEG_Info;
+ FPlaying : Boolean;
+ FSound : Integer;
+ function GetSound : Boolean;
+ procedure SetSound( const Value : Boolean );
+ protected
+ { Protected declarations }
+ public
+ { Public declarations }
+ procedure Play;
+ procedure Stop;
+ procedure Pause;
+ published
+ { Published declarations }
+ property MPEGFile : TFileName read FMPEGFile write FMPEGFile;
+ property Sound : Boolean read GetSound write SetSound;
+ end;
+
+procedure Register;
+
+implementation
+
+{$IFDEF CLX}
+uses
+ Libc,
+ Qt;
+{$ENDIF}
+
+procedure TSDLMPEGPanel.Play;
+var
+ EnvVal : string;
+begin
+ if FPlaying then
+ Exit;
+ FPlaying := True;
+
+ if SDL_getenv( 'SDL_WINDOWID' ) = '' then
+ begin
+ {$IFDEF VCL}
+ SDL_putenv( 'SDL_VIDEODRIVER=windib' );
+ EnvVal := 'SDL_WINDOWID=' + inttostr( Integer( Handle ) );
+ {$ENDIF}
+
+ {$IFDEF CLX}
+ EnvVal := 'SDL_WINDOWID=' + inttostr( QWidget_WinId( ChildHandle ) );
+ {$ENDIF}
+
+ SDL_putenv( PChar( EnvVal ) );
+ end;
+
+ if SDL_getenv( 'SDL_VIDEO_YUV_HWACCEL' ) = '' then
+ SDL_putenv( 'SDL_VIDEO_YUV_HWACCEL=0' );
+
+ if SDL_Init( SDL_INIT_VIDEO or SDL_INIT_NOPARACHUTE ) < 0 then
+ raise Exception.Create( 'SDL_Init failed' );
+ {$IFDEF VCL}
+ FSurface := SDL_SetVideoMode( Width, Height, 16, SDL_SWSURFACE );
+ {$ENDIF}
+ {$IFDEF CLX}
+ FSurface := SDL_SetVideoMode( Width, Height, QPixmap_depth( Bitmap.Handle ), SDL_SWSURFACE );
+ {$ENDIF}
+ if FSurface = nil then
+ raise Exception.Create( 'SDL_SetVideoMode failed' );
+
+ FSMPEGHandle := SMPEG_new( PChar( FMPEGFile ), @FMPEGInfo, FSound );
+ if FSMPEGHandle = nil then
+ raise Exception.Create( 'Cannot create MPEG stream' );
+
+ if FSound = 0 then
+ SMPEG_enableaudio( FSMPEGHandle, 0 );
+
+ SMPEG_scaleXY( FSMPEGHandle, Width, Height );
+ SMPEG_setdisplay( FSMPEGHandle, FSurface, nil, nil );
+
+ SMPEG_play( FSMPEGHandle );
+end;
+
+procedure TSDLMPEGPanel.Stop;
+begin
+ if not FPlaying then
+ Exit;
+ FPlaying := False;
+ SMPEG_stop( FSMPEGHandle );
+ SMPEG_delete( FSMPEGHandle );
+ SDL_Quit;
+end;
+
+procedure TSDLMPEGPanel.Pause;
+begin
+ if FPlaying then
+ SMPEG_pause( FSMPEGHandle );
+end;
+
+function TSDLMPEGPanel.GetSound : Boolean;
+begin
+ Result := Boolean( FSound );
+end;
+
+procedure TSDLMPEGPanel.SetSound( const Value : Boolean );
+begin
+ FSound := Integer( Value );
+end;
+
+procedure Register;
+begin
+ RegisterComponents( 'SDL', [ TSDLMPEGPanel ] );
+end;
+
+end.
+
+
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video40.dpk b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video40.dpk
new file mode 100644
index 00000000..5af28450
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video40.dpk
@@ -0,0 +1,33 @@
+package video40;
+
+{$R *.RES}
+{$ALIGN ON}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION ON}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES OFF}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $00400000}
+{$IMPLICITBUILD OFF}
+
+requires
+ Vcl40;
+
+contains
+ SDLMPEGPanel in 'SDLMPEGPanel.pas';
+
+end.
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video50.dpk b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video50.dpk
new file mode 100644
index 00000000..9c5612e4
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video50.dpk
@@ -0,0 +1,33 @@
+package video50;
+
+{$R *.RES}
+{$ALIGN ON}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION ON}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES OFF}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$IMPLICITBUILD OFF}
+
+requires
+ Vcl50;
+
+contains
+ SDLMPEGPanel in 'SDLMPEGPanel.pas';
+
+end.
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video60.dpk b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video60.dpk
new file mode 100644
index 00000000..9af38841
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/MpegPlayer/video60.dpk
@@ -0,0 +1,35 @@
+package video60;
+
+{$R *.res}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION ON}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES OFF}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$IMPLICITBUILD OFF}
+requires
+ rtl,
+ visualclx;
+
+contains
+ SDLMPEGPanel in 'SDLMPEGPanel.pas';
+
+
+
+end. \ No newline at end of file
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.cfg b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.cfg
new file mode 100644
index 00000000..9d13f677
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.cfg
@@ -0,0 +1,38 @@
+-$A8
+-$B-
+-$C+
+-$D+
+-$E-
+-$F-
+-$G+
+-$H+
+-$I+
+-$J-
+-$K-
+-$L+
+-$M-
+-$N+
+-$O+
+-$P+
+-$Q-
+-$R-
+-$S-
+-$T-
+-$U-
+-$V+
+-$W-
+-$X+
+-$YD
+-$Z1
+-cg
+-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+-H+
+-W+
+-M
+-$M16384,1048576
+-K$00400000
+-LE"c:\program files\borland\delphi7\Projects\Bpl"
+-LN"c:\program files\borland\delphi7\Projects\Bpl"
+-w-UNSAFE_TYPE
+-w-UNSAFE_CODE
+-w-UNSAFE_CAST
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dof b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dof
new file mode 100644
index 00000000..96b3fada
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dof
@@ -0,0 +1,136 @@
+[FileVersion]
+Version=7.0
+[Compiler]
+A=8
+B=0
+C=1
+D=1
+E=0
+F=0
+G=1
+H=1
+I=1
+J=0
+K=0
+L=1
+M=0
+N=1
+O=1
+P=1
+Q=0
+R=0
+S=0
+T=0
+U=0
+V=1
+W=0
+X=1
+Y=1
+Z=1
+ShowHints=1
+ShowWarnings=1
+UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+NamespacePrefix=
+SymbolDeprecated=1
+SymbolLibrary=1
+SymbolPlatform=1
+UnitLibrary=1
+UnitPlatform=1
+UnitDeprecated=1
+HResultCompat=1
+HidingMember=1
+HiddenVirtual=1
+Garbage=1
+BoundsError=1
+ZeroNilCompat=1
+StringConstTruncated=1
+ForLoopVarVarPar=1
+TypedConstVarPar=1
+AsgToTypedConst=1
+CaseLabelRange=1
+ForVariable=1
+ConstructingAbstract=1
+ComparisonFalse=1
+ComparisonTrue=1
+ComparingSignedUnsigned=1
+CombiningSignedUnsigned=1
+UnsupportedConstruct=1
+FileOpen=1
+FileOpenUnitSrc=1
+BadGlobalSymbol=1
+DuplicateConstructorDestructor=1
+InvalidDirective=1
+PackageNoLink=1
+PackageThreadVar=1
+ImplicitImport=1
+HPPEMITIgnored=1
+NoRetVal=1
+UseBeforeDef=1
+ForLoopVarUndef=1
+UnitNameMismatch=1
+NoCFGFileFound=1
+MessageDirective=1
+ImplicitVariants=1
+UnicodeToLocale=1
+LocaleToUnicode=1
+ImagebaseMultiple=1
+SuspiciousTypecast=1
+PrivatePropAccessor=1
+UnsafeType=0
+UnsafeCode=0
+UnsafeCast=0
+[Linker]
+MapFile=0
+OutputObjs=0
+ConsoleApp=1
+DebugInfo=0
+RemoteSymbols=0
+MinStackSize=16384
+MaxStackSize=1048576
+ImageBase=4194304
+ExeDescription=
+[Directories]
+OutputDir=
+UnitOutputDir=
+PackageDLLOutputDir=
+PackageDCPOutputDir=
+SearchPath=
+Packages=
+Conditionals=
+DebugSourceDirs=
+UsePackages=0
+[Parameters]
+RunParams=
+HostApplication=
+Launcher=
+UseLauncher=0
+DebugCWD=
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=2057
+CodePage=1252
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
diff --git a/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dpr b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dpr
new file mode 100644
index 00000000..c88c0eb6
--- /dev/null
+++ b/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer/SMpegPlayer.dpr
@@ -0,0 +1,278 @@
+program SMpegPlayer;
+{******************************************************************}
+{ }
+{ Object Pascal Example of using smpeg and SDL_Mixer }
+{ Conversion of Console Smpeg player }
+{ }
+{ }
+{ The original files are : Found on internet }
+{ }
+{ The original Pascal code is : SMpegPlayer.dpr }
+{ The initial developer of the Pascal code is : }
+{ Dominique Louis <Dominique@SavageSoftware.com.au> }
+{ }
+{ Portions created by Dominique Louis are }
+{ Copyright (C) 2001 Dominique Louis. }
+{ }
+{ Contributor(s) }
+{ -------------- }
+{ }
+{ }
+{ Obtained through: }
+{ Joint Endeavour of Delphi Innovators ( Project JEDI ) }
+{ }
+{ You may retrieve the latest version of this file at the Project }
+{ JEDI home page, located at http://delphi-jedi.org }
+{ }
+{ The contents of this file are used with permission, subject to }
+{ the Mozilla Public License Version 1.1 (the "License"); you may }
+{ not use this file except in compliance with the License. You may }
+{ obtain a copy of the License at }
+{ http://www.mozilla.org/NPL/NPL-1_1Final.html }
+{ }
+{ Software distributed under the License is distributed on an }
+{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
+{ implied. See the License for the specific language governing }
+{ rights and limitations under the License. }
+{ }
+{ Description }
+{ ----------- }
+{ SMpegPlayer : Shows how to load and play an Mpeg file using }
+{ smpeg and SDL_Mixer for the sound }
+{ }
+{ Requires }
+{ -------- }
+{ SDL runtime libary for SDL, smpeg and OpenGL somewhere }
+{ in your path . }
+{ The Latest SDL runtimes can be found on http://www.libsdl.org }
+{ }
+{ Programming Notes }
+{ ----------------- }
+{ This demo shows how to load and play an mpeg file using smpeg }
+{ with SDL_Mixer }
+{ You will need Smpeg and SDL_Mixer libraris order for this demo }
+{ }
+{ Revision History }
+{ ---------------- }
+{ July 02 2001 - DL : Initial translation. }
+{ }
+{ November 23 2002 - DL : Fix PollMPeg as suggested by }
+{ }
+{ }
+{******************************************************************}
+
+uses
+ SysUtils,
+ sdl,
+ sdl_mixer,
+ smpeg;
+
+const
+ SCREEN_WIDTH = 800;
+ SCREEN_HEIGHT = 600;
+ BPP = 0;
+
+ TITLE = 'JEDI-SDL Console MpegPlayer';
+
+var
+ // Screen Surface
+ screen : PSDL_Surface;
+
+ // Audio Specs
+ aspec : TSDL_AudioSpec;
+ format : Uint16;
+ freq, chan : integer;
+ Islooping : Boolean;
+
+function OpenMpeg( FileName : string ) : PSMPEG;
+var
+ Handle : PSMPEG;
+begin
+ // Create a new Mpeg
+ handle := SMPEG_new( PChar( fileName ), nil, 0 );
+ if handle = nil then
+ begin
+ //Display Error
+ Halt;
+ end;
+
+ // Disable Audio
+ SMPEG_enableaudio( handle, 0 );
+
+ // Query Mixer
+ Mix_QuerySpec( freq, format, chan );
+ aspec.freq := freq;
+ aspec.format := format;
+ aspec.channels := chan;
+
+ // Tell Smpeg what we want
+ Smpeg_actualSpec( handle, @aspec );
+
+ // Hook the mixer audio playing function
+ Mix_HookMusic( @SMPeg_PlayAudioSDL, handle );
+
+ // Reenable Audio
+ SMPEG_enableaudio( handle, 1 );
+
+ // Set Max Volume
+ SMPEG_setvolume( handle, 100 );
+
+ //Set up a video surface to display MPeg in
+ SMPEG_setdisplay( Handle, Screen, nil, nil );
+
+ // Reenable Video
+ SMPEG_enablevideo( handle, 1 );
+
+ // Retuen the handle in case we need it somewhere else
+ Result := handle;
+end;
+
+// Free Mpeg
+
+procedure FreeMPeg( handle : PSMPEG );
+begin
+ SMPEG_delete( handle );
+end;
+
+// Loop Mpeg
+
+procedure LoopMpeg( handle : PSMPEG );
+begin
+ if IsLooping then
+ begin
+ SMPEG_loop( handle, 1 );
+ isLooping := true;
+ end
+ else
+ begin
+ SMPEG_loop( handle, 0 );
+ isLooping := false;
+ end;
+end;
+
+// Play Mpeg
+
+procedure PlayMpeg( handle : PSMPEG );
+begin
+ SMpeg_play( handle );
+end;
+
+// Stop Mpeg
+
+procedure StopMpeg( handle : PSMPEG );
+begin
+ SMpeg_stop( handle );
+end;
+
+function PollMPeg( handle : PSMPEG ) : TSMpegStatus;
+begin
+ Result := SMPEG_status( handle );
+end;
+
+function WaitMpeg( interval : Uint32; param : pointer ) : Uint32;
+var
+ e : TSDL_Event;
+ handle : PSMPEG;
+begin
+ handle := PSMPEG( param );
+
+ // Has it stopped? If so, throw a User Event
+ if PollMPeg( handle ) = STATUS_SMPEG_STOPPED then
+ begin
+ e.type_ := SDL_USEREVENT;
+ e.user.code := 1;
+ e.user.data1 := nil;
+ e.user.data2 := nil;
+ SDL_PushEvent( @e );
+ end;
+
+ result := interval;
+end;
+
+procedure RunIntro( fileName : string );
+var
+ e : TSDL_Event;
+ handle : PSMPEG;
+ td : PSDL_TimerID;
+ done : Boolean;
+begin
+ done := false;
+ // Create a Movie
+ handle := OpenMpeg( fileName );
+
+ // Play the Movie
+ PlayMPeg( Handle );
+
+ // Create a timer to see if the Movie has stopped
+ td := SDL_AddTimer( 1000, @WaitMPeg, handle );
+
+ // wait for Movie to finish
+ while not done do
+ begin
+ // wiat for out event to happen
+ SDL_WaitEvent( @e );
+ case e.type_ of
+ // Check to see if user want to skip the movie
+ SDL_KEYDOWN :
+ begin
+ if e.key.keysym.sym = SDLK_ESCAPE then
+ Done := true;
+ end;
+
+ SDL_USEREVENT :
+ begin
+ if PollMpeg( handle ) = STATUS_SMPEG_STOPPED then
+ Done := true;
+ end
+
+ end;
+ end;
+
+ // Stop the movie
+ StopMpeg( handle );
+
+ // Remove WaitMpegTimer
+ SDL_RemoveTimer( td );
+
+ // Unhook mixer audio playback function
+ Mix_HookMusic( nil, nil );
+
+ // Free out MPEG
+ FreeMPeg( handle );
+end;
+
+begin
+ // Make sure we at least have a parameter
+ if ParamCount <> 1 then
+ begin
+ Halt( 1 );
+ end;
+
+ // Initialize SDL
+ if SDL_Init( SDL_INIT_VIDEO or SDL_INIT_AUDIO or SDL_INIT_TIMER ) < 0 then
+ begin
+ // Display and error
+ Halt( 1 );
+ end;
+
+ // Open the Mixer before SDL_SetVideo to avoid the poping sound
+ Mix_OpenAudio( 22050, AUDIO_S16, 2, 1024 );
+
+ SDL_WM_SetCaption( TITLE, nil );
+
+ // Set the video Mode
+ screen := SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, BPP, SDL_DOUBLEBUF or
+ SDL_ANYFORMAT );
+ if screen = nil then
+ begin
+ // Display and error
+ Halt( 1 );
+ end;
+
+ RunIntro( ParamStr( 1 ) );
+
+ Mix_CloseAudio;
+
+ SDL_Quit;
+end.
+