|
|
Line 1: |
Line 1: |
| =Playing Videos=
| | {{Multimedia Programming}} |
| | |
| ==Starting a player application==
| |
| | |
| Once you know the command line and parameters you can use TProcessUTF8 to start the player:
| |
| | |
| <syntaxhighlight>
| |
| uses
| |
| Classes, ..., LCLProc, UTF8Process;
| |
| | |
| ...
| |
| | |
| implementation
| |
| | |
| procedure TMainForm.Button1Click(Sender: TObject);
| |
| var
| |
| Player: TProcessUTF8;
| |
| begin
| |
| Player:=TProcessUTF8.Create(nil);
| |
| try
| |
| Player.CommandLine:=PathToPlayer+' '+ParametersAndMediaFile;
| |
| Player.Execute;
| |
| finally
| |
| Player.Free;
| |
| end;
| |
| end;
| |
| </syntaxhighlight>
| |
| | |
| For example to start under Linux the mplayer to play a video use:
| |
| | |
| <syntaxhighlight>
| |
| uses
| |
| Classes, ..., FileUtil, LCLProc, UTF8Process;
| |
| | |
| ...
| |
| | |
| implementation
| |
| | |
| procedure TMainForm.Button1Click(Sender: TObject);
| |
| var
| |
| Player: TProcessUTF8;
| |
| Filename: String;
| |
| PlayerPath: String;
| |
| PlayerParams: String;
| |
| begin
| |
| Filename:='/home/username/video.mpg';
| |
| PlayerPath:=FindDefaultExecutablePath('mplayer');
| |
| PlayerParams:='"'+Filename+'"';
| |
| Player:=TProcessUTF8.Create(nil);
| |
| try
| |
| Player.CommandLine:=PlayerPath+' '+PlayerParams;
| |
| Player.Execute;
| |
| finally
| |
| Player.Free;
| |
| end;
| |
| end;
| |
| </syntaxhighlight>
| |
| | |
| ==VFW - Video for Windows==
| |
| | |
| Capturing and playing video streams from TV cards and webcams under Windows the [[Glossary#VFW|
| |
| | |
| VFW]] [[Glossary#API|API]] can be used with [[SysRec]].
| |
| | |
| ==MPlayer for Linux gtk2/X==
| |
| | |
| '''mplayer''' is an open source and free movie player. There is a LCL control embedding the
| |
| | |
| mplayer, so you can built your own movie players or just play a video in your application. You
| |
| | |
| can download it here:
| |
| <pre>
| |
| svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/mplayer mplayer
| |
| </pre>
| |
| | |
| =Playing Sounds=
| |
| | |
| ==Windows only: using the Windows API==
| |
| You can use the Windows API to play e.g. wav files:
| |
| <syntaxhighlight>
| |
| ...
| |
| uses MMSystem;
| |
| ...
| |
| sndPlaySound('C:\sounds\test.wav', snd_Async or snd_NoDefault);
| |
| </syntaxhighlight>
| |
| Obviously, this is not cross-platform
| |
| | |
| ==Using the Audio Component Suite==
| |
| | |
| Read the page about the [[ACS|Audio Component Suite]]
| |
| | |
| ==Using the OpenAL Library==
| |
| | |
| A tutorial for Delphi can be found here: [http://www.noeska.com/doal/tutorials.aspx]
| |
| | |
| Free Pascal comes with a unit for accessing OpenAL located in fpc/packages/openal as well as
| |
| | |
| [http://svn.freepascal.org/svn/fpc/trunk/packages/openal/examples usage examples]
| |
| | |
| ==BASS==
| |
| | |
| The BASS library can be downloaded from: http://www.un4seen.com/ and
| |
| | |
| http://www.un4seen.com/forum/?topic=8682.0
| |
| | |
| There is a DJ application, for Windows, Linux and Mac OSX, written with Lazarus and using Bass
| |
| | |
| lib:
| |
| https://sites.google.com/site/fiensprototyping/
| |
| | |
| ==Audiere Library==
| |
| | |
| Has bindings for Delphi, but they don't work with FPC:
| |
| | |
| * http://www.casteng.com/whypascal.shtml
| |
| * http://www.afterwarp.net/resources/soundlib
| |
| * http://code.google.com/p/audiere-bind-delphi/
| |
| | |
| ==Audorra Library==
| |
| | |
| Works fine with Lazarus:
| |
| | |
| http://sourceforge.net/projects/audorra/
| |
| | |
| ==OMEGA Engine==
| |
| | |
| The OMEGA Engine is a full game engine in single Omega.dll file which is just 50kb. It can
| |
| | |
| successfully play FLAC,OGG,MP3,MP2,AMR and WMA files. It searches and uses installed audio
| |
| | |
| codecs from the system.
| |
| | |
| http://sourceforge.net/projects/omega-engine/files/
| |
| | |
| The project is dead, but is very easy to use:
| |
| | |
| <syntaxhighlight>
| |
| Media_Play('Music.mp3', TRUE);
| |
| </syntaxhighlight>
| |
| | |
| ==PortAudio==
| |
| Various bindings for [http://www.portaudio.com/ PortAudio], a cross-platform, open source
| |
| | |
| library for audio playback and recording are available.
| |
| See [[http://wiki.lazarus.freepascal.org/Multimedia_Programming#Playing_Sounds]] for some
| |
| | |
| versions.
| |
| Forum user FredvS has written a Pascal unit that dynamically loads PortAudio:
| |
| | |
| [http://lazarus.freepascal.org/index.php/topic,17521.0.html]
| |
| | |
| ==SDL + SDL_mixer==
| |
| | |
| The basic SDL library comes with a very simple sound system. On top of that, SDL mixer adds more
| |
| | |
| sound APIs which build a more flexible solution.
| |
| | |
| ==FMOD==
| |
| | |
| Is a closed source solution. It is free for use for non-comercial software, but requires the
| |
| | |
| payment of licenses for commercial software.
| |
| | |
| ==Squall sound==
| |
| | |
| Squall sound works fine with FPC. It has 3D audio and EAX effects, but just supports MP3, OGG
| |
| | |
| and WAV formats.
| |
| | |
| http://www.afterwarp.net/resources/soundlib
| |
| | |
| ==FPSound==
| |
| | |
| FPSound is a new library being developed on the molds of fpspreadsheet and fpvectorial: it has
| |
| | |
| independent modules to read, write and play sound files and also an intermediary representation
| |
| | |
| for editing. See [[FPSound]]
| |
| | |
| =See also=
| |
| | |
| * [[Audio libraries]]
| |
| | |
| [[Category:Tutorials]]
| |