forked from hkociemba/CubeExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DSPack.pas
5947 lines (5369 loc) · 221 KB
/
DSPack.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
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(*********************************************************************
* DSPack 2.3.3 *
* *
* home page : http://www.progdigy.com *
* email : [email protected] *
* Thanks to Michael Andersen. (DSVideoWindowEx) *
* *
* date : 2003-09-08 *
* *
* The contents of this file are used with permission, subject to *
* the Mozilla Public License Version 1.1 (the "License"); you may *
* not use this file except in compliance with the License. You may *
* obtain a copy of the License at *
* http://www.mozilla.org/MPL/MPL-1.1.html *
* *
* Software distributed under the License is distributed on an *
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or *
* implied. See the License for the specific language governing *
* rights and limitations under the License. *
* *
* Contributor(s) *
* Peter J. Haas <[email protected]> *
* Andriy Nevhasymyy <[email protected]> *
* Milenko Mitrovic <[email protected]> *
* Michael Andersen <[email protected]> *
* Martin Offenwanger <[email protected]> *
* *
*********************************************************************)
{
@abstract(DSPack Components.)
@author(Henri Gourvest: [email protected])
@created(Mar 14, 2002)
@lastmod(Oct 24, 2003)
}
{$I jedi.inc}
{$IFDEF COMPILER6_UP}
{$WARN SYMBOL_DEPRECATED OFF}
{$ENDIF}
{$IFDEF COMPILER7_UP}
{$WARN SYMBOL_DEPRECATED OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CAST OFF}
{$ENDIF}
{$ALIGN ON}
{$MINENUMSIZE 4}
unit DSPack;
interface
uses
Windows, Classes, SysUtils, Messages, Graphics, Forms, Controls, ActiveX, DirectShow9,
DirectDraw, DSUtil, ComCtrls, MMSystem, Math, Consts, ExtCtrls,
MultiMon, Dialogs, Registry, SyncObjs, Direct3D9, WMF9;
const
{ Filter Graph message identifier. }
WM_GRAPHNOTIFY = WM_APP + 1;
{ Sample Grabber message identifier. }
WM_CAPTURE_BITMAP = WM_APP + 2;
type
{ Video mode to use with @link(TVideoWindow). }
TVideoMode = (
vmNormal,
vmVMR
);
{ Graph Mode to use with @link(TFilterGraph).}
TGraphMode = (
gmNormal,
gmCapture,
gmDVD
);
{ Render device returned by then OnGraphVMRRenderDevice event. }
{$IFDEF VER140}
TVMRRenderDevice = (
rdOverlay = 1,
rdVidMem = 2,
rdSysMem = 4
);
{$ELSE}
TVMRRenderDevice = Integer;
const
rdOverlay = 1;
rdVidMem = 2;
rdSysMem = 4;
type
{$ENDIF}
{@exclude}
TGraphState = (
gsUninitialized,
gsStopped,
gsPaused,
gsPlaying
);
{ Specifies the seeking capabilities of a media stream. }
TSeekingCap = (
CanSeekAbsolute, // The stream can seek to an absolute position.
CanSeekForwards, // The stream can seek forward.
CanSeekBackwards, // The stream can seek backward.
CanGetCurrentPos, // The stream can report its current position.
CanGetStopPos, // The stream can report its stop position.
CanGetDuration, // The stream can report its duration.
CanPlayBackwards, // The stream can play backward.
CanDoSegments, // The stream can do seamless looping (see IMediaSeeking.SetPositions).
Source // Reserved.
);
{ Specifies the seeking capabilities of a media stream. }
TSeekingCaps = set of TSeekingCap;
{ Video Mixer Render Preferences: <br>
<b>vpForceOffscreen:</b> Indicates that the VMR should use only offscreen surfaces for rendering.<br>
<b>vpForceOverlays:</b> Indicates that the VMR should fail if no overlay surfaces are available.<br>
<b>vpForceMixer:</b> Indicates that the VMR must use Mixer when the number of streams is 1.<br>
<b>vpDoNotRenderColorKeyAndBorder:</b> Indicates that the application is responsible for painting the color keys.<br>
<b>vpRestrictToInitialMonitor:</b> Indicates that the VMR should output only to the initial monitor.<br>
<b>vpPreferAGPMemWhenMixing:</b> Indicates that the VMR should attempt to use AGP memory when allocating texture surfaces.}
TVMRPreference = (
vpForceOffscreen,
vpForceOverlays,
vpForceMixer,
vpDoNotRenderColorKeyAndBorder,
vpRestrictToInitialMonitor,
vpPreferAGPMemWhenMixing
);
{ Pointer to @link(TVMRPreferences).}
PVMRPreferences = ^TVMRPreferences;
{ Set of @link(TVMRPreference).}
TVMRPreferences = set of TVMRPreference;
TOnDSEvent = procedure(sender: TComponent; Event, Param1, Param2: Integer) of object;
{@exclude}
TOnGraphBufferingData = procedure(sender: TObject; Buffering: boolean) of object ; {@exclude}
TOnGraphComplete = procedure(sender: TObject; Result: HRESULT; Renderer: IBaseFilter) of object ; {@exclude}
TOnGraphDeviceLost = procedure(sender: TObject; Device: IUnknown; Removed: Boolean) of object ; {@exclude}
TOnGraphEndOfSegment = procedure(sender: TObject; StreamTime: TReferenceTime; NumSegment: Cardinal) of object ; {@exclude}
TOnDSResult = procedure(sender: TObject; Result: HRESULT) of object ; {@exclude}
TOnGraphFullscreenLost = procedure(sender: TObject; Renderer: IBaseFilter) of object ; {@exclude}
TOnGraphOleEvent = procedure(sender: TObject; String1, String2: WideString) of object ; {@exclude}
TOnGraphOpeningFile = procedure(sender: TObject; opening: boolean) of object ; {@exclude}
TOnGraphSNDDevError = procedure(sender: TObject; OccurWhen: TSndDevErr; ErrorCode: LongWord) of object ; {@exclude}
TOnGraphStreamControl = procedure(sender: TObject; PinSender: IPin; Cookie: LongWord) of object ; {@exclude}
TOnGraphStreamError = procedure(sender: TObject; Operation: HRESULT; Value: LongWord) of object ; {@exclude}
TOnGraphVideoSizeChanged = procedure(sender: TObject; Width, height: word) of object ; {@exclude}
TOnGraphTimeCodeAvailable = procedure(sender: TObject; From: IBaseFilter; DeviceID: LongWord) of object ; {@exclude}
TOnGraphEXTDeviceModeChange = procedure(sender: TObject; NewMode, DeviceID: LongWord) of object ; {@exclude}
TOnGraphVMRRenderDevice = procedure(sender: TObject; RenderDevice: TVMRRenderDevice) of object;
{@exclude}
TOnDVDAudioStreamChange = procedure(sender: TObject; stream, lcid: Integer; Lang: string) of object; {@exclude}
TOnDVDCurrentTime = procedure(sender: TObject; Hours, minutes,seconds,frames,frate : Integer) of object; {@exclude}
TOnDVDTitleChange = procedure(sender: TObject; title: Integer) of object; {@exclude}
TOnDVDChapterStart = procedure(sender: TObject; chapter: Integer) of object; {@exclude}
TOnDVDValidUOPSChange = procedure(sender: TObject; UOPS: Integer) of object; {@exclude}
TOnDVDChange = procedure(sender: TObject; total,current: Integer) of object; {@exclude}
TOnDVDStillOn = procedure(sender: TObject; NoButtonAvailable: boolean; seconds: Integer) of object; {@exclude}
TOnDVDSubpictureStreamChange = procedure(sender: TObject; SubNum, lcid: Integer; Lang: string) of object; {@exclude}
TOnDVDPlaybackRateChange = procedure(sender: TObject; rate: single) of object; {@exclude}
TOnDVDParentalLevelChange = procedure(sender: TObject; level: Integer) of object; {@exclude}
TOnDVDAnglesAvailable = procedure(sender: TObject; available: boolean) of object; {@exclude}
TOnDVDButtonAutoActivated = procedure(sender: TObject; Button: Cardinal) of object; {@exclude}
TOnDVDCMD = procedure(sender: TObject; CmdID: Cardinal) of object; {@exclude}
TOnDVDCurrentHMSFTime = procedure(sender: TObject; HMSFTimeCode: TDVDHMSFTimeCode; TimeCode: TDVDTimeCode) of object; {@exclude}
TOnDVDKaraokeMode = procedure(sender: TObject; Played: boolean) of object;
{@exclude}
TOnBuffer = procedure(sender: TObject; SampleTime: Double; pBuffer: Pointer; BufferLen: longint) of object ;
TOnSelectedFilter = function (Moniker: IMoniker; FilterName: WideString; ClassID: TGuid): Boolean of Object;
TOnCreatedFilter = function (Filter: IBaseFilter; ClassID: TGuid): Boolean of Object;
TOnUnableToRender = function (Pin: IPin): Boolean of Object;
// *****************************************************************************
// IFilter
// *****************************************************************************
{@exclude}
TFilterOperation = (
foAdding, // Before the filter is added to graph.
foAdded, // After the filter is added to graph.
foRemoving, // Before the filter is removed from graph.
foRemoved, // After the filter is removed from graph.
foRefresh // Designer notification to Refresh the filter .
);
{@exclude}
IFilter = interface
['{887F94DA-29E9-44C6-B48E-1FBF0FB59878}']
{ Return the IBaseFilter Interface (All DirectShow filters expose this interface). }
function GetFilter: IBaseFilter;
{ Return the filter name (generally the component name). }
function GetName: string;
{ Called by the @link(TFilterGraph) component, this method receive notifications
on what the TFilterGraph is doing. if Operation = foGraphEvent then Param is the
event code received by the FilterGraph.}
procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0);
end;
{@exclude}
TControlEvent = (
cePlay,
cePause,
ceStop,
ceFileRendering,
ceFileRendered,
ceDVDRendering,
ceDVDRendered,
ceActive
);
{@exclude}
IEvent = interface
['{6C0DCD7B-1A98-44EF-A6D5-E23CBC24E620}']
{ FilterGraph events. }
procedure GraphEvent(Event, Param1, Param2: integer);
{ Control Events. }
procedure ControlEvent(Event: TControlEvent; Param: integer = 0);
end;
// *****************************************************************************
// TFilterGraph
// *****************************************************************************
{ This component is the central component in DirectShow, the Filter Graph
handle synchronization, event notification, and other aspects of the
controlling the filter graph. }
TFilterGraph = class(TComponent, IAMGraphBuilderCallback, IAMFilterGraphCallback,
IServiceProvider)
private
FActive : boolean;
FAutoCreate : boolean;
FHandle : THandle; // to capture events
FMode : TGraphMode;
FVolume : integer;
FBalance : integer;
FRate : Double;
FLinearVolume : Boolean;
FFilters: TInterfaceList;
FGraphEvents: TInterfaceList;
// builders
FFilterGraph : IGraphBuilder;
FCaptureGraph : ICaptureGraphBuilder2;
FDVDGraph : IDvdGraphBuilder;
// events interface
FMediaEventEx : IMediaEventEx;
// Graphedit
FGraphEdit : boolean;
FGraphEditID : Integer;
// Log File
FLogFileName: String;
FLogFile: TFileStream;
FOnActivate: TNotifyEvent;
// All Events Code
FOnDSEvent : TOnDSEvent;
// Generic Graph Events
FOnGraphBufferingData : TOnGraphBufferingData;
FOnGraphClockChanged : TNotifyEvent;
FOnGraphComplete : TOnGraphComplete;
FOnGraphDeviceLost : TOnGraphDeviceLost;
FOnGraphEndOfSegment : TOnGraphEndOfSegment;
FOnGraphErrorStillPlaying : TOnDSResult;
FOnGraphErrorAbort : TOnDSResult;
FOnGraphFullscreenLost : TOnGraphFullscreenLost;
FOnGraphChanged : TNotifyEvent;
FOnGraphOleEvent : TOnGraphOleEvent;
FOnGraphOpeningFile : TOnGraphOpeningFile;
FOnGraphPaletteChanged : TNotifyEvent;
FOnGraphPaused : TOnDSResult;
FOnGraphQualityChange : TNotifyEvent;
FOnGraphSNDDevInError : TOnGraphSNDDevError;
FOnGraphSNDDevOutError : TOnGraphSNDDevError;
FOnGraphStepComplete : TNotifyEvent;
FOnGraphStreamControlStarted : TOnGraphStreamControl;
FOnGraphStreamControlStopped : TOnGraphStreamControl;
FOnGraphStreamErrorStillPlaying : TOnGraphStreamError;
FOnGraphStreamErrorStopped : TOnGraphStreamError;
FOnGraphUserAbort : TNotifyEvent;
FOnGraphVideoSizeChanged : TOnGraphVideoSizeChanged;
FOnGraphTimeCodeAvailable : TOnGraphTimeCodeAvailable;
FOnGraphEXTDeviceModeChange : TOnGraphEXTDeviceModeChange;
FOnGraphClockUnset : TNotifyEvent;
FOnGraphVMRRenderDevice : TOnGraphVMRRenderDevice;
FOnDVDAudioStreamChange : TOnDVDAudioStreamChange;
FOnDVDCurrentTime : TOnDVDCurrentTime;
FOnDVDTitleChange : TOnDVDTitleChange;
FOnDVDChapterStart : TOnDVDChapterStart;
FOnDVDAngleChange : TOnDVDChange;
FOnDVDValidUOPSChange : TOnDVDValidUOPSChange;
FOnDVDButtonChange : TOnDVDChange;
FOnDVDChapterAutoStop : TNotifyEvent;
FOnDVDStillOn : TOnDVDStillOn;
FOnDVDStillOff : TNotifyEvent;
FOnDVDSubpictureStreamChange : TOnDVDSubpictureStreamChange;
FOnDVDNoFP_PGC : TNotifyEvent;
FOnDVDPlaybackRateChange : TOnDVDPlaybackRateChange;
FOnDVDParentalLevelChange : TOnDVDParentalLevelChange;
FOnDVDPlaybackStopped : TNotifyEvent;
FOnDVDAnglesAvailable : TOnDVDAnglesAvailable;
FOnDVDPlayPeriodAutoStop : TNotifyEvent;
FOnDVDButtonAutoActivated : TOnDVDButtonAutoActivated;
FOnDVDCMDStart : TOnDVDCMD;
FOnDVDCMDEnd : TOnDVDCMD;
FOnDVDDiscEjected : TNotifyEvent;
FOnDVDDiscInserted : TNotifyEvent;
FOnDVDCurrentHMSFTime : TOnDVDCurrentHMSFTime;
FOnDVDKaraokeMode : TOnDVDKaraokeMode;
// DVD Warning
FOnDVDWarningInvalidDVD1_0Disc : TNotifyEvent;//=1,
FOnDVDWarningFormatNotSupported : TNotifyEvent;//=2,
FOnDVDWarningIllegalNavCommand : TNotifyEvent;//=3
FOnDVDWarningOpen : TNotifyEvent;//=4
FOnDVDWarningSeek : TNotifyEvent;//=5
FOnDVDWarningRead : TNotifyEvent;//=6
// DVDDomain
FOnDVDDomainFirstPlay : TNotifyEvent;
FOnDVDDomainVideoManagerMenu : TNotifyEvent;
FOnDVDDomainVideoTitleSetMenu : TNotifyEvent;
FOnDVDDomainTitle : TNotifyEvent;
FOnDVDDomainStop : TNotifyEvent;
// DVDError
FOnDVDErrorUnexpected : TNotifyEvent;
FOnDVDErrorCopyProtectFail : TNotifyEvent;
FOnDVDErrorInvalidDVD1_0Disc : TNotifyEvent;
FOnDVDErrorInvalidDiscRegion : TNotifyEvent;
FOnDVDErrorLowParentalLevel : TNotifyEvent;
FOnDVDErrorMacrovisionFail : TNotifyEvent;
FOnDVDErrorIncompatibleSystemAndDecoderRegions : TNotifyEvent;
FOnDVDErrorIncompatibleDiscAndDecoderRegions : TNotifyEvent;
FOnSelectedFilter: TOnSelectedFilter;
FOnCreatedFilter: TOnCreatedFilter;
FOnUnableToRender: TOnUnableToRender;
procedure HandleEvents;
procedure WndProc(var Msg: TMessage);
procedure SetActive(Activate: boolean);
procedure SetGraphMode(Mode: TGraphMode);
procedure SetGraphEdit(enable: boolean);
procedure ClearOwnFilters;
procedure AddOwnFilters;
procedure GraphEvents(Event, Param1, Param2: integer);
procedure ControlEvents(Event: TControlEvent; Param: integer = 0);
procedure SetLogFile(FileName: String);
function GetState: TGraphState;
procedure SetState(Value: TGraphState);
procedure SetVolume(Volume: Integer);
procedure SetBalance(Balance: integer);
function GetSeekCaps: TSeekingCaps;
procedure SetRate(Rate: double);
function GetDuration: integer;
procedure SetLinearVolume(aEnabled: Boolean);
procedure UpdateGraph;
// IAMGraphBuilderCallback
function SelectedFilter(pMon: IMoniker): HResult; stdcall;
function CreatedFilter(pFil: IBaseFilter): HResult; stdcall;
// IAMFilterGraphCallback
function UnableToRender(ph1, ph2: integer; pPin: IPin): HResult; // thiscall
protected
{@exclude}
procedure DoEvent(Event, Param1, Param2: Integer); virtual;
{@exclude}
procedure InsertFilter(AFilter: IFilter);
{@exclude}
procedure RemoveFilter(AFilter: IFilter);
{@exclude}
procedure InsertEventNotifier(AEvent: IEvent);
{@exclude}
procedure RemoveEventNotifier(AEvent: IEvent);
{@exclude}
function QueryService(const rsid, iid: TGuid; out Obj): HResult; stdcall;
public
{ Retrieve the total duration of a stream. }
property Duration: Integer read GetDuration;
{ Retrieve/Set the rate. }
property Rate: Double read fRate write SetRate;
{ Retrieve the seeking capabilities. }
property SeekCapabilities: TSeekingCaps read GetSeekCaps;
{ The volume balance. }
property Balance: integer read fBalance write SetBalance;
{ The volume. }
property Volume: integer read fVolume write SetVolume;
{ Current state of the filter graph. }
property State: TGraphState read GetState write SetState;
{ TFilterGraph constructor. }
constructor Create(AOwner: TComponent); override;
{ TFilterGraph destructor. }
destructor Destroy; override;
{ @exclude}
procedure Loaded; override;
{ Retrieve an Interface from the current Graph.<br>
<b>ex: </b> (FilterGraph <b>as</b> IGraphBuilder).RenderFile('C:\speedis.avi', <b>nil</b>);<br>
<b>Remark: </b> The interfaces you can Query depend of the @link(Mode) you
have defined.<br>
<b>gmNormal: </b>IAMGraphStreams, IAMStats, IBasicAudio, IBasicVideo,
IBasicVideo2, IFilterChain, IFilterGraph, IFilterGraph2,
IFilterMapper2, IGraphBuilder, IGraphConfig, IGraphVersion,
IMediaControl, IMediaEvent, IMediaEventEx, IMediaEventSink,
IMediaFilter, IMediaPosition, IMediaSeeking, IQueueCommand,
IRegisterServiceProvider, IResourceManager, IServiceProvider,
IVideoFrameStep, IVideoWindow. <br>
<b>gmCapture: </b> all gmNormal interfaces and ICaptureGraphBuilder2.<br>
<b>gmDVD: </b> all gmNormal interfaces and IDvdGraphBuilder, IDvdControl2,
IDvdInfo2, IAMLine21Decoder.}
function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
{ The Run method runs all the filters in the filter graph. While the graph
is running, data moves through the graph and is rendered. }
function Play: boolean;
{ The Pause method pauses all the filters in the filter graph. }
function Pause: boolean;
{ The Stop method stops all the filters in the graph. }
function Stop: boolean;
{ This method disconnect all pins.}
procedure DisconnectFilters;
{ Disconnect and remove all filters from the filter graph excepting the custom components. }
procedure ClearGraph;
{ Render a single file. }
function RenderFile(FileName: WideString): HRESULT;
function RenderFileEx(FileName: WideString): HRESULT;
{ Render a DVD Video Volume or a File Name if specified. }
function RenderDVD(out status: TAMDVDRenderStatus;
FileName: WideString = ''; Mode: Integer = AM_DVD_HWDEC_PREFER): HRESULT;
{ Save the current state and position of a DVD movie to a file.<br>
See also: @link(DVDRestoreBookmark).}
procedure DVDSaveBookmark(BookMarkFile: WideString);
{ Restore the State and position of a DVD movie saved by @link(DVDSaveBookmark).}
procedure DVDRestoreBookmark(BookMarkFile: WideString);
published
{ Specify a File Name to save the Filter Graph Log. }
property LogFile: String read FLogFileName write SetLogFile;
{ Activate the Filter Graph.}
property Active: boolean read FActive write SetActive default False;
{ Auto-Activate the Filter Graph when component is created.}
property AutoCreate: boolean read FAutoCreate write FAutoCreate default False;
{ There is 3 modes: gmNormal, gmCapture and gmDVD. <br>
See also: @link(GraphInterFace).}
property Mode: TGraphMode read FMode write SetGraphMode default gmNormal;
{ if true you can use GraphEdit application to connect with the Filter Graph.}
property GraphEdit: boolean read FGraphEdit write SetGraphEdit;
{ if true, Volume and Balance is set by using a linear algorythm instead of
logatithmic. }
property LinearVolume: Boolean read FLinearVolume write SetLinearVolume;
// -------------------------------------------------------------------------
// Events
// -------------------------------------------------------------------------
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
{ Generic Filter Graph event.<br>
<b>Event:</b> message sent.<br>
<b>Param1:</b> first message parameter.<br>
<b>Param2:</b> second message parameter.}
property OnDSEvent: TOnDSEvent read FOnDSEvent write FOnDSEvent;
{ The graph is buffering data, or has stopped buffering data.
A filter can send this event if it needs to buffer data from an external
source. (for example, it might be loading data from a network.)
The application can use this event to adjust its user interface.<br>
<b>buffering:</b> TRUE if the graph is starting to buffer, or FALSE if
the graph has stopped buffering. }
property OnGraphBufferingData: TOnGraphBufferingData read FOnGraphBufferingData write FOnGraphBufferingData;
{ The reference clock has changed. The filter graph manager sends this event
when its IMediaFilter.SetSyncSource method is called.}
property OnGraphClockChanged: TNotifyEvent read FOnGraphClockChanged write FOnGraphClockChanged;
{ All data from a particular stream has been rendered.
By default, the filter graph manager does not forward this event to the
application. However, after all the streams in the graph report EC_COMPLETE,
the filter graph manager posts a separate EC_COMPLETE event to the application.<br>
<b>Result:</b> HRESULT value; can be S_OK.<br>
<b>Renderer:</b> nil, or a reference to the renderer's IBaseFilter interface.}
property OnGraphComplete: TOnGraphComplete read FOnGraphComplete write FOnGraphComplete;
{ A Plug and Play device was removed or became available again. When the
device becomes available again, the previous state of the device filter is
no longer valid. The application must rebuild the graph in order to use the device.<br>
<b>Device:</b> IUnknown interface of the filter that represents the device.<br>
<b>Removed:</b> True if the device was removed, or False if the device is available again.}
property OnGraphDeviceLost: TOnGraphDeviceLost read FOnGraphDeviceLost write FOnGraphDeviceLost;
{ The end of a segment was reached.
This event code supports seamless looping. When a call to the IMediaSeeking.SetPositions
method includes the AM_SEEKING_Segment flag, the source filter sends this
event code instead of calling IPin.EndOfStream.<br>
<b>StreamTime:</b> TREFERENCE_TIME value that specifies the accumulated stream time since the start of the segment.<br>
<b>NumSegment:</b> Cardinal value indicating the segment number (zero-based).}
property OnGraphEndOfSegment: TOnGraphEndOfSegment read FOnGraphEndOfSegment write FOnGraphEndOfSegment;
{ An asynchronous command to run the graph has failed.
if the filter graph manager issues an asynchronous run command that fails,
it sends this event to the application. The graph remains in a running state.
The state of the underlying filters is indeterminate. Some filters might be
running, others might not.<br>
<b>Result:</b> value of the operation that failed.}
property OnGraphErrorStillPlaying: TOnDSResult read FOnGraphErrorStillPlaying write FOnGraphErrorStillPlaying;
{ An operation was aborted because of an error.<br>
<b>Result:</b> value of the operation that failed.}
property OnGraphErrorAbort: TOnDSResult read FOnGraphErrorAbort write FOnGraphErrorAbort;
{ The video renderer is switching out of full-screen mode.
When the Full Screen Renderer loses activation, it sends this event. When
another video renderer switches out of full-screen mode, the filter graph
manager sends this event, in response to an EC_ACTIVATE event from the renderer.<br>
<b>Renderer:</b> the video renderer's IBaseFilter interface, or nil.}
property OnGraphFullscreenLost: TOnGraphFullscreenLost read FOnGraphFullscreenLost write FOnGraphFullscreenLost;
{ The filter graph has changed.
This event code is intended for debugging. It is not sent for all graph changes.}
property OnGraphChanged: TNotifyEvent read FOnGraphChanged write FOnGraphChanged;
{ A filter is passing a text string to the application.
By convention, the first parameter contains type information (for example, Text)
and the second parameter contains the text string.<br>
<b>String1, String2:</b> Wide Strings}
property OnGraphOleEvent: TOnGraphOleEvent read FOnGraphOleEvent write FOnGraphOleEvent;
{ The graph is opening a file, or has finished opening a file.
A filter can send this event if it spends significant time opening a file.
(for example, the file might be located on a network.) The application can use
this event to adjust its user interface.<br>
<b>opening:</b> TRUE if the graph is starting to open a file, or FALSE
if the graph is no longer opening the file.}
property OnGraphOpeningFile: TOnGraphOpeningFile read FOnGraphOpeningFile write FOnGraphOpeningFile;
{ The video palette has changed.
Video renderers send this event if they detect a palette change in the stream.}
property OnGraphPaletteChanged: TNotifyEvent read FOnGraphPaletteChanged write FOnGraphPaletteChanged;
{ A pause request has completed.
The filter graph manager sends this event when it completes an asynchronous pause command.<br>
<b>Result:</b> value that indicates the result of the transition. if the
value is S_OK, the filter graph is now in a paused state.}
property OnGraphPaused: TOnDSResult read FOnGraphPaused write FOnGraphPaused;
{ The graph is dropping samples, for quality control.
A filter sends this event if it drops samples in response to a quality control
message. It sends the event only when it adjusts the quality level, not for each
sample that it drops. }
property OnGraphQualityChange: TNotifyEvent read FOnGraphQualityChange write FOnGraphQualityChange;
{ An audio device error occurred on an input pin.<br>
<b>OccurWhen:</b> value from the TSNDDEV_ERR enumerated type, indicating how the device was being accessed when the failure occurred.<br>
<b>ErrorCode:</b> value indicating the error returned from the sound device call.}
property OnGraphSNDDevInError: TOnGraphSNDDevError read FOnGraphSNDDevInError write FOnGraphSNDDevInError;
{ An audio device error occurred on an output pin.<br>
<b>OccurWhen:</b> value from the TSNDDEV_ERR enumerated type, indicating how the device was being accessed when the failure occurred.<br>
<b>ErrorCode:</b> value indicating the error returned from the sound device call.}
property OnGraphSNDDevOutError: TOnGraphSNDDevError read FOnGraphSNDDevOutError write FOnGraphSNDDevOutError;
{ A filter has completed frame stepping.
The filter graph manager pauses the graph and passes the event to the application.}
property OnGraphStepComplete: TNotifyEvent read FOnGraphStepComplete write FOnGraphStepComplete;
{ A stream-control start command has taken effect.
Filters send this event in response to the IAMStreamControl.StartAt method.
This method specifies a reference time for a pin to begin streaming.
When streaming does begin, the filter sends this event.<br>
<b>PinSender</b> parameter specifies the pin that executes the start command.
Depending on the implementation, it might not be the pin that
received the StartAt call.<br>
<b>Cookie</b> parameter is specified by the application in the StartAt method.
This parameter enables the application to track multiple calls to the method.}
property OnGraphStreamControlStarted: TOnGraphStreamControl read FOnGraphStreamControlStarted write FOnGraphStreamControlStarted;
{ A stream-control start command has taken effect.
Filters send this event in response to the IAMStreamControl.StopAt method.
This method specifies a reference time for a pin to stop streaming.
When streaming does halt, the filter sends this event.<br>
<b>PinSender</b> parameter specifies the pin that executes the stop command.
Depending on the implementation, it might not be the pin
that received the StopAt call.<br>
<b>Cookie</b> parameter is specified by the application in the StopAt method.
This parameter enables the application to track multiple calls to the method.}
property OnGraphStreamControlStopped: TOnGraphStreamControl read FOnGraphStreamControlStopped write FOnGraphStreamControlStopped;
{ An error occurred in a stream, but the stream is still playing.<br>
<b>Operation:</b> HRESULT of the operation that failed.<br>
<b>Value:</b> LongWord value, generally zero. }
property OnGraphStreamErrorStillPlaying : TOnGraphStreamError read FOnGraphStreamErrorStillPlaying write FOnGraphStreamErrorStillPlaying;
{ A stream has stopped because of an error.<br>
<b>Operation:</b> HRESULT of the operation that failed.<br>
<b>Value:</b> LongWord value, generally zero. }
property OnGraphStreamErrorStopped: TOnGraphStreamError read FOnGraphStreamErrorStopped write FOnGraphStreamErrorStopped;
{ The user has terminated playback.<br>
This event code signals that the user has terminated normal graph playback.
for example, video renderers send this event if the user closes the video window.<br>
After sending this event, the filter should reject all samples and not send
any EC_REPAINT events, until the filter stops and is reset.}
property OnGraphUserAbort: TNotifyEvent read FOnGraphUserAbort write FOnGraphUserAbort;
{ The native video size has changed.<br>
<b>width:</b> new width, in pixels.<br>
<b>height:</b> new height, in pixels. }
property OnGraphVideoSizeChanged: TOnGraphVideoSizeChanged read FOnGraphVideoSizeChanged write FOnGraphVideoSizeChanged;
{ Sent by filter supporting timecode.<br>
<b>From:</b> sending object.<br>
<b>DeviceID:</b> device ID of the sending object}
property OnGraphTimeCodeAvailable: TOnGraphTimeCodeAvailable read FOnGraphTimeCodeAvailable write FOnGraphTimeCodeAvailable;
{ Sent by filter supporting IAMExtDevice.<br>
<b>NewMode:</b> the new mode<br>
<b>DeviceID:</b> the device ID of the sending object}
property OnGraphEXTDeviceModeChange: TOnGraphEXTDeviceModeChange read FOnGraphEXTDeviceModeChange write FOnGraphEXTDeviceModeChange;
{ The clock provider was disconnected.<br>
KSProxy signals this event when the pin of a clock-providing filter is disconnected.}
property OnGraphClockUnset: TNotifyEvent read FOnGraphClockUnset write FOnGraphClockUnset;
{ Identifies the type of rendering mechanism the VMR is using to display video.}
property OnGraphVMRRenderDevice: TOnGraphVMRRenderDevice read FOnGraphVMRRenderDevice write FOnGraphVMRRenderDevice;
{ Signals that the current audio stream number changed for the main title.<br>
The current audio stream can change automatically with a navigation command
authored on the disc as well as through application control by using the IDvdControl2 interface.<br>
<b>stream:</b> value indicating the new user audio stream number. Audio stream numbers
range from 0 to 7. Stream $FFFFFFFF indicates that no stream is selected.<br>
<b>lcid:</b> Language identifier.<br>
<b>Lang:</b> Language string. }
property OnDVDAudioStreamChange: TOnDVDAudioStreamChange read FOnDVDAudioStreamChange write FOnDVDAudioStreamChange;
{ Deprecated, use @link(OnDVDCurrentHMSFTime) instead.<br>
Signals the beginning of every video object unit (VOBU), a video segment
which is 0.4 to 1.0 seconds in length.<br> }
property OnDVDCurrentTime: TOnDVDCurrentTime read FOnDVDCurrentTime write FOnDVDCurrentTime;
{ Indicates when the current title number changes.<br>
Title numbers range from 1 to 99. This number indicates the TTN, which is
the title number with respect to the whole disc, not the VTS_TTN which is
the title number with respect to just a current VTS.<br>
<b>Title:</b> value indicating the new title number.}
property OnDVDTitleChange: TOnDVDTitleChange read FOnDVDTitleChange write FOnDVDTitleChange;
{ Signals that the DVD player started playback of a new program in the
DVD_DOMAIN_Title domain.<br>
Only simple linear movies signal this event.<br>
<b>chapter:</b> value indicating the new chapter (program) number.}
property OnDVDChapterStart: TOnDVDChapterStart read FOnDVDChapterStart write FOnDVDChapterStart;
{ Signals that either the number of available angles changed or that the
current angle number changed.<br>
Angle numbers range from 1 to 9. The current angle number can change
automatically with a navigation command authored on the disc as well as
through application control by using the IDvdControl2 interface.<br>
<b>total:</b> value indicating the number of available angles. When the
number of available angles is 1, the current video is not multiangle.<br>
<b>current:</b> value indicating the current angle number.}
property OnDVDAngleChange: TOnDVDChange read FOnDVDAngleChange write FOnDVDAngleChange;
{ Signals that the available set of IDvdControl2 interface methods has changed.<br>
<b>UOPS:</b> value representing a ULONG whose bits indicate which IDvdControl2
commands the DVD disc explicitly disabled. }
property OnDVDValidUOPSChange: TOnDVDValidUOPSChange read FOnDVDValidUOPSChange write FOnDVDValidUOPSChange;
{ Signals that either the number of available buttons changed or that the
currently selected button number changed.<br>
This event can signal any of the available button numbers. These numbers
do not always correspond to button numbers used for
IDvdControl2.SelectAndActivateButton because that method can activate only
a subset of buttons.<br>
<b>total:</b> value indicating the number of available buttons.<br>
<b>current:</b> value indicating the currently selected button number.
Selected button number zero implies that no button is selected.}
property OnDVDButtonChange: TOnDVDChange read FOnDVDButtonChange write FOnDVDButtonChange;
{ Indicates that playback stopped as the result of a call to the
IDvdControl2.PlayChaptersAutoStop method.}
property OnDVDChapterAutoStop: TNotifyEvent read FOnDVDChapterAutoStop write FOnDVDChapterAutoStop;
{ Signals the beginning of any still (PGC, Cell, or VOBU).
All combinations of buttons and still are possible (buttons on with still
on, buttons on with still off, button off with still on, button off with still off).<br>
<b>NoButtonAvailable</b>: Boolean value indicating whether buttons are
available. False indicates buttons are available so the IDvdControl2.StillOff
method won't work. True indicates no buttons are available, so IDvdControl2.StillOff will work.<br>
<b>seconds</b>: value indicating the number of seconds the still will last.
$FFFFFFFF indicates an infinite still, meaning wait until the user presses
a button or until the application calls IDvdControl2.StillOff.}
property OnDVDStillOn: TOnDVDStillOn read FOnDVDStillOn write FOnDVDStillOn;
{ Signals the end of any still (PGC, Cell, or VOBU).<br>
This event indicates that any currently active still has been released.}
property OnDVDStillOff: TNotifyEvent read FOnDVDStillOff write FOnDVDStillOff;
{ Signals that the current subpicture stream number changed for the main title.<br>
The subpicture can change automatically with a navigation command authored
on disc as well as through application control using IDvdControl2.<br>
<b>SubNum:</b> value indicating the new user subpicture stream number.
Subpicture stream numbers range from 0 to 31. Stream $FFFFFFFF indicates
that no stream is selected.<br>
<b>lcid:</b> Language identifier.<br>
<b>Lang:</b> Language string.}
property OnDVDSubpictureStreamChange: TOnDVDSubpictureStreamChange read FOnDVDSubpictureStreamChange write FOnDVDSubpictureStreamChange;
{ Signals that the DVD disc does not have a FP_PGC (First Play Program Chain)
and that the DVD Navigator will not automatically load any PGC and start playback.}
property OnDVDNoFP_PGC: TNotifyEvent read FOnDVDNoFP_PGC write FOnDVDNoFP_PGC;
{ Signals that a rate change in the playback has been initiated.
<b>rate:</b> indicate the new playback rate. rate < 0 indicates reverse playback
mode. rate > 0 indicates forward playback mode.}
property OnDVDPlaybackRateChange: TOnDVDPlaybackRateChange read FOnDVDPlaybackRateChange write FOnDVDPlaybackRateChange;
{ Signals that the parental level of the authored content is about to change.<br>
The DVD Navigator source filter does not currently support "on the fly"
parental level changes in response to SetTmpPML commands on a DVD disc.<br>
<b>level:</b> value representing the new parental level set in the player.}
property OnDVDParentalLevelChange: TOnDVDParentalLevelChange read FOnDVDParentalLevelChange write FOnDVDParentalLevelChange;
{ Indicates that playback has been stopped. The DVD Navigator has completed
playback of the title or chapter and did not find any other branching
instruction for subsequent playback. }
property OnDVDPlaybackStopped: TNotifyEvent read FOnDVDPlaybackStopped write FOnDVDPlaybackStopped;
{ Indicates whether an angle block is being played and angle changes can be performed.<br>
Angle changes are not restricted to angle blocks and the manifestation of
the angle change can be seen only in an angle block.<br>
<b>available:</b> Boolean value that indicates if an angle block is being
played back. False indicates that playback is not in an angle block and
angles are not available, True indicates that an angle block is being played
back and angle changes can be performed.}
property OnDVDAnglesAvailable: TOnDVDAnglesAvailable read FOnDVDAnglesAvailable write FOnDVDAnglesAvailable;
{ Indicates that the Navigator has finished playing the segment specified
in a call to PlayPeriodInTitleAutoStop.}
property OnDVDPlayPeriodAutoStop: TNotifyEvent read FOnDVDPlayPeriodAutoStop write FOnDVDPlayPeriodAutoStop;
{ Signals that a menu button has been automatically activated per instructions
on the disc. This occurs when a menu times out and the disc has specified a
button to be automatically activated.<br>
<b>Button</b>: value indicating the button that was activated.}
property OnDVDButtonAutoActivated: TOnDVDButtonAutoActivated read FOnDVDButtonAutoActivated write FOnDVDButtonAutoActivated;
{ Signals that a particular command has begun.<br>
<b>CmdID:</b> The Command ID and the HRESULT return value.}
property OnDVDCMDStart: TOnDVDCMD read FOnDVDCMDStart Write FOnDVDCMDStart;
{ Signals that a particular command has completed.<br>
<b>CmdID</b> The Command ID and the completion result.}
property OnDVDCMDEnd: TOnDVDCMD read FOnDVDCMDEnd Write FOnDVDCMDEnd;
{ Signals that a disc was ejected.<br>
Playback automatically stops when a disc is ejected. The application does
not have to take any special action in response to this event.}
property OnDVDDiscEjected: TNotifyEvent read FOnDVDDiscEjected Write FOnDVDDiscEjected;
{ Signals that a disc was inserted into the drive.<br>
Playback automatically begins when a disc is inserted. The application does
not have to take any special action in response to this event.}
property OnDVDDiscInserted: TNotifyEvent read FOnDVDDiscInserted write FOnDVDDiscInserted;
{ Signals the current time, in DVD_HMSF_TIMECODE format, relative to the start
of the title. This event is triggered at the beginning of every VOBU, which
occurs every 0.4 to 1.0 seconds.<br>
The TDVD_HMSF_TIMECODE format is intended to replace the old BCD format that
is returned in OnDVDCurrentTime events. The HMSF timecodes are easier to
work with. To have the Navigator send EC_DVD_CURRENT_HMSF_TIME events instead
of EC_DVD_CURRENT_TIME events, an application must call
IDvdControl2.SetOption(DVD_HMSF_TimeCodeEvents, TRUE). When this flag is set,
the Navigator will also expect all time parameters in the IDvdControl2 and
IDvdInfo2 methods to be passed as TDVD_HMSF_TIMECODEs.<br>
<b>HMSFTimeCode:</b> HMS Time code structure.<br>
<b>TimeCode:</b> old time format, do not use. }
property OnDVDCurrentHMSFTime: TOnDVDCurrentHMSFTime read FOnDVDCurrentHMSFTime write FOnDVDCurrentHMSFTime;
{ Indicates that the Navigator has either begun playing or finished playing karaoke data.<br>
The DVD player signals this event whenever it changes domains.<br>
<b>Played:</b> TRUE means that a karaoke track is being played and FALSE means
that no karaoke data is being played. }
property OnDVDKaraokeMode: TOnDVDKaraokeMode read FOnDVDKaraokeMode write FOnDVDKaraokeMode;
{ Performing default initialization of a DVD disc.}
property OnDVDDomainFirstPlay: TNotifyEvent read FOnDVDDomainFirstPlay write FOnDVDDomainFirstPlay;
{ Displaying menus for whole disc. }
property OnDVDDomainVideoManagerMenu: TNotifyEvent read FOnDVDDomainVideoManagerMenu write FOnDVDDomainVideoManagerMenu;
{ Displaying menus for current title set. }
property OnDVDDomainVideoTitleSetMenu: TNotifyEvent read FOnDVDDomainVideoTitleSetMenu write FOnDVDDomainVideoTitleSetMenu;
{ Displaying the current title. }
property OnDVDDomainTitle: TNotifyEvent read FOnDVDDomainTitle write FOnDVDDomainTitle;
{ The DVD Navigator is in the DVD Stop domain.}
property OnDVDDomainStop: TNotifyEvent read FOnDVDDomainStop write FOnDVDDomainStop;
{ Something unexpected happened; perhaps content is authored incorrectly.
Playback is stopped.}
property OnDVDErrorUnexpected: TNotifyEvent read FOnDVDErrorUnexpected write FOnDVDErrorUnexpected;
{ Key exchange for DVD copy protection failed. Playback is stopped. }
property OnDVDErrorCopyProtectFail: TNotifyEvent read FOnDVDErrorCopyProtectFail write FOnDVDErrorCopyProtectFail;
{ DVD-Video disc is authored incorrectly for specification version 1.x.
Playback is stopped.}
property OnDVDErrorInvalidDVD1_0Disc: TNotifyEvent read FOnDVDErrorInvalidDVD1_0Disc write FOnDVDErrorInvalidDVD1_0Disc;
{ DVD-Video disc cannot be played because the disc is not authored to play in
the system region. }
property OnDVDErrorInvalidDiscRegion: TNotifyEvent read FOnDVDErrorInvalidDiscRegion write FOnDVDErrorInvalidDiscRegion;
{ Player parental level is lower than the lowest parental level available in
the DVD content. Playback is stopped. }
property OnDVDErrorLowParentalLevel: TNotifyEvent read FOnDVDErrorLowParentalLevel write FOnDVDErrorLowParentalLevel;
{ Macrovision® distribution failed. Playback stopped. }
property OnDVDErrorMacrovisionFail: TNotifyEvent read FOnDVDErrorMacrovisionFail write FOnDVDErrorMacrovisionFail;
{ No discs can be played because the system region does not match the decoder region. }
property OnDVDErrorIncompatibleSystemAndDecoderRegions: TNotifyEvent read FOnDVDErrorIncompatibleSystemAndDecoderRegions write FOnDVDErrorIncompatibleSystemAndDecoderRegions;
{ The disc cannot be played because the disc is not authored to be played in
the decoder's region. }
property OnDVDErrorIncompatibleDiscAndDecoderRegions: TNotifyEvent read FOnDVDErrorIncompatibleDiscAndDecoderRegions write FOnDVDErrorIncompatibleDiscAndDecoderRegions;
{ DVD-Video disc is authored incorrectly. Playback can continue, but unexpected
behavior might occur. }
property OnDVDWarningInvalidDVD1_0Disc: TNotifyEvent read FOnDVDWarningInvalidDVD1_0Disc write FOnDVDWarningInvalidDVD1_0Disc;
{ A decoder would not support the current format. Playback of a stream
(audio, video or subpicture) might not function. }
property OnDVDWarningFormatNotSupported : TNotifyEvent read FOnDVDWarningFormatNotSupported write FOnDVDWarningFormatNotSupported;
{ The internal DVD navigation command processor attempted to process an illegal command.}
property OnDVDWarningIllegalNavCommand : TNotifyEvent read FOnDVDWarningIllegalNavCommand write FOnDVDWarningIllegalNavCommand;
{ File Open failed. }
property OnDVDWarningOpen: TNotifyEvent read FOnDVDWarningOpen write FOnDVDWarningOpen;
{ File Seek failed. }
property OnDVDWarningSeek: TNotifyEvent read FOnDVDWarningSeek write FOnDVDWarningSeek;
{ File Read failed. }
property OnDVDWarningRead: TNotifyEvent read FOnDVDWarningRead write FOnDVDWarningRead;
{ Notifys when a Moniker has been found for a MediaType of a Pin in the Graph.
Return True to allow this Filter to be added, otherwise return False.
Note: The Guid might not be the real Filter Class ID, but a Group ID.
eg: Renderer Filters. }
property OnSelectedFilter: TOnSelectedFilter read FOnSelectedFilter write FOnSelectedFilter;
{ Notifys when a Filter has been created and is about to enter the Graph.
Return True to allow this Filter to be added, otherwise return False. }
property OnCreatedFilter: TOnCreatedFilter read FOnCreatedFilter write FOnCreatedFilter;
{ Notifys about a Pin that couldn't be Rendered. Return True to try it again,
otherwise return False. }
property OnUnableToRender: TOnUnableToRender read FOnUnableToRender write FOnUnableToRender;
end;
// *****************************************************************************
// TVMROptions
// *****************************************************************************
{@exclude}
TVideoWindow = class;
{ See VRMOptions.<br>}
TVMRVideoMode = (
vmrWindowed,
vmrWindowless,
vmrRenderless
);
{ Video Mixer Renderer property editor. }
TVMROptions = class(TPersistent)
private
FOwner: TVideoWindow;
FStreams: cardinal;
FPreferences: TVMRPreferences;
FMode: TVMRVideoMode;
FKeepAspectRatio: boolean;
procedure SetStreams(Streams: cardinal);
procedure SetPreferences(Preferences: TVMRPreferences);
procedure SetMode(AMode: TVMRVideoMode);
procedure SetKeepAspectRatio(Keep: boolean);
public
{ Constructor method. }
constructor Create(AOwner: TVideoWindow);
published
{ Windowed or WindowLess}
property Mode: TVMRVideoMode read FMode write SetMode;
{ Sets the number of streams to be mixed. }
property Streams: Cardinal read FStreams write SetStreams default 4;
{ Sets various application preferences related to video rendering. }
property Preferences: TVMRPreferences read FPreferences write SetPreferences default [vpForceMixer];
{ Keep Aspect Ration on the video window. }
property KeepAspectRatio: boolean read FKeepAspectRatio write SetKeepAspectRatio default True;
end;
// *****************************************************************************
// TVideoWindow
// *****************************************************************************
TAbstractAllocator = class(TInterfacedObject)
constructor Create(out hr: HResult; wnd: THandle; d3d: IDirect3D9 = nil; d3dd: IDirect3DDevice9 = nil); virtual; abstract;
end;
TAbstractAllocatorClass = class of TAbstractAllocator;
{ Manage a Video Renderer or a Video Mixer Renderer (VMR) Filter to display
a video in your application. }
TVideoWindow = class(TCustomControl, IFilter, IEvent)
private
FMode : TVideoMode;
FVMROptions : TVMROptions;
FBaseFilter : IBaseFilter;
FVideoWindow : IVideoWindow; // VMR Windowed & Normal
FWindowLess : IVMRWindowlessControl9; // VMR Windowsless
FFullScreen : boolean;
FFilterGraph : TFilterGraph;
FWindowStyle : LongWord;
FWindowStyleEx : LongWord;
FTopMost : boolean;
FIsFullScreen : boolean;
FOnPaint : TNotifyEvent;
FKeepAspectRatio: boolean;
FAllocatorClass: TAbstractAllocatorClass;
FCurrentAllocator: TAbstractAllocator;
FRenderLessUserID: Cardinal;
procedure SetVideoMode(AMode: TVideoMode);
procedure SetFilterGraph(AFilterGraph: TFilterGraph);
procedure SetFullScreen(Value: boolean);
procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0);
procedure GraphEvent(Event, Param1, Param2: integer);
function GetName: string;
function GetVideoHandle: THandle;
procedure ControlEvent(Event: TControlEvent; Param: integer = 0);
procedure SetTopMost(TopMost: boolean);
function GetVisible: boolean;
procedure SetVisible(Vis: boolean);
protected
FIsVideoWindowOwner: Boolean;
{@exclude}
procedure Loaded; override;
{@exclude}
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
{@exclude}
procedure Resize; override;
{@exclude}
procedure ConstrainedResize(var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer); override;
{@exclude}
function GetFilter: IBaseFilter;
{@exclude}
procedure WndProc(var Message: TMessage); override;
{@exclude}
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
{@exclude}
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
{@exclude}
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
{@exclude}
procedure Paint; override;
public
{@exclude}
function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
{ Constructor. }
constructor Create(AOwner: TComponent);override;
{ Destructor. }
destructor Destroy; override;
{ Check if the Video Mixer Renderer is available (Windows XP). }
class function CheckVMR: boolean;
{ Retrieve the current bitmap, only in WindowLess VMR Mode. }
function VMRGetBitmap(Stream: TStream): boolean;
function CheckInputPinsConnected: boolean;
procedure SetAllocator(Allocator: TAbstractAllocatorClass; UserID: Cardinal);
property IsVideoWindowOwner: Boolean read FIsVideoWindowOwner write FIsVideoWindowOwner;
published
{ VMR/WindowsLess Mode only.}