Стартовый пул
This commit is contained in:
40
PasLibVlc/Delphi4/DemoPasLibVlc/DemoPasLibVlc.dpr
Normal file
40
PasLibVlc/Delphi4/DemoPasLibVlc/DemoPasLibVlc.dpr
Normal file
@@ -0,0 +1,40 @@
|
||||
(*
|
||||
* 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,
|
||||
MainFormUnit in 'MainFormUnit.pas' {MainForm},
|
||||
PasLibVlcUnit in '..\..\source\PasLibVlcUnit.pas';
|
||||
|
||||
{$R *.RES}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.Title := 'DemoPasLibVlc';
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
BIN
PasLibVlc/Delphi4/DemoPasLibVlc/MainFormUnit.dfm
Normal file
BIN
PasLibVlc/Delphi4/DemoPasLibVlc/MainFormUnit.dfm
Normal file
Binary file not shown.
181
PasLibVlc/Delphi4/DemoPasLibVlc/MainFormUnit.pas
Normal file
181
PasLibVlc/Delphi4/DemoPasLibVlc/MainFormUnit.pas
Normal file
@@ -0,0 +1,181 @@
|
||||
(*
|
||||
* 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
|
||||
Windows,
|
||||
Messages, SysUtils, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ExtCtrls, Menus,
|
||||
PasLibVlcUnit;
|
||||
|
||||
const
|
||||
MAX_ARGS = 255;
|
||||
|
||||
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 FormDestroy(Sender: TObject);
|
||||
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();
|
||||
|
||||
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_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);
|
||||
Sleep(50);
|
||||
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.FormCreate(Sender: TObject);
|
||||
begin
|
||||
p_li := NIL;
|
||||
p_mi := NIL;
|
||||
PlayerInit();
|
||||
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.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
PlayerDestroy();
|
||||
end;
|
||||
|
||||
procedure TMainForm.MenuFileOpenClick(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog.Execute() then
|
||||
begin
|
||||
PlayerPlay(OpenDialog.FileName);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.MenuFileQuitClick(Sender: TObject);
|
||||
begin
|
||||
Close();
|
||||
end;
|
||||
|
||||
end.
|
@@ -0,0 +1,41 @@
|
||||
(*
|
||||
* 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 DemoPasLibVlcPlayer;
|
||||
|
||||
uses
|
||||
Forms,
|
||||
MainFormUnit in 'MainFormUnit.pas' {MainForm},
|
||||
PasLibVlcUnit in '..\..\source\PasLibVlcUnit.pas',
|
||||
PasLibVlcClassUnit in '..\..\source\PasLibVlcClassUnit.pas',
|
||||
PasLibVlcPlayerUnit in '..\..\source.vcl\PasLibVlcPlayerUnit.pas';
|
||||
|
||||
{$R *.RES}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
BIN
PasLibVlc/Delphi4/DemoPasLibVlcPlayer/MainFormUnit.dfm
Normal file
BIN
PasLibVlc/Delphi4/DemoPasLibVlcPlayer/MainFormUnit.dfm
Normal file
Binary file not shown.
89
PasLibVlc/Delphi4/DemoPasLibVlcPlayer/MainFormUnit.pas
Normal file
89
PasLibVlc/Delphi4/DemoPasLibVlcPlayer/MainFormUnit.pas
Normal file
@@ -0,0 +1,89 @@
|
||||
(*
|
||||
* 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
|
||||
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||
Menus, ExtCtrls, PasLibVlcUnit, PasLibVlcPlayerUnit;
|
||||
|
||||
type
|
||||
TMainForm = class(TForm)
|
||||
MainMenu: TMainMenu;
|
||||
MenuFile: TMenuItem;
|
||||
MenuFileOpen: TMenuItem;
|
||||
MenuFileQuit: TMenuItem;
|
||||
OpenDialog: TOpenDialog;
|
||||
PasLibVlcPlayer: TPasLibVlcPlayer;
|
||||
procedure MenuFileQuitClick(Sender: TObject);
|
||||
procedure MenuFileOpenClick(Sender: TObject);
|
||||
procedure PasLibVlcPlayerMediaPlayerMediaChanged(Sender: TObject;
|
||||
mrl: String);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.DFM}
|
||||
|
||||
procedure TMainForm.MenuFileQuitClick(Sender: TObject);
|
||||
begin
|
||||
Close();
|
||||
end;
|
||||
|
||||
procedure TMainForm.MenuFileOpenClick(Sender: TObject);
|
||||
var
|
||||
logo_file_1 : string;
|
||||
logo_file_2 : string;
|
||||
begin
|
||||
if OpenDialog.Execute() then
|
||||
begin
|
||||
PasLibVlcPlayer.Play(OpenDialog.FileName);
|
||||
|
||||
logo_file_1 := ExtractFilePath(Application.ExeName) + 'logo1.png';
|
||||
logo_file_2 := ExtractFilePath(Application.ExeName) + 'logo2.png';
|
||||
if (FileExists(logo_file_1) and FileExists(logo_file_2)) then
|
||||
begin
|
||||
PasLibVlcPlayer.LogoShowFiles([logo_file_1, logo_file_2], libvlc_position_top);
|
||||
end;
|
||||
PasLibVlcPlayer.MarqueeShowText('marquee test %H:%M:%S', libvlc_position_bottom);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.PasLibVlcPlayerMediaPlayerMediaChanged(Sender: TObject;
|
||||
mrl: String);
|
||||
begin
|
||||
Caption := mrl;
|
||||
end;
|
||||
|
||||
end.
|
26
PasLibVlc/Delphi4/PasLibVlc.bpg
Normal file
26
PasLibVlc/Delphi4/PasLibVlc.bpg
Normal file
@@ -0,0 +1,26 @@
|
||||
#------------------------------------------------------------------------------
|
||||
VERSION = BWS.01
|
||||
#------------------------------------------------------------------------------
|
||||
!ifndef ROOT
|
||||
ROOT = $(MAKEDIR)\..
|
||||
!endif
|
||||
#------------------------------------------------------------------------------
|
||||
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
|
||||
DCC = $(ROOT)\bin\dcc32.exe $**
|
||||
BRCC = $(ROOT)\bin\brcc32.exe $**
|
||||
#------------------------------------------------------------------------------
|
||||
PROJECTS = PasLibVlcPlayer.bpl DemoPasLibVlc.exe DemoPasLibVlcPlayer.exe
|
||||
#------------------------------------------------------------------------------
|
||||
default: $(PROJECTS)
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
DemoPasLibVlc.exe: DemoPasLibVlc\DemoPasLibVlc.dpr
|
||||
$(DCC)
|
||||
|
||||
DemoPasLibVlcPlayer.exe: DemoPasLibVlcPlayer\DemoPasLibVlcPlayer.dpr
|
||||
$(DCC)
|
||||
|
||||
PasLibVlcPlayer.bpl: PasLibVlcPlayer.dpk
|
||||
$(DCC)
|
||||
|
||||
|
37
PasLibVlc/Delphi4/PasLibVlcPlayer.dpk
Normal file
37
PasLibVlc/Delphi4/PasLibVlcPlayer.dpk
Normal file
@@ -0,0 +1,37 @@
|
||||
package PasLibVlcPlayer;
|
||||
|
||||
{$R *.RES}
|
||||
{$ALIGN ON}
|
||||
{$ASSERTIONS OFF}
|
||||
{$BOOLEVAL OFF}
|
||||
{$DEBUGINFO OFF}
|
||||
{$EXTENDEDSYNTAX ON}
|
||||
{$IMPORTEDDATA ON}
|
||||
{$IOCHECKS ON}
|
||||
{$LOCALSYMBOLS OFF}
|
||||
{$LONGSTRINGS ON}
|
||||
{$OPENSTRINGS ON}
|
||||
{$OPTIMIZATION ON}
|
||||
{$OVERFLOWCHECKS OFF}
|
||||
{$RANGECHECKS OFF}
|
||||
{$REFERENCEINFO OFF}
|
||||
{$SAFEDIVIDE OFF}
|
||||
{$STACKFRAMES OFF}
|
||||
{$TYPEDADDRESS OFF}
|
||||
{$VARSTRINGCHECKS ON}
|
||||
{$WRITEABLECONST OFF}
|
||||
{$MINENUMSIZE 4}
|
||||
{$IMAGEBASE $00400000}
|
||||
{$DESCRIPTION 'PasLibVlcPlayer design time package'}
|
||||
{$IMPLICITBUILD ON}
|
||||
{$DEFINE RELEASE}
|
||||
|
||||
requires
|
||||
vcl40;
|
||||
|
||||
contains
|
||||
PasLibVlcUnit in '..\source\PasLibVlcUnit.pas',
|
||||
PasLibVlcClassUnit in '..\source\PasLibVlcClassUnit.pas',
|
||||
PasLibVlcPlayerUnit in '..\source.vcl\PasLibVlcPlayerUnit.pas';
|
||||
|
||||
end.
|
Reference in New Issue
Block a user