aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/lib/JEDI-SDLv1.0/smpeg/Demos/SMpegPlayer')
-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
3 files changed, 452 insertions, 0 deletions
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.
+