You've already forked lazarus-ccr
mplayer: Changes for Microsoft Windows Compatibility and added Events for Mouse Actions, from Michael Koecher
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2916 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,19 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="7"/>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<Icon Value="0"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
@ -36,221 +38,32 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="11">
|
||||
<Units Count="2">
|
||||
<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"/>
|
||||
<HasResources Value="True"/>
|
||||
<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"/>
|
||||
<Version Value="11"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)/"/>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
|
@ -10,7 +10,7 @@ uses
|
||||
Forms, Unit1, MPlayerControlLaz, LResources
|
||||
{ you can add units after this };
|
||||
|
||||
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
||||
//{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
||||
|
||||
begin
|
||||
{$I project1.lrs}
|
||||
|
@ -8,11 +8,11 @@ object Form1: TForm1
|
||||
ClientHeight = 390
|
||||
ClientWidth = 583
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '0.9.29'
|
||||
LCLVersion = '1.0.14.0'
|
||||
object MPlayerControl1: TMPlayerControl
|
||||
Left = 6
|
||||
Height = 333
|
||||
Top = 30
|
||||
Height = 334
|
||||
Top = 27
|
||||
Width = 571
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
@ -21,67 +21,63 @@ object Form1: TForm1
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 24
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 583
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
ClientHeight = 24
|
||||
ClientHeight = 21
|
||||
ClientWidth = 583
|
||||
TabOrder = 1
|
||||
object PlaySpeedButton: TSpeedButton
|
||||
Left = 1
|
||||
Height = 22
|
||||
Height = 19
|
||||
Top = 1
|
||||
Width = 63
|
||||
Width = 26
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Play'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = PlaySpeedButtonClick
|
||||
end
|
||||
object PauseSpeedButton: TSpeedButton
|
||||
Left = 64
|
||||
Height = 22
|
||||
Left = 27
|
||||
Height = 19
|
||||
Top = 1
|
||||
Width = 63
|
||||
Width = 35
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Pause'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = PauseSpeedButtonClick
|
||||
end
|
||||
object StopSpeedButton: TSpeedButton
|
||||
Left = 127
|
||||
Height = 22
|
||||
Left = 62
|
||||
Height = 19
|
||||
Top = 1
|
||||
Width = 63
|
||||
Width = 28
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Stop'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = StopSpeedButtonClick
|
||||
end
|
||||
object OpenSpeedButton: TSpeedButton
|
||||
Left = 190
|
||||
Height = 22
|
||||
Left = 90
|
||||
Height = 19
|
||||
Top = 1
|
||||
Width = 160
|
||||
Width = 52
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Caption = 'Open file'
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = OpenSpeedButtonClick
|
||||
end
|
||||
end
|
||||
object StatusBar1: TStatusBar
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 369
|
||||
Height = 23
|
||||
Top = 367
|
||||
Width = 583
|
||||
Panels = <>
|
||||
end
|
||||
|
@ -4,25 +4,24 @@ 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'
|
||||
+'rsion'#6#8'1.0.14.0'#0#15'TMPlayerControl'#15'MPlayerControl1'#4'Left'#2#6#6
|
||||
+'Height'#3'N'#1#3'Top'#2#27#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
|
||||
+'t'#2#0#6'Height'#2#21#3'Top'#2#0#5'Width'#3'G'#2#5'Align'#7#5'alTop'#8'Auto'
|
||||
+'Size'#9#12'ClientHeight'#2#21#11'ClientWidth'#3'G'#2#8'TabOrder'#2#1#0#12'T'
|
||||
+'SpeedButton'#15'PlaySpeedButton'#4'Left'#2#1#6'Height'#2#19#3'Top'#2#1#5'Wi'
|
||||
+'dth'#2#26#5'Align'#7#6'alLeft'#8'AutoSize'#9#7'Caption'#6#4'Play'#9'NumGlyp'
|
||||
+'hs'#2#0#7'OnClick'#7#20'PlaySpeedButtonClick'#0#0#12'TSpeedButton'#16'Pause'
|
||||
+'SpeedButton'#4'Left'#2#27#6'Height'#2#19#3'Top'#2#1#5'Width'#2'#'#5'Align'#7
|
||||
+#6'alLeft'#8'AutoSize'#9#7'Caption'#6#5'Pause'#9'NumGlyphs'#2#0#7'OnClick'#7
|
||||
+#21'PauseSpeedButtonClick'#0#0#12'TSpeedButton'#15'StopSpeedButton'#4'Left'#2
|
||||
+'>'#6'Height'#2#19#3'Top'#2#1#5'Width'#2#28#5'Align'#7#6'alLeft'#8'AutoSize'
|
||||
+#9#7'Caption'#6#4'Stop'#9'NumGlyphs'#2#0#7'OnClick'#7#20'StopSpeedButtonClic'
|
||||
+'k'#0#0#12'TSpeedButton'#15'OpenSpeedButton'#4'Left'#2'Z'#6'Height'#2#19#3'T'
|
||||
+'op'#2#1#5'Width'#2'4'#5'Align'#7#6'alLeft'#8'AutoSize'#9#7'Caption'#6#9'Ope'
|
||||
+'n file'#9'NumGlyphs'#2#0#7'OnClick'#7#20'OpenSpeedButtonClick'#0#0#0#10'TSt'
|
||||
+'atusBar'#10'StatusBar1'#4'Left'#2#0#6'Height'#2#23#3'Top'#3'o'#1#5'Width'#3
|
||||
+'G'#2#6'Panels'#14#0#0#0#11'TOpenDialog'#11'OpenDialog1'#7'Options'#11#15'of'
|
||||
+'FileMustExist'#14'ofEnableSizing'#12'ofViewDetail'#0#4'left'#3#235#0#3'top'
|
||||
+#2#127#0#0#0
|
||||
]);
|
||||
|
@ -72,6 +72,15 @@ 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;
|
||||
|
||||
initialization
|
||||
|
@ -26,21 +26,30 @@
|
||||
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.
|
||||
|
||||
Changes:
|
||||
2014-03-24 Changes for Microsoft Windows Compatibility and added Events
|
||||
for Mouse Actions/ Michael Koecher aka six1
|
||||
}
|
||||
unit MPlayerCtrl;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$ifndef LCLgtk2}
|
||||
{$error this unit only supports LCL under gtk2}
|
||||
{$ifdef Linux}
|
||||
{$ifndef LCLgtk2}
|
||||
{$error this unit only supports LCL under gtk2}
|
||||
{$endif}
|
||||
{$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;
|
||||
LResources, LMessages, Graphics, ExtCtrls, FileUtil, Process, UTF8Process
|
||||
{$ifdef Linux}
|
||||
, gtk2int, gtk2, glib2, gdk2x, Gtk2WSControls, GTK2Proc, Gtk2Def
|
||||
{$endif}
|
||||
;
|
||||
|
||||
type
|
||||
|
||||
@ -49,6 +58,7 @@ type
|
||||
TCustomMPlayerControl = class(TWinControl)
|
||||
private
|
||||
FFilename: string;
|
||||
FStartParam:string;
|
||||
FLoop: integer;
|
||||
FMPlayerPath: string;
|
||||
FPaused: boolean;
|
||||
@ -61,6 +71,7 @@ type
|
||||
procedure SetMPlayerPath(const AValue: string);
|
||||
procedure SetPaused(const AValue: boolean);
|
||||
procedure SetVolume(const AValue: integer);
|
||||
procedure SetStartParam(const AValue: string);
|
||||
procedure TimerEvent(Sender: TObject);
|
||||
protected
|
||||
procedure WMPaint(var Message: TLMPaint); message LM_PAINT;
|
||||
@ -77,6 +88,7 @@ type
|
||||
procedure EraseBackground(DC: HDC); override;
|
||||
public
|
||||
property Filename: string read FFilename write SetFilename;
|
||||
property StartParam: string read FStartParam write SetStartParam;
|
||||
property MPlayerPath: string read FMPlayerPath write SetMPlayerPath;
|
||||
property PlayerProcess: TProcessUTF8 read fPlayerProcess;
|
||||
property Paused: boolean read FPaused write SetPaused;
|
||||
@ -95,18 +107,23 @@ type
|
||||
property OnChangeBounds;
|
||||
property OnConstrainedResize;
|
||||
property OnResize;
|
||||
property OnClick;
|
||||
property OnMouseUp;
|
||||
property OnMouseDown;
|
||||
property Visible;
|
||||
property Volume;
|
||||
end;
|
||||
|
||||
{ TWSMPlayerControl }
|
||||
|
||||
TWSMPlayerControl = class(TGtk2WSWinControl)
|
||||
published
|
||||
{$ifdef Linux}
|
||||
TWSMPlayerControl = class(TGtk2WSWinControl)
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
||||
end;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
procedure Register;
|
||||
|
||||
@ -117,12 +134,26 @@ begin
|
||||
RegisterComponents('Multimedia',[TMPlayerControl]);
|
||||
end;
|
||||
|
||||
|
||||
{ TCustomMPlayerControl }
|
||||
|
||||
procedure TCustomMPlayerControl.TimerEvent(Sender: TObject);
|
||||
var
|
||||
OutList, ErrList:TStringlist;
|
||||
begin
|
||||
if Running then begin
|
||||
|
||||
if fPlayerProcess.Output.NumBytesAvailable > 0 then begin
|
||||
OutList:=TStringlist.create;
|
||||
OutList.LoadFromStream(fPlayerProcess.Output);
|
||||
OutList.free;
|
||||
end;
|
||||
if fPlayerProcess.Output.NumBytesAvailable > 0 then begin
|
||||
ErrList:=TStringlist.create;
|
||||
ErrList.LoadFromStream(fPlayerProcess.Stderr);
|
||||
ErrList.free;
|
||||
end;
|
||||
end else begin
|
||||
Stop;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -154,6 +185,13 @@ begin
|
||||
DoOnResize;
|
||||
end;
|
||||
|
||||
|
||||
procedure TCustomMPlayerControl.SetStartParam(const AValue: string);
|
||||
begin
|
||||
if FStartParam=AValue then exit;
|
||||
FStartParam:=AValue;
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.SetFilename(const AValue: string);
|
||||
begin
|
||||
if FFilename=AValue then exit;
|
||||
@ -213,6 +251,7 @@ destructor TCustomMPlayerControl.Destroy;
|
||||
begin
|
||||
Stop;
|
||||
FreeAndNil(FCanvas);
|
||||
FreeAndNil(fTimer);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -232,7 +271,7 @@ end;
|
||||
procedure TCustomMPlayerControl.Play;
|
||||
var
|
||||
ExePath: String;
|
||||
CurWindowID: TXID;
|
||||
CurWindowID: int64;//TXID;
|
||||
begin
|
||||
if (csDesigning in ComponentState) then exit;
|
||||
|
||||
@ -243,27 +282,35 @@ begin
|
||||
|
||||
if Playing then exit;
|
||||
|
||||
{$IFDEF Linux}
|
||||
if (not HandleAllocated) then exit;
|
||||
DebugLn(['TCustomMPlayerControl.Play ']);
|
||||
{$endif}
|
||||
|
||||
if fPlayerProcess<>nil then
|
||||
raise Exception.Create('TCustomMPlayerControl.Play fPlayerProcess still exists');
|
||||
FreeAndNil(fPlayerProcess);
|
||||
// raise Exception.Create('TCustomMPlayerControl.Play fPlayerProcess still exists');
|
||||
|
||||
ExePath:=MPlayerPath;
|
||||
if not FilenameIsAbsolute(ExePath) then
|
||||
ExePath:=FindDefaultExecutablePath(ExePath);
|
||||
ExePath:=FindDefaultExecutablePath(ExePath);
|
||||
if not FileExistsUTF8(ExePath) then
|
||||
raise Exception.Create('mplayer not found');
|
||||
raise Exception.Create('mplayer not found');
|
||||
|
||||
CurWindowID := GDK_WINDOW_XWINDOW(PGtkWidget(PtrUInt(Handle))^.window);
|
||||
{$IFDEF Linux}
|
||||
CurWindowID := GDK_WINDOW_XWINDOW(PGtkWidget(PtrUInt(Handle))^.window);
|
||||
{$else}
|
||||
CurWindowID := Handle;
|
||||
{$ENDIF}
|
||||
|
||||
fPlayerProcess:=TProcessUTF8.Create(Self);
|
||||
fPlayerProcess.Options:=fPlayerProcess.Options+[poUsePipes,poNoConsole];
|
||||
fPlayerProcess.CommandLine:=ExePath+' -slave -quiet -wid '+IntToStr(CurWindowID)+' "'+Filename+'"';
|
||||
fPlayerProcess.CommandLine:=ExePath+' -slave -quiet -wid '+IntToStr(CurWindowID)+' '+StartParam+' "'+Filename+'"';
|
||||
DebugLn(['TCustomMPlayerControl.Play ',fPlayerProcess.CommandLine]);
|
||||
fPlayerProcess.Execute;
|
||||
|
||||
fPlayerProcess.Execute;
|
||||
fTimer.Enabled:=true;
|
||||
|
||||
end;
|
||||
|
||||
procedure TCustomMPlayerControl.Stop;
|
||||
@ -292,6 +339,7 @@ begin
|
||||
// everything is painted, so erasing the background is not needed
|
||||
end;
|
||||
|
||||
{$ifdef Linux}
|
||||
function MPLayerWidgetDestroyCB(Widget: PGtkWidget; data: gPointer): GBoolean; cdecl;
|
||||
begin
|
||||
FreeWidgetInfo(Widget); // created in TWSMPlayerControl.CreateHandle
|
||||
@ -348,5 +396,11 @@ initialization
|
||||
RegisterWSComponent(TCustomMPlayerControl,TWSMPlayerControl);
|
||||
{$I mplayerctrl.lrs}
|
||||
|
||||
{$else ifwindows}
|
||||
|
||||
initialization
|
||||
{$I mplayerctrl.lrs}
|
||||
|
||||
{$endif}
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user