Стартовый пул
This commit is contained in:
49
PasLibVlc/Delphi2007/DemoPasLibVlc/DemoPasLibVlc.dpr
Normal file
49
PasLibVlc/Delphi2007/DemoPasLibVlc/DemoPasLibVlc.dpr
Normal file
@@ -0,0 +1,49 @@
|
||||
(*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Any non-GPL usage of this software or parts of this software is strictly
|
||||
* forbidden.
|
||||
*
|
||||
* The "appropriate copyright message" mentioned in section 2c of the GPLv2
|
||||
* must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
|
||||
*
|
||||
*)
|
||||
|
||||
{$I ..\..\source\compiler.inc}
|
||||
|
||||
program DemoPasLibVlc;
|
||||
|
||||
uses
|
||||
Forms,
|
||||
PasLibVlcUnit in '..\..\source\PasLibVlcUnit.pas',
|
||||
PasLibVlcClassUnit in '..\..\source\PasLibVlcClassUnit.pas',
|
||||
PasLibVlcPlayerUnit in '..\..\source.vcl\PasLibVlcPlayerUnit.pas',
|
||||
MainFormUnit in 'MainFormUnit.pas' {MainForm};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
{$IFDEF DELPHI2007_UP}
|
||||
ReportMemoryLeaksOnShutdown := TRUE;
|
||||
{$ENDIF}
|
||||
|
||||
Application.Initialize;
|
||||
{$IFDEF DELPHI2007_UP}
|
||||
Application.MainFormOnTaskbar := True;
|
||||
{$ENDIF}
|
||||
Application.Title := 'PasLibVlcDemo' + ' - ' + {$IFDEF CPUX64}'64'{$ELSE}'32'{$ENDIF} + ' bit';
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
54
PasLibVlc/Delphi2007/DemoPasLibVlc/DemoPasLibVlc.dproj
Normal file
54
PasLibVlc/Delphi2007/DemoPasLibVlc/DemoPasLibVlc.dproj
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{8da1e076-0f08-4057-b905-f843d99de2ee}</ProjectGuid>
|
||||
<MainSource>DemoPasLibVlc.dpr</MainSource>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
|
||||
<DCC_DependencyCheckOutputName>DemoPasLibVlc.exe</DCC_DependencyCheckOutputName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Version>7.0</Version>
|
||||
<DCC_DebugInformation>False</DCC_DebugInformation>
|
||||
<DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_Define>RELEASE</DCC_Define>
|
||||
<DCC_UnitSearchPath>.\..\..\source\;.\..\..\source.vcl\</DCC_UnitSearchPath>
|
||||
<DCC_ResourcePath>.\..\..\source\;.\..\..\source.vcl\</DCC_ResourcePath>
|
||||
<DCC_ObjPath>.\..\..\source\;.\..\..\source.vcl\</DCC_ObjPath>
|
||||
<DCC_IncludePath>.\..\..\source\;.\..\..\source.vcl\</DCC_IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Version>7.0</Version>
|
||||
<DCC_Define>DEBUG</DCC_Define>
|
||||
<DCC_UnitSearchPath>.\..\..\source\;.\..\..\source.vcl\</DCC_UnitSearchPath>
|
||||
<DCC_ResourcePath>.\..\..\source\;.\..\..\source.vcl\</DCC_ResourcePath>
|
||||
<DCC_ObjPath>.\..\..\source\;.\..\..\source.vcl\</DCC_ObjPath>
|
||||
<DCC_IncludePath>.\..\..\source\;.\..\..\source.vcl\</DCC_IncludePath>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality</Borland.Personality>
|
||||
<Borland.ProjectType>VCLApplication</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1033</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Robert Jędrzejczyk</VersionInfoKeys><VersionInfoKeys Name="FileDescription">DemoPasLibVlc</VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName">DemoPasLibVlc</VersionInfoKeys><VersionInfoKeys Name="LegalCopyright">Robert Jędrzejczyk</VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks">Robert Jędrzejczyk</VersionInfoKeys><VersionInfoKeys Name="OriginalFilename">DemoPasLibVlc</VersionInfoKeys><VersionInfoKeys Name="ProductName">DemoPasLibVlc</VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments">robert@prog.olsztyn.pl</VersionInfoKeys></VersionInfoKeys><Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDS)\bin\dcloffice2k100.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDS)\bin\dclofficexp100.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
</Excluded_Packages><Source><Source Name="MainSource">DemoPasLibVlc.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="DemoPasLibVlc.dpr">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="..\..\source.vcl\PasLibVlcPlayerUnit.pas" />
|
||||
<DCCReference Include="..\..\source.vc\PasLibVlcPlayerUnit.pas" />
|
||||
<DCCReference Include="..\..\source.v\PasLibVlcPlayerUnit.pas" />
|
||||
<DCCReference Include="..\..\source\PasLibVlcClassUnit.pas" />
|
||||
<DCCReference Include="..\..\source\PasLibVlcPlayerUnit.pas" />
|
||||
<DCCReference Include="..\..\source\PasLibVlcUnit.pas" />
|
||||
<DCCReference Include="MainFormUnit.pas">
|
||||
<Form>MainForm</Form>
|
||||
</DCCReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
43
PasLibVlc/Delphi2007/DemoPasLibVlc/MainFormUnit.dfm
Normal file
43
PasLibVlc/Delphi2007/DemoPasLibVlc/MainFormUnit.dfm
Normal file
@@ -0,0 +1,43 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
Caption = 'libvlc demo'
|
||||
ClientHeight = 453
|
||||
ClientWidth = 632
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Menu = MainMenu
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object OpenDialog: TOpenDialog
|
||||
DefaultExt = '*.*'
|
||||
Title = 'Select file to play'
|
||||
Left = 8
|
||||
Top = 12
|
||||
end
|
||||
object MainMenu: TMainMenu
|
||||
Left = 44
|
||||
Top = 12
|
||||
object MenuFile: TMenuItem
|
||||
Caption = 'File'
|
||||
object MenuFileOpen: TMenuItem
|
||||
Caption = 'Open'
|
||||
ShortCut = 16463
|
||||
OnClick = MenuFileOpenClick
|
||||
end
|
||||
object MenuFileQuit: TMenuItem
|
||||
Caption = 'Quit'
|
||||
ShortCut = 16465
|
||||
OnClick = MenuFileQuitClick
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
186
PasLibVlc/Delphi2007/DemoPasLibVlc/MainFormUnit.pas
Normal file
186
PasLibVlc/Delphi2007/DemoPasLibVlc/MainFormUnit.pas
Normal file
@@ -0,0 +1,186 @@
|
||||
(*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Any non-GPL usage of this software or parts of this software is strictly
|
||||
* forbidden.
|
||||
*
|
||||
* The "appropriate copyright message" mentioned in section 2c of the GPLv2
|
||||
* must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
|
||||
*
|
||||
*)
|
||||
|
||||
{$I ..\..\source\compiler.inc}
|
||||
|
||||
unit MainFormUnit;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}Unix,{$ENDIF}
|
||||
{$IFDEF MSWINDOWS}Windows,{$ENDIF}
|
||||
{$IFDEF LCLGTK2}Gtk2, {$IFDEF UNIX}Gdk2x,{$ENDIF}{$ENDIF}
|
||||
{$IFDEF LCLQT}Qt4, QtWidgets, {$ENDIF}
|
||||
Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ExtCtrls, Menus,
|
||||
PasLibVlcUnit;
|
||||
|
||||
type
|
||||
TMainForm = class(TForm)
|
||||
OpenDialog: TOpenDialog;
|
||||
MainMenu: TMainMenu;
|
||||
MenuFile: TMenuItem;
|
||||
MenuFileOpen: TMenuItem;
|
||||
MenuFileQuit: TMenuItem;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure MenuFileOpenClick(Sender: TObject);
|
||||
procedure MenuFileQuitClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
private
|
||||
p_li : libvlc_instance_t_ptr;
|
||||
p_mi : libvlc_media_player_t_ptr;
|
||||
procedure PlayerInit();
|
||||
procedure PlayerPlay(fileName: WideString);
|
||||
procedure PlayerStop();
|
||||
procedure PlayerDestroy();
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TMainForm.PlayerInit();
|
||||
begin
|
||||
// libvlc_dynamic_dll_init_with_path('C:\Program Files\VideoLAN\VLC');
|
||||
libvlc_dynamic_dll_init();
|
||||
|
||||
if (libvlc_dynamic_dll_error <> '') then
|
||||
begin
|
||||
MessageDlg(libvlc_dynamic_dll_error, mtError, [mbOK], 0);
|
||||
Application.Terminate();
|
||||
exit;
|
||||
end;
|
||||
|
||||
with TArgcArgs.Create([
|
||||
libvlc_dynamic_dll_path,
|
||||
'--intf=dummy',
|
||||
'--ignore-config',
|
||||
'--quiet',
|
||||
'--no-video-title-show',
|
||||
'--no-video-on-top'
|
||||
]) do
|
||||
begin
|
||||
p_li := libvlc_new(ARGC, ARGS);
|
||||
Free;
|
||||
end;
|
||||
|
||||
if (p_li <> NIL) then
|
||||
begin
|
||||
p_mi := libvlc_media_player_new(p_li);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.PlayerPlay(fileName: WideString);
|
||||
var
|
||||
p_md : libvlc_media_t_ptr;
|
||||
begin
|
||||
if (p_li <> NIL) then
|
||||
begin
|
||||
p_md := libvlc_media_new_path(p_li, PAnsiChar(UTF8Encode(fileName)));
|
||||
if (p_md <> NIL) then
|
||||
begin
|
||||
if (p_mi <> NIL) then
|
||||
begin
|
||||
//libvlc_video_set_key_input(p_mi, 1);
|
||||
//libvlc_video_set_mouse_input(p_mi, 1);
|
||||
libvlc_media_player_set_display_window(p_mi, SELF.Handle);
|
||||
libvlc_media_player_set_media(p_mi, p_md);
|
||||
libvlc_media_player_play(p_mi);
|
||||
end;
|
||||
libvlc_media_release(p_md);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.PlayerStop();
|
||||
begin
|
||||
if (p_mi <> NIL) then
|
||||
begin
|
||||
if (libvlc_media_player_is_playing(p_mi) = 1) then
|
||||
begin
|
||||
libvlc_media_player_stop(p_mi);
|
||||
while (libvlc_media_player_is_playing(p_mi) = 1) do
|
||||
begin
|
||||
Sleep(50);
|
||||
end;
|
||||
end;
|
||||
libvlc_media_player_release(p_mi);
|
||||
p_mi := NIL;
|
||||
Sleep(50);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.PlayerDestroy();
|
||||
begin
|
||||
if (p_li <> NIL) then
|
||||
begin
|
||||
PlayerStop();
|
||||
libvlc_release(p_li);
|
||||
p_li := NIL;
|
||||
end;
|
||||
libvlc_dynamic_dll_done();
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
PlayerDestroy();
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
p_li := NIL;
|
||||
p_mi := NIL;
|
||||
PlayerInit();
|
||||
Caption := Caption + ' - ' + {$IFDEF CPUX64}'64'{$ELSE}'32'{$ENDIF} + ' bit';
|
||||
if (libvlc_dynamic_dll_error = '') then
|
||||
begin
|
||||
Caption := Caption + ', libvlc: ' + libvlc_dynamic_dll_vlc_version_str;
|
||||
if (ParamStr(1) <> '') then
|
||||
begin
|
||||
PlayerPlay(ParamStr(1));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.MenuFileOpenClick(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog.Execute(SELF.Handle) then
|
||||
begin
|
||||
PlayerPlay(OpenDialog.FileName);
|
||||
OpenDialog.InitialDir := ExtractFilePath(OpenDialog.FileName);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.MenuFileQuitClick(Sender: TObject);
|
||||
begin
|
||||
Close();
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user