-
Notifications
You must be signed in to change notification settings - Fork 5
/
VLCInstance.pas
58 lines (49 loc) · 1.02 KB
/
VLCInstance.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit VLCInstance;
interface
uses
System.SysUtils, System.Classes, PasLibVlcUnit;
type
TVLCInstance = class(TComponent)
private
bInitSuccedd: boolean;
protected
{ Protected declarations }
public
VLCInstance: libvlc_instance_t_ptr;
procedure initVLC;
procedure destroyVLC;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('VLCMonkey', [TVLCInstance]);
end;
procedure TVLCInstance.initVLC;
var
vlcargs : array[0..0] of PAnsiChar;
begin
if VLCInstance <> nil then exit;
if not bInitSuccedd then
begin
libvlc_dynamic_dll_init();
vlcargs[0] := PAnsiChar(libvlc_dynamic_dll_path);
// args[2] := nil;
VLCInstance := libvlc_new(Length(vlcargs), @vlcargs);
bInitSuccedd := true;
end;
end;
procedure TVLCInstance.destroyVLC;
begin
if (Assigned(libvlc_release)) then
begin
if (VLCInstance <> NIL) then
begin
libvlc_release(VLCInstance);
end;
end;
libvlc_dynamic_dll_done();
end;
end.