mplayer: moved example to Simple Use

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3217 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
mgaertner
2014-06-22 16:07:37 +00:00
parent cbd2faeb54
commit 3577a57ef9
6 changed files with 254 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="MPlayerControlLaz"/>
<DefaultFilename Value="../../mplayercontrollaz.lpk"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</CONFIG>

View File

@ -0,0 +1,21 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

View File

@ -0,0 +1,85 @@
object Form1: TForm1
Left = 290
Height = 390
Top = 189
Width = 583
ActiveControl = Panel1
Caption = 'Form1'
ClientHeight = 390
ClientWidth = 583
OnCreate = FormCreate
LCLVersion = '1.2.4.0'
object MPlayerControl1: TMPlayerControl
Left = 6
Height = 334
Top = 27
Width = 571
Align = alClient
BorderSpacing.Around = 6
Loop = 0
Volume = 0
end
object Panel1: TPanel
Left = 0
Height = 21
Top = 0
Width = 583
Align = alTop
AutoSize = True
ClientHeight = 21
ClientWidth = 583
TabOrder = 1
object PlaySpeedButton: TSpeedButton
Left = 1
Height = 19
Top = 1
Width = 26
Align = alLeft
AutoSize = True
Caption = 'Play'
OnClick = PlaySpeedButtonClick
end
object PauseSpeedButton: TSpeedButton
Left = 27
Height = 19
Top = 1
Width = 35
Align = alLeft
AutoSize = True
Caption = 'Pause'
OnClick = PauseSpeedButtonClick
end
object StopSpeedButton: TSpeedButton
Left = 62
Height = 19
Top = 1
Width = 28
Align = alLeft
AutoSize = True
Caption = 'Stop'
OnClick = StopSpeedButtonClick
end
object OpenSpeedButton: TSpeedButton
Left = 90
Height = 19
Top = 1
Width = 52
Align = alLeft
AutoSize = True
Caption = 'Open file'
OnClick = OpenSpeedButtonClick
end
end
object StatusBar1: TStatusBar
Left = 0
Height = 23
Top = 367
Width = 583
Panels = <>
end
object OpenDialog1: TOpenDialog
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
left = 235
top = 127
end
end

View File

@ -0,0 +1,89 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
Buttons, ComCtrls, ExtCtrls, MPlayerCtrl;
type
{ TForm1 }
TForm1 = class(TForm)
MPlayerControl1: TMPlayerControl;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
PlaySpeedButton: TSpeedButton;
PauseSpeedButton: TSpeedButton;
OpenSpeedButton: TSpeedButton;
StatusBar1: TStatusBar;
StopSpeedButton: TSpeedButton;
procedure FormCreate(Sender: TObject);
procedure OpenSpeedButtonClick(Sender: TObject);
procedure PauseSpeedButtonClick(Sender: TObject);
procedure PlaySpeedButtonClick(Sender: TObject);
procedure StopSpeedButtonClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.PlaySpeedButtonClick(Sender: TObject);
begin
if not FileExistsUTF8(MPlayerControl1.Filename) then begin
MessageDlg('File not found',
'Please choose a file before playing',mtError,[mbCancel],0);
exit;
end;
MPlayerControl1.Play;
end;
procedure TForm1.StopSpeedButtonClick(Sender: TObject);
begin
MPlayerControl1.Stop;
end;
procedure TForm1.PauseSpeedButtonClick(Sender: TObject);
begin
MPlayerControl1.Paused:=not MPlayerControl1.Paused;
end;
procedure TForm1.OpenSpeedButtonClick(Sender: TObject);
begin
if not OpenDialog1.Execute then exit;
MPlayerControl1.Stop;
MPlayerControl1.Filename:=OpenDialog1.FileName;
StatusBar1.SimpleText:=CleanAndExpandFilename(MPlayerControl1.Filename);
MPlayerControl1.Play;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if Paramcount>0 then begin
MPlayerControl1.Filename:=CleanAndExpandFilename(ParamStrUTF8(1));
StatusBar1.SimpleText:=MPlayerControl1.Filename;
end;
{$IFDEF Linux}
MPlayerControl1.MPlayerPath:='';
MPlayerControl1.StartParam:='-vo x11 -zoom -fs';
{$else $IFDEF Windows}
// Download MPlayer generic for Windows and save under Programm Folder Directory
// http://sourceforge.net/projects/mplayer-win32/
MPlayerControl1.MPlayerPath:=extractfilepath(application.exename)+'MPlayer\mplayer.exe' ;
//MPlayerControl1.StartParam:='-zoom -fs';
{$endif}
end;
end.