You've already forked lazarus-ccr
added mplayer containing mplayercontrollaz.lpk
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@940 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
22
components/mplayer/README.txt
Normal file
22
components/mplayer/README.txt
Normal file
@ -0,0 +1,22 @@
|
||||
Package mplayercontrollaz.lpk
|
||||
|
||||
TMPlayerControl is a LCL control that embeds "mplayer" a movie player.
|
||||
|
||||
Requirements:
|
||||
Only works under X/gtk2.
|
||||
mplayer must be installed and in the PATH.
|
||||
|
||||
Usage:
|
||||
When you install the package you get a new component in the palette under
|
||||
Multimedia.
|
||||
|
||||
See the example mplayer/examples/project1.lpi.
|
||||
|
||||
Hints:
|
||||
TMPlayerControl only implemented a very small set of the mplayer features:
|
||||
Play, Stop, Pause, Loop, Volume.
|
||||
You can use SendMPlayerCommand to send arbitrary other commands. The complete
|
||||
list of mplayer commands execute in terminal:
|
||||
mplayer -input cmdlist
|
||||
and read http://www.mplayerhq.hu/DOCS/tech/slave.txt
|
||||
|
BIN
components/mplayer/examples/project1.ico
Normal file
BIN
components/mplayer/examples/project1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
278
components/mplayer/examples/project1.lpi
Normal file
278
components/mplayer/examples/project1.lpi
Normal file
@ -0,0 +1,278 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="7"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Icon Value="0"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="MPlayerControlLaz"/>
|
||||
<MinVersion Valid="True"/>
|
||||
<DefaultFilename Value="../mplayercontrollaz.lpk"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="11">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<UsageCount Value="22"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<CursorPos X="17" Y="29"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../mplayerctrl.pas"/>
|
||||
<UnitName Value="MPlayerCtrl"/>
|
||||
<CursorPos X="126" Y="71"/>
|
||||
<TopLine Value="35"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../mplayerctrl.lrs"/>
|
||||
<CursorPos X="30" Y="12"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../../../../wichtig/lazarus/ideintf/componentreg.pas"/>
|
||||
<UnitName Value="ComponentReg"/>
|
||||
<CursorPos X="1" Y="685"/>
|
||||
<TopLine Value="647"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="../../../../wichtig/lazarus/designer/designer.pp"/>
|
||||
<UnitName Value="Designer"/>
|
||||
<CursorPos X="37" Y="2518"/>
|
||||
<TopLine Value="2497"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../../../../wichtig/lazarus/designer/designerprocs.pas"/>
|
||||
<UnitName Value="DesignerProcs"/>
|
||||
<CursorPos X="53" Y="82"/>
|
||||
<TopLine Value="65"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="../../../../wichtig/lazarus/ideintf/formeditingintf.pas"/>
|
||||
<UnitName Value="FormEditingIntf"/>
|
||||
<CursorPos X="43" Y="27"/>
|
||||
<TopLine Value="9"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../../../../wichtig/lazarus/components/opengl/openglcontext.pas"/>
|
||||
<UnitName Value="OpenGLContext"/>
|
||||
<CursorPos X="1" Y="450"/>
|
||||
<TopLine Value="427"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="../../../../fpc_sources/22/fpc/rtl/objpas/sysutils/filutilh.inc"/>
|
||||
<CursorPos X="19" Y="77"/>
|
||||
<TopLine Value="58"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="../README.txt"/>
|
||||
<CursorPos X="12" Y="11"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
<SyntaxHighlighter Value="None"/>
|
||||
</Unit10>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="17" Column="33" TopLine="1"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="18" Column="33" TopLine="1"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="17" Column="32" TopLine="1"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="16" Column="38" TopLine="1"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="17" Column="25" TopLine="1"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="18" Column="31" TopLine="1"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="19" Column="31" TopLine="1"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="20" Column="19" TopLine="1"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="19" Column="34" TopLine="1"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="18" Column="33" TopLine="1"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="17" Column="24" TopLine="1"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="16" Column="38" TopLine="1"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="17" Column="21" TopLine="1"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="18" Column="33" TopLine="1"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="19" Column="33" TopLine="1"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="20" Column="28" TopLine="1"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="23" Column="54" TopLine="1"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="39" Column="17" TopLine="8"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="9" Column="1" TopLine="1"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="24" Column="5" TopLine="9"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="54" TopLine="17"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="24" Column="5" TopLine="23"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="60" Column="3" TopLine="29"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="47" Column="10" TopLine="28"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="5" TopLine="25"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="68" Column="43" TopLine="37"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="66" Column="31" TopLine="38"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="63" Column="22" TopLine="41"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../mplayerctrl.pas"/>
|
||||
<Caret Line="63" Column="23" TopLine="25"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="66" Column="23" TopLine="41"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="8"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)/"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
components/mplayer/examples/project1.lpr
Normal file
21
components/mplayer/examples/project1.lpr
Normal 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, MPlayerControlLaz, LResources
|
||||
{ you can add units after this };
|
||||
|
||||
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
||||
|
||||
begin
|
||||
{$I project1.lrs}
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
5237
components/mplayer/examples/project1.lrs
Normal file
5237
components/mplayer/examples/project1.lrs
Normal file
File diff suppressed because it is too large
Load Diff
17
components/mplayer/examples/project1.manifest
Normal file
17
components/mplayer/examples/project1.manifest
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="CompanyName.ProductName.YourApp" type="win32"/>
|
||||
<description>Your application description here.</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
7
components/mplayer/examples/project1.rc
Normal file
7
components/mplayer/examples/project1.rc
Normal file
@ -0,0 +1,7 @@
|
||||
#define RT_MANIFEST 24
|
||||
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
|
||||
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
|
||||
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
|
||||
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "project1.manifest"
|
||||
MAINICON ICON "project1.ico"
|
93
components/mplayer/examples/unit1.lfm
Normal file
93
components/mplayer/examples/unit1.lfm
Normal file
@ -0,0 +1,93 @@
|
||||
object Form1: TForm1
|
||||
Left = 290
|
||||
Height = 390
|
||||
Top = 189
|
||||
Width = 583
|
||||
ActiveControl = Panel1
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 390
|
||||
ClientWidth = 583
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '0.9.29'
|
||||
object MPlayerControl1: TMPlayerControl
|
||||
Left = 6
|
||||
Height = 333
|
||||
Top = 30
|
||||
Width = 571
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
Loop = 0
|
||||
Volume = 0
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 24
|
||||
Top = 0
|
||||
Width = 583
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
ClientHeight = 24
|
||||
ClientWidth = 583
|
||||
TabOrder = 1
|
||||
object PlaySpeedButton: TSpeedButton
|
||||
Left = 1
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 63
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Play'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = PlaySpeedButtonClick
|
||||
end
|
||||
object PauseSpeedButton: TSpeedButton
|
||||
Left = 64
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 63
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Pause'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = PauseSpeedButtonClick
|
||||
end
|
||||
object StopSpeedButton: TSpeedButton
|
||||
Left = 127
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 63
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Stop'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = StopSpeedButtonClick
|
||||
end
|
||||
object OpenSpeedButton: TSpeedButton
|
||||
Left = 190
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 160
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Open file'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = OpenSpeedButtonClick
|
||||
end
|
||||
end
|
||||
object StatusBar1: TStatusBar
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 369
|
||||
Width = 583
|
||||
Panels = <>
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
||||
left = 235
|
||||
top = 127
|
||||
end
|
||||
end
|
28
components/mplayer/examples/unit1.lrs
Normal file
28
components/mplayer/examples/unit1.lrs
Normal file
@ -0,0 +1,28 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'"'#1#6'Height'#3#134#1#3'Top'#3#189#0#5'W'
|
||||
+'idth'#3'G'#2#13'ActiveControl'#7#6'Panel1'#7'Caption'#6#5'Form1'#12'ClientH'
|
||||
+'eight'#3#134#1#11'ClientWidth'#3'G'#2#8'OnCreate'#7#10'FormCreate'#10'LCLVe'
|
||||
+'rsion'#6#6'0.9.29'#0#15'TMPlayerControl'#15'MPlayerControl1'#4'Left'#2#6#6
|
||||
+'Height'#3'M'#1#3'Top'#2#30#5'Width'#3';'#2#5'Align'#7#8'alClient'#20'Border'
|
||||
+'Spacing.Around'#2#6#4'Loop'#2#0#6'Volume'#2#0#0#0#6'TPanel'#6'Panel1'#4'Lef'
|
||||
+'t'#2#0#6'Height'#2#24#3'Top'#2#0#5'Width'#3'G'#2#5'Align'#7#5'alTop'#8'Auto'
|
||||
+'Size'#9#12'ClientHeight'#2#24#11'ClientWidth'#3'G'#2#8'TabOrder'#2#1#0#12'T'
|
||||
+'SpeedButton'#15'PlaySpeedButton'#4'Left'#2#1#6'Height'#2#22#3'Top'#2#1#5'Wi'
|
||||
+'dth'#2'?'#5'Align'#7#6'alLeft'#8'AutoSize'#9#7'Caption'#6#4'Play'#5'Color'#7
|
||||
+#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#20'PlaySpeedButtonClick'#0#0#12
|
||||
+'TSpeedButton'#16'PauseSpeedButton'#4'Left'#2'@'#6'Height'#2#22#3'Top'#2#1#5
|
||||
+'Width'#2'?'#5'Align'#7#6'alLeft'#8'AutoSize'#9#7'Caption'#6#5'Pause'#5'Colo'
|
||||
+'r'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#21'PauseSpeedButtonClick'#0
|
||||
+#0#12'TSpeedButton'#15'StopSpeedButton'#4'Left'#2#127#6'Height'#2#22#3'Top'#2
|
||||
+#1#5'Width'#2'?'#5'Align'#7#6'alLeft'#8'AutoSize'#9#7'Caption'#6#4'Stop'#5'C'
|
||||
+'olor'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#20'StopSpeedButtonClick'
|
||||
+#0#0#12'TSpeedButton'#15'OpenSpeedButton'#4'Left'#3#190#0#6'Height'#2#22#3'T'
|
||||
+'op'#2#1#5'Width'#3#160#0#5'Align'#7#6'alLeft'#8'AutoSize'#9#7'Caption'#6#9
|
||||
+'Open file'#5'Color'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#20'OpenSpe'
|
||||
+'edButtonClick'#0#0#0#10'TStatusBar'#10'StatusBar1'#4'Left'#2#0#6'Height'#2
|
||||
+#21#3'Top'#3'q'#1#5'Width'#3'G'#2#6'Panels'#14#0#0#0#11'TOpenDialog'#11'Open'
|
||||
+'Dialog1'#7'Options'#11#15'ofFileMustExist'#14'ofEnableSizing'#12'ofViewDeta'
|
||||
+'il'#0#4'left'#3#235#0#3'top'#2#127#0#0#0
|
||||
]);
|
81
components/mplayer/examples/unit1.pas
Normal file
81
components/mplayer/examples/unit1.pas
Normal file
@ -0,0 +1,81 @@
|
||||
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
|
||||
|
||||
{ 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;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I unit1.lrs}
|
||||
|
||||
end.
|
||||
|
51
components/mplayer/mplayercontrollaz.lpk
Normal file
51
components/mplayer/mplayercontrollaz.lpk
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<Package Version="3">
|
||||
<Name Value="MPlayerControlLaz"/>
|
||||
<Author Value="Mattias Gaertner"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="8"/>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Description Value="LCL control for embedding mplayer"/>
|
||||
<License Value="modified LGPL2"/>
|
||||
<Version Minor="1" Release="1"/>
|
||||
<Files Count="3">
|
||||
<Item1>
|
||||
<Filename Value="mplayerctrl.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="MPlayerCtrl"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="mplayerctrl.lrs"/>
|
||||
<Type Value="LRS"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="README.txt"/>
|
||||
<Type Value="Text"/>
|
||||
</Item3>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="FCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item2>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)/"/>
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
</PublishOptions>
|
||||
</Package>
|
||||
</CONFIG>
|
21
components/mplayer/mplayercontrollaz.pas
Normal file
21
components/mplayer/mplayercontrollaz.pas
Normal file
@ -0,0 +1,21 @@
|
||||
{ This file was automatically created by Lazarus. do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit MPlayerControlLaz;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
MPlayerCtrl, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('MPlayerCtrl', @MPlayerCtrl.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('MPlayerControlLaz', @Register);
|
||||
end.
|
78
components/mplayer/mplayerctrl.lrs
Normal file
78
components/mplayer/mplayerctrl.lrs
Normal file
@ -0,0 +1,78 @@
|
||||
LazarusResources.Add('tmplayercontrol','XPM',[
|
||||
'/* XPM */'#10'static char * tmplayercontrol_xpm[] = {'#10'"25 24 185 2",'#10
|
||||
+'" '#9'c None",'#10'". '#9'c #1D153E",'#10'"+ '#9'c #251B4F",'#10'"@ '#9'c '
|
||||
+'#2D2161",'#10'"# '#9'c #362773",'#10'"$ '#9'c #3A2A7D",'#10'"% '#9'c #3A2A7'
|
||||
+'C",'#10'"& '#9'c #23194C",'#10'"* '#9'c #342670",'#10'"= '#9'c #39297B",'#10
|
||||
+'"- '#9'c #787682",'#10'"; '#9'c #817C94",'#10'"> '#9'c #8982A6",'#10'", '#9
|
||||
+'c #9087B5",'#10'"'' '#9'c #9188B6",'#10'") '#9'c #857BAF",'#10'"! '#9'c #49'
|
||||
+'3B87",'#10'"~ '#9'c #29AEDE",'#10'"{ '#9'c #E3F6FC",'#10'"] '#9'c #FFFFFF",'
|
||||
+#10'"^ '#9'c #F1F0F6",'#10'"/ '#9'c #4A4561",'#10'"( '#9'c #0BAEE7",'#10'"_ '
|
||||
+#9'c #AAE3F7",'#10'": '#9'c #D1D1D1",'#10'"< '#9'c #077399",'#10'"[ '#9'c #0'
|
||||
+'BAEE8",'#10'"} '#9'c #D9F2FB",'#10'"| '#9'c #FEFEFE",'#10'"1 '#9'c #087DA7"'
|
||||
+','#10'"2 '#9'c #E0F5FC",'#10'"3 '#9'c #F5F4F8",'#10'"4 '#9'c #D2CEE1",'#10
|
||||
+'"5 '#9'c #E2E0EC",'#10'"6 '#9'c #E4E2ED",'#10'"7 '#9'c #F0EFF5",'#10'"8 '#9
|
||||
+'c #CDC9DE",'#10'"9 '#9'c #D1CEE1",'#10'"0 '#9'c #FBFBFC",'#10'"a '#9'c #DFD'
|
||||
+'FDF",'#10'"b '#9'c #CBCBCB",'#10'"c '#9'c #086B8E",'#10'"d '#9'c #07678A",'
|
||||
+#10'"e '#9'c #E1F5FC",'#10'"f '#9'c #C2BDD7",'#10'"g '#9'c #3B2B7D",'#10'"h '
|
||||
+#9'c #E1DFEB",'#10'"i '#9'c #5C4E93",'#10'"j '#9'c #8177AC",'#10'"k '#9'c #C'
|
||||
+'5C0D9",'#10'"l '#9'c #4E408A",'#10'"m '#9'c #655899",'#10'"n '#9'c #8980B1"'
|
||||
+','#10'"o '#9'c #C1C1C1",'#10'"p '#9'c #535353",'#10'"q '#9'c #0A87B4",'#10
|
||||
+'"r '#9'c #E7F7FD",'#10'"s '#9'c #A199C1",'#10'"t '#9'c #6D619E",'#10'"u '#9
|
||||
+'c #4A3B87",'#10'"v '#9'c #645799",'#10'"w '#9'c #55478F",'#10'"x '#9'c #756'
|
||||
+'AA4",'#10'"y '#9'c #7F74AA",'#10'"z '#9'c #929292",'#10'"A '#9'c #8D8D8D",'
|
||||
+#10'"B '#9'c #3E3E3E",'#10'"C '#9'c #DEDEDE",'#10'"D '#9'c #5D5D5D",'#10'"E '
|
||||
+#9'c #CFCFCF",'#10'"F '#9'c #878787",'#10'"G '#9'c #494949",'#10'"H '#9'c #4'
|
||||
+'D4D4D",'#10'"I '#9'c #3B3B3B",'#10'"J '#9'c #FDFEFF",'#10'"K '#9'c #0BA3D9"'
|
||||
+','#10'"L '#9'c #E8F8FD",'#10'"M '#9'c #8075AB",'#10'"N '#9'c #A59DC3",'#10
|
||||
+'"O '#9'c #3F2F80",'#10'"P '#9'c #A9A2C6",'#10'"Q '#9'c #463785",'#10'"R '#9
|
||||
+'c #574A90",'#10'"S '#9'c #B5AFCE",'#10'"T '#9'c #575757",'#10'"U '#9'c #C8C'
|
||||
+'8C8",'#10'"V '#9'c #2A2A2A",'#10'"W '#9'c #A9A9A9",'#10'"X '#9'c #767676",'
|
||||
+#10'"Y '#9'c #5C5C5C",'#10'"Z '#9'c #848484",'#10'"` '#9'c #ADADAD",'#10'" .'
|
||||
+#9'c #5F5F5F",'#10'"..'#9'c #DDDDDD",'#10'"+.'#9'c #FAFDFF",'#10'"@.'#9'c #0'
|
||||
+'BAAE3",'#10'"#.'#9'c #EDF9FD",'#10'"$.'#9'c #9087B6",'#10'"%.'#9'c #DCD9E8"'
|
||||
+','#10'"&.'#9'c #A098C0",'#10'"*.'#9'c #FAF9FC",'#10'"=.'#9'c #776CA5",'#10
|
||||
+'"-.'#9'c #CCC8DE",'#10'";.'#9'c #968DBA",'#10'">.'#9'c #BBBBBB",'#10'",.'#9
|
||||
+'c #565656",'#10'"''.'#9'c #B4B4B4",'#10'").'#9'c #B2B2B2",'#10'"!.'#9'c #75'
|
||||
+'7575",'#10'"~.'#9'c #B5B5B5",'#10'"{.'#9'c #B0B0B0",'#10'"].'#9'c #0993C4",'
|
||||
+#10'"^.'#9'c #7F7F7F",'#10'"/.'#9'c #FDFDFD",'#10'"(.'#9'c #0879A1",'#10'"_.'
|
||||
+#9'c #F3FBFE",'#10'":.'#9'c #066587",'#10'"<.'#9'c #065F7E",'#10'"[.'#9'c #F'
|
||||
+'4FBFE",'#10'"}.'#9'c #E1DEEB",'#10'"|.'#9'c #FCFBFD",'#10'"1.'#9'c #087FA9"'
|
||||
+','#10'"2.'#9'c #FAFDFE",'#10'"3.'#9'c #BCB6D3",'#10'"4.'#9'c #665A9A",'#10
|
||||
+'"5.'#9'c #6A5E9D",'#10'"6.'#9'c #51438C",'#10'"7.'#9'c #A8A1C6",'#10'"8.'#9
|
||||
+'c #FFFEFF",'#10'"9.'#9'c #F1F1F1",'#10'"0.'#9'c #B6B0CF",'#10'"a.'#9'c #625'
|
||||
+'597",'#10'"b.'#9'c #BFBDC8",'#10'"c.'#9'c #EDEDED",'#10'"d.'#9'c #EFEEF5",'
|
||||
+#10'"e.'#9'c #7368A3",'#10'"f.'#9'c #9B93BD",'#10'"g.'#9'c #EEF9FD",'#10'"h.'
|
||||
+#9'c #9998A1",'#10'"i.'#9'c #F8F8FB",'#10'"j.'#9'c #EBEAF2",'#10'"k.'#9'c #9'
|
||||
+'B9B9B",'#10'"l.'#9'c #111111",'#10'"m.'#9'c #8A8A8A",'#10'"n.'#9'c #F7F7F7"'
|
||||
+','#10'"o.'#9'c #F8F7FA",'#10'"p.'#9'c #84C2E3",'#10'"q.'#9'c #065A77",'#10
|
||||
+'"r.'#9'c #221A42",'#10'"s.'#9'c #A19AC1",'#10'"t.'#9'c #EBE9F2",'#10'"u.'#9
|
||||
+'c #CECADF",'#10'"v.'#9'c #7A6FA7",'#10'"w.'#9'c #000000",'#10'"x.'#9'c #1E1'
|
||||
+'E1E",'#10'"y.'#9'c #A1A1A1",'#10'"z.'#9'c #958DB9",'#10'"A.'#9'c #201746",'
|
||||
+#10'"B.'#9'c #221949",'#10'"C.'#9'c #867CAF",'#10'"D.'#9'c #2F2F2F",'#10'"E.'
|
||||
+#9'c #BFBFBF",'#10'"F.'#9'c #A099C1",'#10'"G.'#9'c #2C205E",'#10'"H.'#9'c #5'
|
||||
+'6498F",'#10'"I.'#9'c #FDFDFE",'#10'"J.'#9'c #151515",'#10'"K.'#9'c #979797"'
|
||||
+','#10'"L.'#9'c #FCFCFC",'#10'"M.'#9'c #7065A1",'#10'"N.'#9'c #1E1641",'#10
|
||||
+'"O.'#9'c #1D153F",'#10'"P.'#9'c #251B51",'#10'"Q.'#9'c #9C94BE",'#10'"R.'#9
|
||||
+'c #D8D8D8",'#10'"S.'#9'c #EFEFEF",'#10'"T.'#9'c #B8B2D0",'#10'"U.'#9'c #2E2'
|
||||
+'162",'#10'"V.'#9'c #2A1F5B",'#10'"W.'#9'c #7165A1",'#10'"X.'#9'c #B3ADCD",'
|
||||
+#10'"Y.'#9'c #B7B1D0",'#10'"Z.'#9'c #302366",'#10'"`.'#9'c #1F1642",'#10'" +'
|
||||
+#9'c #201744",'#10'" . ",'#10
|
||||
+'" + @ # $ $ $ $ $ % ",'#10'" '
|
||||
+' & * $ $ $ $ $ $ $ $ $ $ $ = ",'#10'" - ; > , '' '' '' '' '' '
|
||||
+''' '' '' '' '' '' '' ) ! ",'#10'" ~ { ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] '
|
||||
+'] ] ] ^ / ",'#10'" ( _ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] : ",'#10
|
||||
+'"< [ } ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] | ",'#10'"1 [ 2 ] 3 4 ] 5 '
|
||||
+'6 7 8 9 0 a b ] ] ] ] ] ] ] ] ] c ",'#10'"d [ e ] f g h i j k l m n o p ] ]'
|
||||
,' ] ] ] ] ] ] ] q ",'#10'" [ r ] s ! t u v k w x y z A B C D E F G H I J K '
|
||||
+'",'#10'" [ L ] M N O P Q k R S 7 T U V W X Y Z ` ...+.[ ",'#10'" @.#.] $'
|
||||
+'.%.&.*.=.-.;.] ] X >.,.G ''.).!.~.{.] +.[ ",'#10'" ].#.] ] ] ] ] ] ] ] ] ]'
|
||||
+' ] ] X ^./.] ] ] ] ] +.[ ",'#10'" (._.] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] '
|
||||
+'] +.[ :.",'#10'" <.[.] ] ] ] ] ] ] ] ] ] ] ] ] | 6 }.|.] ] +.[ 1.",'#10'" '
|
||||
+' 2.] ] ] ] ] ] ] ] ] ] ] ] 3.w 4.5.6.7.8.+.[ (.",'#10'" 9.] ] ] ] ] ] '
|
||||
+'] ] ] ] ] 0.a.b.c.] d.e.f.g.[ ",'#10'" h.] ] ] ] ] ] ] ] ] ] i.6.j.k.l'
|
||||
+'.m.n.o.w p.q. ",'#10'" r.s.t.*.*.*.] ] ] ] ] u.v.] k.w.w.x.y.z. ",'
|
||||
+#10'" $ $ $ $ $ $ $ $ $ A.B.C.] k.w.w.D.E.F. ",'#10'" A.$ $ $'
|
||||
+' $ G.& H.I.k.J.K.L.] M. ",'#10'" N.O. P.'
|
||||
+'Q.R.S.] ] T.U. ",'#10'" V.W.X.Y.y Z. '
|
||||
+' ",'#10'" `. + "};'#10
|
||||
]);
|
352
components/mplayer/mplayerctrl.pas
Normal file
352
components/mplayer/mplayerctrl.pas
Normal file
@ -0,0 +1,352 @@
|
||||
{ LCL control for playing videos using mplayer under gtk2
|
||||
|
||||
Copyright (C) 2009 Mattias Gaertner mattias@freepascal.org
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version with the following modification:
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent modules,and
|
||||
to copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the terms
|
||||
and conditions of the license of that module. An independent module is a
|
||||
module which is not derived from or based on this library. If you modify
|
||||
this library, you may extend this exception to your version of the library,
|
||||
but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version.
|
||||
|
||||
This program 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 Library General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
}
|
||||
unit MPlayerCtrl;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$ifndef LCLgtk2}
|
||||
{$error this unit only supports LCL under gtk2}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls, WSLCLClasses, LCLProc, LCLType, InterfaceBase,
|
||||
LResources, LMessages, Graphics, ExtCtrls, FileUtil, Process, UTF8Process,
|
||||
X, gtk2int, gtk2, glib2, gdk2x, Gtk2WSControls, GTKProc, GtkDef;
|
||||
|
||||
type
|
||||
|
||||
{ TCustomMPlayerControl }
|
||||
|
||||
TCustomMPlayerControl = class(TWinControl)
|
||||
private
|
||||
FFilename: string;
|
||||
FLoop: integer;
|
||||
FMPlayerPath: string;
|
||||
FPaused: boolean;
|
||||
fPlayerProcess: TProcessUTF8;
|
||||
fTimer: TTimer;
|
||||
FVolume: integer;
|
||||
FCanvas: TCanvas;
|
||||
procedure SetFilename(const AValue: string);
|
||||
procedure SetLoop(const AValue: integer);
|
||||
procedure SetMPlayerPath(const AValue: string);
|
||||
procedure SetPaused(const AValue: boolean);
|
||||
procedure SetVolume(const AValue: integer);
|
||||
procedure TimerEvent(Sender: TObject);
|
||||
protected
|
||||
procedure WMPaint(var Message: TLMPaint); message LM_PAINT;
|
||||
procedure WMSize(var Message: TLMSize); message LM_SIZE;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure SendMPlayerCommand(Cmd: string); // see: mplayer -input cmdlist and http://www.mplayerhq.hu/DOCS/tech/slave.txt
|
||||
function Running: boolean;
|
||||
procedure Play;
|
||||
procedure Stop;
|
||||
function Playing: boolean;
|
||||
procedure Invalidate; override;
|
||||
procedure EraseBackground(DC: HDC); override;
|
||||
public
|
||||
property Filename: string read FFilename write SetFilename;
|
||||
property MPlayerPath: string read FMPlayerPath write SetMPlayerPath;
|
||||
property PlayerProcess: TProcessUTF8 read fPlayerProcess;
|
||||
property Paused: boolean read FPaused write SetPaused;
|
||||
property Loop: integer read FLoop write SetLoop; // -1 no, 0 forever, 1 once, 2 twice, ...
|
||||
property Volume: integer read FVolume write SetVolume;
|
||||
end;
|
||||
|
||||
TMPlayerControl = class(TCustomMPlayerControl)
|
||||
published
|
||||
property Align;
|
||||
property Anchors;
|
||||
property BorderSpacing;
|
||||
property Enabled;
|
||||
property Filename;
|
||||
property Loop;
|
||||
property OnChangeBounds;
|
||||
property OnConstrainedResize;
|
||||
property OnResize;
|
||||
property Visible;
|
||||
property Volume;
|
||||
end;
|
||||
|
||||
{ TWSMPlayerControl }
|
||||
|
||||
TWSMPlayerControl = class(TGtk2WSWinControl)
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Multimedia',[TMPlayerControl]);
|
||||
end;
|
||||
|
||||
{ TCustomMPlayerControl }
|
||||
|
||||
procedure TCustomMPlayerControl.TimerEvent(Sender: TObject);
|
||||
begin
|
||||
if Running then begin
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.WMPaint(var Message: TLMPaint);
|
||||
begin
|
||||
Include(FControlState, csCustomPaint);
|
||||
inherited WMPaint(Message);
|
||||
if (csDesigning in ComponentState) and (FCanvas<>nil) then begin
|
||||
with FCanvas do begin
|
||||
if Message.DC <> 0 then
|
||||
Handle := Message.DC;
|
||||
Brush.Color:=clLtGray;
|
||||
Pen.Color:=clRed;
|
||||
Rectangle(0,0,Self.Width-1,Self.Height-1);
|
||||
MoveTo(0,0);
|
||||
LineTo(Self.Width,Self.Height);
|
||||
MoveTo(0,Self.Height);
|
||||
LineTo(Self.Width,0);
|
||||
if Message.DC <> 0 then
|
||||
Handle := 0;
|
||||
end;
|
||||
end;
|
||||
Exclude(FControlState, csCustomPaint);
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.WMSize(var Message: TLMSize);
|
||||
begin
|
||||
if (Message.SizeType and Size_SourceIsInterface)>0 then
|
||||
DoOnResize;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.SetFilename(const AValue: string);
|
||||
begin
|
||||
if FFilename=AValue then exit;
|
||||
FFilename:=AValue;
|
||||
if Running then
|
||||
SendMPlayerCommand('loadfile ');
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.SetLoop(const AValue: integer);
|
||||
begin
|
||||
if FLoop=AValue then exit;
|
||||
FLoop:=AValue;
|
||||
if Running then
|
||||
SendMPlayerCommand('loop '+IntToStr(FLoop));
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.SetMPlayerPath(const AValue: string);
|
||||
begin
|
||||
if FMPlayerPath=AValue then exit;
|
||||
FMPlayerPath:=AValue;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.SetPaused(const AValue: boolean);
|
||||
begin
|
||||
if FPaused=AValue then exit;
|
||||
if Running then begin
|
||||
FPaused:=AValue;
|
||||
SendMPlayerCommand('pause');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.SetVolume(const AValue: integer);
|
||||
begin
|
||||
if FVolume=AValue then exit;
|
||||
FVolume:=AValue;
|
||||
if Running then
|
||||
SendMPlayerCommand('volume '+IntToStr(FVolume)+' 1');
|
||||
end;
|
||||
|
||||
constructor TCustomMPlayerControl.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
ControlStyle:=ControlStyle-[csSetCaption];
|
||||
if (csDesigning in ComponentState) then begin
|
||||
FCanvas := TControlCanvas.Create;
|
||||
TControlCanvas(FCanvas).Control := Self;
|
||||
end else
|
||||
FCompStyle:=csNonLCL;
|
||||
SetInitialBounds(0, 0, 160, 90);
|
||||
|
||||
fMPlayerPath:='mplayer';
|
||||
fTimer:=TTimer.Create(Self);
|
||||
fTimer.OnTimer:=@TimerEvent;
|
||||
end;
|
||||
|
||||
destructor TCustomMPlayerControl.Destroy;
|
||||
begin
|
||||
Stop;
|
||||
FreeAndNil(FCanvas);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.SendMPlayerCommand(Cmd: string);
|
||||
begin
|
||||
if Cmd='' then exit;
|
||||
if not Running then exit;
|
||||
if Cmd[length(Cmd)]<>LineEnding then Cmd:=Cmd+LineEnding;
|
||||
fPlayerProcess.Input.Write(Cmd[1],length(Cmd));
|
||||
end;
|
||||
|
||||
function TCustomMPlayerControl.Running: boolean;
|
||||
begin
|
||||
Result:=(fPlayerProcess<>nil) and fPlayerProcess.Running;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.Play;
|
||||
var
|
||||
ExePath: String;
|
||||
CurWindowID: TXID;
|
||||
begin
|
||||
if (csDesigning in ComponentState) then exit;
|
||||
|
||||
if Running and Paused then begin
|
||||
Paused:=false;
|
||||
exit;
|
||||
end;
|
||||
|
||||
if Playing then exit;
|
||||
|
||||
if (not HandleAllocated) then exit;
|
||||
DebugLn(['TCustomMPlayerControl.Play ']);
|
||||
|
||||
if fPlayerProcess<>nil then
|
||||
raise Exception.Create('TCustomMPlayerControl.Play fPlayerProcess still exists');
|
||||
|
||||
ExePath:=MPlayerPath;
|
||||
if not FilenameIsAbsolute(ExePath) then
|
||||
ExePath:=FindDefaultExecutablePath(ExePath);
|
||||
if not FileExistsUTF8(ExePath) then
|
||||
raise Exception.Create('mplayer not found');
|
||||
|
||||
CurWindowID := GDK_WINDOW_XWINDOW(PGtkWidget(PtrUInt(Handle))^.window);
|
||||
|
||||
fPlayerProcess:=TProcessUTF8.Create(Self);
|
||||
fPlayerProcess.Options:=fPlayerProcess.Options+[poUsePipes,poNoConsole];
|
||||
fPlayerProcess.CommandLine:=ExePath+' -slave -quiet -wid '+IntToStr(CurWindowID)+' "'+Filename+'"';
|
||||
DebugLn(['TCustomMPlayerControl.Play ',fPlayerProcess.CommandLine]);
|
||||
fPlayerProcess.Execute;
|
||||
|
||||
fTimer.Enabled:=true;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.Stop;
|
||||
begin
|
||||
if fPlayerProcess=nil then exit;
|
||||
FPaused:=false;
|
||||
fTimer.Enabled:=false;
|
||||
SendMPlayerCommand('quit');
|
||||
FreeAndNil(fPlayerProcess);
|
||||
end;
|
||||
|
||||
function TCustomMPlayerControl.Playing: boolean;
|
||||
begin
|
||||
Result:=(fPlayerProcess<>nil) and fPlayerProcess.Running and (not Paused);
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.Invalidate;
|
||||
begin
|
||||
if csCustomPaint in FControlState then exit;
|
||||
inherited Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.EraseBackground(DC: HDC);
|
||||
begin
|
||||
if DC=0 then ;
|
||||
// everything is painted, so erasing the background is not needed
|
||||
end;
|
||||
|
||||
function MPLayerWidgetDestroyCB(Widget: PGtkWidget; data: gPointer): GBoolean; cdecl;
|
||||
begin
|
||||
FreeWidgetInfo(Widget); // created in TWSMPlayerControl.CreateHandle
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
{ TWSMPlayerControl }
|
||||
|
||||
class function TWSMPlayerControl.CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND;
|
||||
var
|
||||
NewWidget: PGtkWidget;
|
||||
WidgetInfo: PWidgetInfo;
|
||||
Allocation: TGTKAllocation;
|
||||
begin
|
||||
if csDesigning in AWinControl.ComponentState then
|
||||
Result:=inherited CreateHandle(AWinControl,AParams)
|
||||
else begin
|
||||
NewWidget:=gtk_event_box_new;
|
||||
|
||||
WidgetInfo := GetWidgetInfo(NewWidget,true); // destroyed in MPLayerWidgetDestroyCB
|
||||
WidgetInfo^.LCLObject := AWinControl;
|
||||
WidgetInfo^.Style := AParams.Style;
|
||||
WidgetInfo^.ExStyle := AParams.ExStyle;
|
||||
WidgetInfo^.WndProc := PtrUInt(AParams.WindowClass.lpfnWndProc);
|
||||
|
||||
// set allocation
|
||||
Allocation.X := AParams.X;
|
||||
Allocation.Y := AParams.Y;
|
||||
Allocation.Width := AParams.Width;
|
||||
Allocation.Height := AParams.Height;
|
||||
gtk_widget_size_allocate(NewWidget, @Allocation);
|
||||
|
||||
if csDesigning in AWinControl.ComponentState then begin
|
||||
// at designtime setup normal handlers
|
||||
TGtk2WidgetSet(WidgetSet).FinishCreateHandle(AWinControl,NewWidget,AParams);
|
||||
end else begin
|
||||
// at runtime
|
||||
g_signal_connect(GPointer(NewWidget), 'destroy',
|
||||
TGTKSignalFunc(@MPLayerWidgetDestroyCB), WidgetInfo);
|
||||
end;
|
||||
Result:=HWND(PtrUInt(Pointer(NewWidget)));
|
||||
DebugLn(['TWSMPlayerControl.CreateHandle ',dbgs(NewWidget)]);
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TWSMPlayerControl.DestroyHandle(const AWinControl: TWinControl
|
||||
);
|
||||
begin
|
||||
inherited DestroyHandle(AWinControl);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterWSComponent(TCustomMPlayerControl,TWSMPlayerControl);
|
||||
{$I mplayerctrl.lrs}
|
||||
|
||||
end.
|
||||
|
212
components/mplayer/tmplayercontrol.xpm
Normal file
212
components/mplayer/tmplayercontrol.xpm
Normal file
@ -0,0 +1,212 @@
|
||||
/* XPM */
|
||||
static char * tmplayercontrol_xpm[] = {
|
||||
"25 24 185 2",
|
||||
" c None",
|
||||
". c #1D153E",
|
||||
"+ c #251B4F",
|
||||
"@ c #2D2161",
|
||||
"# c #362773",
|
||||
"$ c #3A2A7D",
|
||||
"% c #3A2A7C",
|
||||
"& c #23194C",
|
||||
"* c #342670",
|
||||
"= c #39297B",
|
||||
"- c #787682",
|
||||
"; c #817C94",
|
||||
"> c #8982A6",
|
||||
", c #9087B5",
|
||||
"' c #9188B6",
|
||||
") c #857BAF",
|
||||
"! c #493B87",
|
||||
"~ c #29AEDE",
|
||||
"{ c #E3F6FC",
|
||||
"] c #FFFFFF",
|
||||
"^ c #F1F0F6",
|
||||
"/ c #4A4561",
|
||||
"( c #0BAEE7",
|
||||
"_ c #AAE3F7",
|
||||
": c #D1D1D1",
|
||||
"< c #077399",
|
||||
"[ c #0BAEE8",
|
||||
"} c #D9F2FB",
|
||||
"| c #FEFEFE",
|
||||
"1 c #087DA7",
|
||||
"2 c #E0F5FC",
|
||||
"3 c #F5F4F8",
|
||||
"4 c #D2CEE1",
|
||||
"5 c #E2E0EC",
|
||||
"6 c #E4E2ED",
|
||||
"7 c #F0EFF5",
|
||||
"8 c #CDC9DE",
|
||||
"9 c #D1CEE1",
|
||||
"0 c #FBFBFC",
|
||||
"a c #DFDFDF",
|
||||
"b c #CBCBCB",
|
||||
"c c #086B8E",
|
||||
"d c #07678A",
|
||||
"e c #E1F5FC",
|
||||
"f c #C2BDD7",
|
||||
"g c #3B2B7D",
|
||||
"h c #E1DFEB",
|
||||
"i c #5C4E93",
|
||||
"j c #8177AC",
|
||||
"k c #C5C0D9",
|
||||
"l c #4E408A",
|
||||
"m c #655899",
|
||||
"n c #8980B1",
|
||||
"o c #C1C1C1",
|
||||
"p c #535353",
|
||||
"q c #0A87B4",
|
||||
"r c #E7F7FD",
|
||||
"s c #A199C1",
|
||||
"t c #6D619E",
|
||||
"u c #4A3B87",
|
||||
"v c #645799",
|
||||
"w c #55478F",
|
||||
"x c #756AA4",
|
||||
"y c #7F74AA",
|
||||
"z c #929292",
|
||||
"A c #8D8D8D",
|
||||
"B c #3E3E3E",
|
||||
"C c #DEDEDE",
|
||||
"D c #5D5D5D",
|
||||
"E c #CFCFCF",
|
||||
"F c #878787",
|
||||
"G c #494949",
|
||||
"H c #4D4D4D",
|
||||
"I c #3B3B3B",
|
||||
"J c #FDFEFF",
|
||||
"K c #0BA3D9",
|
||||
"L c #E8F8FD",
|
||||
"M c #8075AB",
|
||||
"N c #A59DC3",
|
||||
"O c #3F2F80",
|
||||
"P c #A9A2C6",
|
||||
"Q c #463785",
|
||||
"R c #574A90",
|
||||
"S c #B5AFCE",
|
||||
"T c #575757",
|
||||
"U c #C8C8C8",
|
||||
"V c #2A2A2A",
|
||||
"W c #A9A9A9",
|
||||
"X c #767676",
|
||||
"Y c #5C5C5C",
|
||||
"Z c #848484",
|
||||
"` c #ADADAD",
|
||||
" . c #5F5F5F",
|
||||
".. c #DDDDDD",
|
||||
"+. c #FAFDFF",
|
||||
"@. c #0BAAE3",
|
||||
"#. c #EDF9FD",
|
||||
"$. c #9087B6",
|
||||
"%. c #DCD9E8",
|
||||
"&. c #A098C0",
|
||||
"*. c #FAF9FC",
|
||||
"=. c #776CA5",
|
||||
"-. c #CCC8DE",
|
||||
";. c #968DBA",
|
||||
">. c #BBBBBB",
|
||||
",. c #565656",
|
||||
"'. c #B4B4B4",
|
||||
"). c #B2B2B2",
|
||||
"!. c #757575",
|
||||
"~. c #B5B5B5",
|
||||
"{. c #B0B0B0",
|
||||
"]. c #0993C4",
|
||||
"^. c #7F7F7F",
|
||||
"/. c #FDFDFD",
|
||||
"(. c #0879A1",
|
||||
"_. c #F3FBFE",
|
||||
":. c #066587",
|
||||
"<. c #065F7E",
|
||||
"[. c #F4FBFE",
|
||||
"}. c #E1DEEB",
|
||||
"|. c #FCFBFD",
|
||||
"1. c #087FA9",
|
||||
"2. c #FAFDFE",
|
||||
"3. c #BCB6D3",
|
||||
"4. c #665A9A",
|
||||
"5. c #6A5E9D",
|
||||
"6. c #51438C",
|
||||
"7. c #A8A1C6",
|
||||
"8. c #FFFEFF",
|
||||
"9. c #F1F1F1",
|
||||
"0. c #B6B0CF",
|
||||
"a. c #625597",
|
||||
"b. c #BFBDC8",
|
||||
"c. c #EDEDED",
|
||||
"d. c #EFEEF5",
|
||||
"e. c #7368A3",
|
||||
"f. c #9B93BD",
|
||||
"g. c #EEF9FD",
|
||||
"h. c #9998A1",
|
||||
"i. c #F8F8FB",
|
||||
"j. c #EBEAF2",
|
||||
"k. c #9B9B9B",
|
||||
"l. c #111111",
|
||||
"m. c #8A8A8A",
|
||||
"n. c #F7F7F7",
|
||||
"o. c #F8F7FA",
|
||||
"p. c #84C2E3",
|
||||
"q. c #065A77",
|
||||
"r. c #221A42",
|
||||
"s. c #A19AC1",
|
||||
"t. c #EBE9F2",
|
||||
"u. c #CECADF",
|
||||
"v. c #7A6FA7",
|
||||
"w. c #000000",
|
||||
"x. c #1E1E1E",
|
||||
"y. c #A1A1A1",
|
||||
"z. c #958DB9",
|
||||
"A. c #201746",
|
||||
"B. c #221949",
|
||||
"C. c #867CAF",
|
||||
"D. c #2F2F2F",
|
||||
"E. c #BFBFBF",
|
||||
"F. c #A099C1",
|
||||
"G. c #2C205E",
|
||||
"H. c #56498F",
|
||||
"I. c #FDFDFE",
|
||||
"J. c #151515",
|
||||
"K. c #979797",
|
||||
"L. c #FCFCFC",
|
||||
"M. c #7065A1",
|
||||
"N. c #1E1641",
|
||||
"O. c #1D153F",
|
||||
"P. c #251B51",
|
||||
"Q. c #9C94BE",
|
||||
"R. c #D8D8D8",
|
||||
"S. c #EFEFEF",
|
||||
"T. c #B8B2D0",
|
||||
"U. c #2E2162",
|
||||
"V. c #2A1F5B",
|
||||
"W. c #7165A1",
|
||||
"X. c #B3ADCD",
|
||||
"Y. c #B7B1D0",
|
||||
"Z. c #302366",
|
||||
"`. c #1F1642",
|
||||
" + c #201744",
|
||||
" . ",
|
||||
" + @ # $ $ $ $ $ % ",
|
||||
" & * $ $ $ $ $ $ $ $ $ $ $ = ",
|
||||
" - ; > , ' ' ' ' ' ' ' ' ' ' ' ' ) ! ",
|
||||
" ~ { ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ / ",
|
||||
" ( _ ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] : ",
|
||||
"< [ } ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] | ",
|
||||
"1 [ 2 ] 3 4 ] 5 6 7 8 9 0 a b ] ] ] ] ] ] ] ] ] c ",
|
||||
"d [ e ] f g h i j k l m n o p ] ] ] ] ] ] ] ] ] q ",
|
||||
" [ r ] s ! t u v k w x y z A B C D E F G H I J K ",
|
||||
" [ L ] M N O P Q k R S 7 T U V W X Y Z ` ...+.[ ",
|
||||
" @.#.] $.%.&.*.=.-.;.] ] X >.,.G '.).!.~.{.] +.[ ",
|
||||
" ].#.] ] ] ] ] ] ] ] ] ] ] ] X ^./.] ] ] ] ] +.[ ",
|
||||
" (._.] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] +.[ :.",
|
||||
" <.[.] ] ] ] ] ] ] ] ] ] ] ] ] | 6 }.|.] ] +.[ 1.",
|
||||
" 2.] ] ] ] ] ] ] ] ] ] ] ] 3.w 4.5.6.7.8.+.[ (.",
|
||||
" 9.] ] ] ] ] ] ] ] ] ] ] 0.a.b.c.] d.e.f.g.[ ",
|
||||
" h.] ] ] ] ] ] ] ] ] ] i.6.j.k.l.m.n.o.w p.q. ",
|
||||
" r.s.t.*.*.*.] ] ] ] ] u.v.] k.w.w.x.y.z. ",
|
||||
" $ $ $ $ $ $ $ $ $ A.B.C.] k.w.w.D.E.F. ",
|
||||
" A.$ $ $ $ G.& H.I.k.J.K.L.] M. ",
|
||||
" N.O. P.Q.R.S.] ] T.U. ",
|
||||
" V.W.X.Y.y Z. ",
|
||||
" `. + "};
|
Reference in New Issue
Block a user