-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainunit.pas
602 lines (473 loc) · 20 KB
/
mainunit.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
{.$DEFINE VLCLOG} // Log File in the same path as the EXE file, make sure you have write permissions in that folder before enabling.
//
// Released under the MPL 2.0 license.
//
// Code by Yaron Gur with contributions and support from Robert Jedrzejczyk
//
unit mainunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls, Menus, ComCtrls, SyncObjs,
PasLibVlcUnit, PasLibVlcClassUnit, PasLibVlcPlayerUnit, tntclasses;
type
TOptionsForm = class(TForm)
ScanButton: TButton;
SetOPVLCCastDeviceList: TListBox;
StopButton: TButton;
LabelDevices: TLabel;
LabelDebugLog: TLabel;
DebugLB: TListBox;
Label1: TLabel;
MediaFile: TEdit;
PlayButton: TButton;
PlayerPanel: TPanel;
OpenDialog: TOpenDialog;
BrowseButton: TButton;
procedure ScanButtonClick(Sender: TObject);
procedure StopButtonClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure PlayButtonClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure BrowseButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure VLCPlayerMediaPlayerMediaChanged(Sender: TObject; mrl: string);
procedure VLCPlayerMediaPlayerNothingSpecial(Sender: TObject);
procedure VLCPlayerMediaPlayerOpening(Sender: TObject);
procedure VLCPlayerMediaPlayerBuffering(Sender: TObject; val: Single);
procedure VLCPlayerMediaPlayerPlaying(Sender: TObject);
procedure VLCPlayerMediaPlayerPaused(Sender: TObject);
procedure VLCPlayerMediaPlayerStopped(Sender: TObject);
procedure VLCPlayerMediaPlayerForward(Sender: TObject);
procedure VLCPlayerMediaPlayerBackward(Sender: TObject);
procedure VLCPlayerMediaPlayerEndReached(Sender: TObject);
procedure VLCPlayerMediaPlayerEncounteredError(Sender: TObject);
procedure VLCPlayerMediaPlayerTimeChanged(Sender: TObject; time: Int64);
procedure VLCPlayerMediaPlayerPositionChanged(Sender: TObject; position: Single);
procedure VLCPlayerMediaPlayerSeekableChanged(Sender: TObject; val: Boolean);
procedure VLCPlayerMediaPlayerPausableChanged(Sender: TObject; val: Boolean);
procedure VLCPlayerMediaPlayerTitleChanged(Sender: TObject; title: Integer);
procedure VLCPlayerMediaPlayerSnapshotTaken(Sender: TObject; fileName: string);
procedure VLCPlayerMediaPlayerLengthChanged(Sender: TObject; time: Int64);
procedure VLCPlayerMediaPlayerVideoOutChanged(Sender: TObject; video_out: Integer);
procedure VLCPlayerMediaPlayerScrambledChanged(Sender: TObject; scrambled: Integer);
procedure VLCPlayerMediaPlayerCorked(Sender: TObject);
procedure VLCPlayerMediaPlayerUnCorked(Sender: TObject);
procedure VLCPlayerMediaPlayerMuted(Sender: TObject);
procedure VLCPlayerMediaPlayerUnMuted(Sender: TObject);
procedure VLCPlayerMediaPlayerAudioVolumeChanged(Sender: TObject; volume: Single);
procedure VLCPlayerMediaPlayerEsAdded(Sender: TObject; i_type: libvlc_track_type_t; i_id: Integer);
procedure VLCPlayerMediaPlayerEsDeleted(Sender: TObject; i_type: libvlc_track_type_t; i_id: Integer);
procedure VLCPlayerMediaPlayerEsSelected(Sender: TObject; i_type: libvlc_track_type_t; i_id: Integer);
procedure VLCPlayerMediaPlayerAudioDevice(Sender: TObject; audio_device: String);
procedure VLCPlayerMediaPlayerChapterChanged(Sender: TObject; chapter: Integer);
procedure VLCPlayerRendererDiscoveredItemAdded(Sender: TObject; item: libvlc_renderer_item_t_ptr);
procedure VLCPlayerRendererDiscoveredItemDeleted(Sender: TObject; item: libvlc_renderer_item_t_ptr);
function InitVLCInterface : Integer;
procedure ClearDeviceList;
procedure AddDebugMsg(S : Widestring);
end;
var
OptionsForm : TOptionsForm;
vlcDiscoverer : libvlc_renderer_discoverer_t_ptr = nil;
vlcDiscovererEventManager : libvlc_event_manager_t_ptr = nil;
vlcPlayer : TPasLibVlcPlayer = nil;
function UTF8StringToWideString(Const S : UTF8String) : WideString;
implementation
{$R *.dfm}
procedure TOptionsForm.AddDebugMsg(S : Widestring);
begin
DebugLB.Items.Add(S);
DebugLB.TopIndex := DebugLB.Items.Count-(DebugLB.ClientHeight div DebugLB.ItemHeight);
end;
procedure vlc_renderer_event_hdlr(p_event: libvlc_event_t_ptr; data: Pointer); cdecl;
var
I : Integer;
S : WideString;
begin
OptionsForm.AddDebugMsg('Event: Triggered');
If data = nil then
Begin
OptionsForm.AddDebugMsg('Event: Exit on No Data!');
exit;
End;
with p_event^ do
begin
case event_type of
libvlc_RendererDiscovererItemAdded :
Begin
// libvlc_renderer_item_name(item) - Should also work
OptionsForm.AddDebugMsg('Item added "'+UTF8StringToWideString(PAnsiChar(renderer_discoverer_item_added.item^))+'"');
OptionsForm.SetOPVLCCastDeviceList.Items.AddObject(UTF8StringToWideString(PAnsiChar(renderer_discoverer_item_added.item^)),libvlc_renderer_item_hold(renderer_discoverer_item_added.item));
End;
libvlc_RendererDiscovererItemDeleted :
Begin
S := UTF8StringToWideString(PAnsiChar(renderer_discoverer_item_deleted.item^));
For I := 0 to OptionsForm.SetOPVLCCastDeviceList.Items.Count-1 do
If OptionsForm.SetOPVLCCastDeviceList.Items[I] = S then
Begin
OptionsForm.AddDebugMsg('Item removed "'+S+'"');
OptionsForm.SetOPVLCCastDeviceList.Items.Delete(I);
Break;
End;
End;
End;
end;
end;
procedure TOptionsForm.ClearDeviceList;
var
I : Integer;
begin
If SetOPVLCCastDeviceList.Count > 0 then
Begin
// Free Device Hold
For I := 0 to SetOPVLCCastDeviceList.Count-1 do libvlc_renderer_item_release(SetOPVLCCastDeviceList.Items.Objects[I]);
SetOPVLCCastDeviceList.Clear;
End;
end;
procedure TOptionsForm.ScanButtonClick(Sender: TObject);
begin
ScanButton.Enabled := False;
AddDebugMsg('Starting Device Scanner');
ClearDeviceList;
If Assigned(VLCPlayer) then
Begin
AddDebugMsg('Log set');
// Create a new media discoverer for renderer discovery
vlcDiscoverer := libvlc_renderer_discoverer_new(VLCPlayer.VLC.Handle,'microdns_renderer');
If Assigned(vlcDiscoverer) then
begin
AddDebugMsg('Device Discoverer created at '+IntToHex(Integer(vlcDiscoverer),8));
vlcDiscovererEventManager := libvlc_renderer_discoverer_event_manager(vlcDiscoverer);
AddDebugMsg('Device list event manager created at '+IntToHex(Integer(vlcDiscovererEventManager),8));
// Attach event handlers
libvlc_event_attach(vlcDiscovererEventManager, libvlc_RendererDiscovererItemAdded , vlc_renderer_event_hdlr, self);
libvlc_event_attach(vlcDiscovererEventManager, libvlc_RendererDiscovererItemDeleted, vlc_renderer_event_hdlr, self);
AddDebugMsg('Events attached to Event Manager');
// Start discovery
libvlc_renderer_discoverer_start(vlcDiscoverer);
StopButton.Enabled := True;
AddDebugMsg('Device Scanner Started');
end;
End;
If StopButton.Enabled = False then ScanButton.Enabled := True;
end;
procedure TOptionsForm.StopButtonClick(Sender: TObject);
begin
StopButton.Enabled := False;
AddDebugMsg('Stopping Device Scanner');
vlcDiscovererEventManager := nil;
AddDebugMsg('Interfaces released');
libvlc_renderer_discoverer_release(vlcDiscoverer);
vlcDiscoverer := nil;
ScanButton.Enabled := True;
AddDebugMsg('Device Discovery stopped');
end;
procedure TOptionsForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
If StopButton.Enabled = True then
Begin
StopButtonClick(nil);
End;
ClearDeviceList;
If VLCPlayer <> nil then
Begin
FreeAndNil(VLCPlayer);
End;
end;
function UTF8StringToWideString(Const S : UTF8String) : WideString;
var
iLen :Integer;
sw :WideString;
begin
if Length(S) = 0 then
Begin
Result := '';
Exit;
End;
iLen := MultiByteToWideChar(CP_UTF8,0,PAnsiChar(s),-1,nil,0);
SetLength(sw,iLen);
MultiByteToWideChar(CP_UTF8,0,PAnsiChar(s),-1,PWideChar(sw),iLen);
iLen := Pos(#0,sw);
If iLen > 0 then SetLength(sw,iLen-1);
Result := sw;
end;
procedure TOptionsForm.PlayButtonClick(Sender: TObject);
var
p_li: libvlc_instance_t_ptr;
p_mp: libvlc_media_player_t_ptr;
p_md: libvlc_media_t_ptr;
S : AnsiString;
begin
If MediaFile.Text <> '' then
Begin
// Set casting device if selected
If (SetOPVLCCastDeviceList.ItemIndex > -1) and (SetOPVLCCastDeviceList.ItemIndex < SetOPVLCCastDeviceList.Count) then
Begin
AddDebugMsg('Setting cast device to "'+SetOPVLCCastDeviceList.Items[SetOPVLCCastDeviceList.ItemIndex]+'"');
// Set
If libvlc_media_player_set_renderer(VLCPlayer.GetPlayerHandle,SetOPVLCCastDeviceList.Items.Objects[SetOPVLCCastDeviceList.ItemIndex]) = -1 then
AddDebugMsg('Error setting casting') else
AddDebugMsg('Casting device set');
End;
// Start playing
VLCPlayer.Play('file:///'+MediaFile.Text);
End
Else AddDebugMsg('Pick a media file first');
end;
function TOptionsForm.InitVLCInterface : Integer;
begin
AddDebugMsg('InitVLCInterface (before)');
Result := S_OK;
Try
VLCPlayer := TPasLibVlcPlayer.Create(OptionsForm);
Except
On E : Exception do
Begin
AddDebugMsg('Create Exception "'+E.Message+'"');
Result := E_FAIL;
End;
End;
If Result = S_OK then
Begin
AddDebugMsg('VLC: Adding startup options');
//VLCPlayer.StartOptions.Add('--start-paused');
// Debug log to file
{$IFDEF VLCLOG}
VLCPlayer.StartOptions.Add('--file-logging');
VLCPlayer.StartOptions.Add('--logfile=.\vlc_debug_log.txt');
VLCPlayer.StartOptions.Add('--log-verbose=3');
AddDebugMsg('VLC: Debug log file enabled');
{$ENDIF}
With VLCPlayer do
Begin
OnMediaPlayerMediaChanged := OptionsForm.VLCPlayerMediaPlayerMediaChanged;
OnMediaPlayerNothingSpecial := OptionsForm.VLCPlayerMediaPlayerNothingSpecial;
OnMediaPlayerOpening := OptionsForm.VLCPlayerMediaPlayerOpening;
OnMediaPlayerBuffering := OptionsForm.VLCPlayerMediaPlayerBuffering;
OnMediaPlayerPlaying := OptionsForm.VLCPlayerMediaPlayerPlaying;
OnMediaPlayerPaused := OptionsForm.VLCPlayerMediaPlayerPaused;
OnMediaPlayerStopped := OptionsForm.VLCPlayerMediaPlayerStopped;
OnMediaPlayerForward := OptionsForm.VLCPlayerMediaPlayerForward;
OnMediaPlayerBackward := OptionsForm.VLCPlayerMediaPlayerBackward;
OnMediaPlayerEndReached := OptionsForm.VLCPlayerMediaPlayerEndReached;
OnMediaPlayerEncounteredError := OptionsForm.VLCPlayerMediaPlayerEncounteredError;
OnMediaPlayerTimeChanged := OptionsForm.VLCPlayerMediaPlayerTimeChanged;
OnMediaPlayerPositionChanged := OptionsForm.VLCPlayerMediaPlayerPositionChanged;
OnMediaPlayerSeekableChanged := OptionsForm.VLCPlayerMediaPlayerSeekableChanged;
OnMediaPlayerPausableChanged := OptionsForm.VLCPlayerMediaPlayerPausableChanged;
OnMediaPlayerTitleChanged := OptionsForm.VLCPlayerMediaPlayerTitleChanged;
OnMediaPlayerSnapshotTaken := OptionsForm.VLCPlayerMediaPlayerSnapshotTaken;
OnMediaPlayerLengthChanged := OptionsForm.VLCPlayerMediaPlayerLengthChanged;
OnMediaPlayerVideoOutChanged := OptionsForm.VLCPlayerMediaPlayerVideoOutChanged;
OnMediaPlayerScrambledChanged := OptionsForm.VLCPlayerMediaPlayerScrambledChanged;
OnMediaPlayerCorked := OptionsForm.VLCPlayerMediaPlayerCorked;
OnMediaPlayerUnCorked := OptionsForm.VLCPlayerMediaPlayerUnCorked;
OnMediaPlayerMuted := OptionsForm.VLCPlayerMediaPlayerMuted;
OnMediaPlayerUnMuted := OptionsForm.VLCPlayerMediaPlayerUnMuted;
OnMediaPlayerAudioVolumeChanged := OptionsForm.VLCPlayerMediaPlayerAudioVolumeChanged;
OnMediaPlayerEsAdded := OptionsForm.VLCPlayerMediaPlayerEsAdded;
OnMediaPlayerEsDeleted := OptionsForm.VLCPlayerMediaPlayerEsDeleted;
OnMediaPlayerEsSelected := OptionsForm.VLCPlayerMediaPlayerEsSelected;
OnMediaPlayerAudioDevice := OptionsForm.VLCPlayerMediaPlayerAudioDevice;
OnMediaPlayerChapterChanged := OptionsForm.VLCPlayerMediaPlayerChapterChanged;
OnRendererDiscoveredItemAdded := OptionsForm.VLCPlayerRendererDiscoveredItemAdded;
OnRendererDiscoveredItemDeleted := OptionsForm.VLCPlayerRendererDiscoveredItemDeleted;
MouseEventsHandler := mehComponent;
End;
VLCPlayer.SetBounds(0,0,PlayerPanel.ClientWidth,PlayerPanel.ClientHeight);
VLCPlayer.Parent := PlayerPanel;
End;
If libvlc_dynamic_dll_error <> '' then
Begin
AddDebugMsg('VLC DLL Error "'+libvlc_dynamic_dll_error+'"');
Result := E_FAIL;
End
Else AddDebugMsg('VLC DLL no error reported');
AddDebugMsg('InitVLCInterface (after)');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerMediaChanged(Sender: TObject; mrl: string);
begin
AddDebugMsg('VLC: MediaPlayerMediaChanged: ' + mrl);
//Caption := mrl;
end;
procedure TOptionsForm.VLCPlayerMediaPlayerNothingSpecial(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerNothingSpecial');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerOpening(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerOpening');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerBuffering(Sender: TObject; val: Single);
begin
AddDebugMsg('VLC: MediaPlayerBuffering: ' + IntToStr(Round(val)));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerPlaying(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerPlaying');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerPaused(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerPaused');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerStopped(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerStopped');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerForward(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerForward');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerBackward(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerBackward');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerEndReached(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerEndReached');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerEncounteredError(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerEncounteredError "'+UTF8StringToWideString(libvlc_errmsg)+'"');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerTimeChanged(Sender: TObject; time: Int64);
var
oldOnChange : TNotifyEvent;
begin
AddDebugMsg('VLC: MediaPlayerTimeChanged: ' + time2str(time));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerPositionChanged(Sender: TObject; position: Single);
begin
AddDebugMsg('VLC: MediaPlayerPositionChanged: ' + FloatToStr(position));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerSeekableChanged(Sender: TObject; val: Boolean);
begin
AddDebugMsg('VLC: MediaPlayerSeekableChanged: ' + IntToStr(Ord(val)));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerPausableChanged(Sender: TObject; val: Boolean);
begin
AddDebugMsg('VLC: MediaPlayerPausableChanged: ' + IntToStr(Ord(val)));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerTitleChanged(Sender: TObject; title: Integer);
begin
AddDebugMsg('VLC: MediaPlayerTitleChanged: ' + IntToStr(title));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerSnapshotTaken(Sender: TObject; fileName: string);
begin
AddDebugMsg('VLC: MediaPlayerSnapshotTaken: ' + fileName);
end;
procedure TOptionsForm.VLCPlayerMediaPlayerLengthChanged(Sender: TObject; time: Int64);
var
oldOnChange : TNotifyEvent;
begin
AddDebugMsg('VLC: MediaPlayerLengthChanged: ' + time2str(time));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerVideoOutChanged(Sender: TObject; video_out: Integer);
begin
AddDebugMsg('VLC: MediaPlayerVideoOutChanged: ' + IntToStr(video_out));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerScrambledChanged(Sender: TObject; scrambled: Integer);
begin
AddDebugMsg('VLC: MediaPlayerScrambledChanged: ' + IntToStr(scrambled));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerCorked(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerCorked');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerUnCorked(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerUnCorked');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerMuted(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerMuted');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerUnMuted(Sender: TObject);
begin
AddDebugMsg('VLC: MediaPlayerUnMuted');
end;
procedure TOptionsForm.VLCPlayerMediaPlayerAudioVolumeChanged(Sender: TObject; volume: Single);
var
newAudioVolume : string;
begin
AddDebugMsg('VLC: MediaPlayerAudioVolume: ' + FloatToStr(volume));
end;
procedure TOptionsForm.VLCPlayerMediaPlayerEsAdded(Sender: TObject; i_type: libvlc_track_type_t; i_id: Integer);
begin
case i_type of
libvlc_track_audio :
Begin
AddDebugMsg('VLC: MediaPlayerEsAdded (audio), id = ' + IntToStr(i_id));
End;
libvlc_track_video :
Begin
AddDebugMsg('VLC: MediaPlayerEsAdded (video), id = ' + IntToStr(i_id));
End;
libvlc_track_text :
Begin
AddDebugMsg('VLC: MediaPlayerEsAdded (text), id = ' + IntToStr(i_id));
End;
else // case-else
Begin
AddDebugMsg('VLC: MediaPlayerEsAdded (unknown), id = ' + IntToStr(i_id));
End;
end;
end;
procedure TOptionsForm.VLCPlayerMediaPlayerEsDeleted(Sender: TObject; i_type: libvlc_track_type_t; i_id: Integer);
begin
case i_type of
libvlc_track_audio : AddDebugMsg('VLC: PlayerEsDeleted (audio), id = ' + IntToStr(i_id));
libvlc_track_video : AddDebugMsg('VLC: PlayerEsDeleted (video), id = ' + IntToStr(i_id));
libvlc_track_text : AddDebugMsg('VLC: PlayerEsDeleted (text), id = ' + IntToStr(i_id));
else
AddDebugMsg('VLC: MediaPlayerEsDeleted (unknown), id = ' + IntToStr(i_id));
end;
end;
procedure TOptionsForm.VLCPlayerMediaPlayerEsSelected(Sender: TObject; i_type: libvlc_track_type_t; i_id: Integer);
begin
case i_type of
libvlc_track_audio : AddDebugMsg('VLC: PlayerEsSelected (audio), id = ' + IntToStr(i_id));
libvlc_track_video : AddDebugMsg('VLC: PlayerEsSelected (video), id = ' + IntToStr(i_id));
libvlc_track_text : AddDebugMsg('VLC: PlayerEsSelected (text), id = ' + IntToStr(i_id));
else AddDebugMsg('VLC: MediaPlayerEsSelected (unknown), id = ' + IntToStr(i_id));
end;
end;
procedure TOptionsForm.VLCPlayerMediaPlayerAudioDevice(Sender: TObject; audio_device: String);
begin
AddDebugMsg('VLC: MediaPlayerAudioDevice: ' + audio_device);
end;
procedure TOptionsForm.VLCPlayerMediaPlayerChapterChanged(Sender: TObject; chapter: Integer);
begin
AddDebugMsg('VLC: MediaPlayerChapterChanged: ' + IntToStr(chapter));
end;
procedure TOptionsForm.VLCPlayerRendererDiscoveredItemAdded(Sender: TObject; item: libvlc_renderer_item_t_ptr);
begin
AddDebugMsg('VLC: RendererDiscoveredItemAdded');
end;
procedure TOptionsForm.VLCPlayerRendererDiscoveredItemDeleted(Sender: TObject; item: libvlc_renderer_item_t_ptr);
begin
AddDebugMsg('VLC: RendererDiscoveredItemDeleted');
end;
procedure TOptionsForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
If Key = #27 then
Begin
Key := #0;
Close;
End;
end;
procedure TOptionsForm.BrowseButtonClick(Sender: TObject);
begin
If OpenDialog.Execute = True then
MediaFile.Text := OpenDialog.FileName;
end;
procedure TOptionsForm.FormCreate(Sender: TObject);
begin
InitVLCInterface;
end;
end.