summaryrefslogblamecommitdiffstats
path: root/dxsdk/Include/DShowIDL/Vmrender.idl
blob: ed5e50ece2498095f859f12d33b442629822d4cf (plain) (tree)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                       
///////////////////////////////////////////////////////////////////////////////
//
// Public Interfaces for the Video Mixing Renderer DShow filter
//
// Copyright (c) 1999 - 2002, Microsoft Corporation.  All rights reserved.
///////////////////////////////////////////////////////////////////////////////

cpp_quote("#if 0")
// This is temporary work around to persuade
// MIDL to allow forward declarations.
typedef DWORD*    LPDIRECTDRAW7;
typedef DWORD*    LPDIRECTDRAWSURFACE7;
typedef DWORD*    LPDDPIXELFORMAT;
typedef DWORD*    LPBITMAPINFOHEADER;
typedef struct {DWORD dw1; DWORD dw2;} DDCOLORKEY;
typedef DDCOLORKEY*    LPDDCOLORKEY;
cpp_quote ("#endif")
cpp_quote("#include <ddraw.h>")


// public interfaces supported by the VMR
interface IVMRSurface;

interface IVMRSurfaceAllocator;
interface IVMRSurfaceAllocatorNotify;
interface IVMRImagePresenter;
interface IVMRImagePresenterConfig;

interface IVMRWindowlessControl;
interface IVMRMixerControl;
interface IVMRMixerBitmap;
interface IVMRFilterConfig;
interface IVMRAspectRatioControl;
interface IVMRDeinterlaceControl;
interface IVMRMonitorConfig;

interface IVMRImageCompositor;

interface IVMRVideoStreamControl;




///////////////////////////////////////////////////////////////////////////////
//
// Allocator Presenter interfaces
//
///////////////////////////////////////////////////////////////////////////////



//=====================================================================
//
// IVMRImagePresenter
//
//=====================================================================
typedef enum {
    VMRSample_SyncPoint       = 0x00000001,
    VMRSample_Preroll         = 0x00000002,
    VMRSample_Discontinuity   = 0x00000004,
    VMRSample_TimeValid       = 0x00000008,
    VMRSample_SrcDstRectsValid= 0x00000010
} VMRPresentationFlags;


typedef struct tagVMRPRESENTATIONINFO {
    DWORD                   dwFlags;
    LPDIRECTDRAWSURFACE7    lpSurf;
    REFERENCE_TIME          rtStart;
    REFERENCE_TIME          rtEnd;
    SIZE                    szAspectRatio;
    RECT                    rcSrc;
    RECT                    rcDst;
    DWORD                   dwTypeSpecificFlags;
    DWORD                   dwInterlaceFlags;
} VMRPRESENTATIONINFO;

[
    local,
    object,
    local,
    uuid(CE704FE7-E71E-41fb-BAA2-C4403E1182F5),
    helpstring("IVMRImagePresenter Interface"),
    pointer_default(unique)
]
interface IVMRImagePresenter : IUnknown
{
    HRESULT StartPresenting(
        [in] DWORD_PTR dwUserID
        );

    HRESULT StopPresenting(
        [in] DWORD_PTR dwUserID
        );


    HRESULT PresentImage(
        [in] DWORD_PTR dwUserID,
        [in] VMRPRESENTATIONINFO* lpPresInfo
        );
};


//=====================================================================
//
// IVMRSurfaceAllocator
//
//=====================================================================

typedef enum {
    AMAP_PIXELFORMAT_VALID  = 0x01,
    AMAP_3D_TARGET          = 0x02,
    AMAP_ALLOW_SYSMEM       = 0x04,
    AMAP_FORCE_SYSMEM       = 0x08,
    AMAP_DIRECTED_FLIP      = 0x10,
    AMAP_DXVA_TARGET        = 0x20
} VMRSurfaceAllocationFlags;

typedef struct tagVMRALLOCATIONINFO {
    DWORD                   dwFlags;
    LPBITMAPINFOHEADER      lpHdr;
    LPDDPIXELFORMAT         lpPixFmt;
    SIZE                    szAspectRatio;
    DWORD                   dwMinBuffers;
    DWORD                   dwMaxBuffers;
    DWORD                   dwInterlaceFlags;
    SIZE                    szNativeSize;
} VMRALLOCATIONINFO;

[
    local,
    object,
    local,
    uuid(31ce832e-4484-458b-8cca-f4d7e3db0b52),
    helpstring("IVMRSurfaceAllocator Interface"),
    pointer_default(unique)
]
interface IVMRSurfaceAllocator : IUnknown
{
    HRESULT AllocateSurface(
        [in] DWORD_PTR dwUserID,
        [in] VMRALLOCATIONINFO* lpAllocInfo,
        [in] [out] DWORD* lpdwActualBuffers,
        [out] LPDIRECTDRAWSURFACE7 *lplpSurface
        );

    HRESULT FreeSurface(
        [in] DWORD_PTR dwID
        );

    HRESULT PrepareSurface(
        [in] DWORD_PTR dwUserID,
        [in] LPDIRECTDRAWSURFACE7 lpSurface,
        [in] DWORD dwSurfaceFlags
        );

    HRESULT AdviseNotify(
        [in] IVMRSurfaceAllocatorNotify* lpIVMRSurfAllocNotify
        );
};


//=====================================================================
//
// IVMRSurfaceAllocatorNotify
//
//=====================================================================
[
    local,
    object,
    local,
    uuid(aada05a8-5a4e-4729-af0b-cea27aed51e2),
    helpstring("IVMRSurfaceAllocatorNotify Interface"),
    pointer_default(unique)
]
interface IVMRSurfaceAllocatorNotify : IUnknown
{
    HRESULT AdviseSurfaceAllocator(
        [in] DWORD_PTR dwUserID,
        [in] IVMRSurfaceAllocator* lpIVRMSurfaceAllocator
        );

    HRESULT SetDDrawDevice(
        [in] LPDIRECTDRAW7 lpDDrawDevice,
        [in] HMONITOR hMonitor
        );

    HRESULT ChangeDDrawDevice(
        [in] LPDIRECTDRAW7 lpDDrawDevice,
        [in] HMONITOR hMonitor
        );

    HRESULT RestoreDDrawSurfaces();

    HRESULT NotifyEvent(
        [in] LONG EventCode,
        [in] LONG_PTR Param1,
        [in] LONG_PTR Param2
        );

    HRESULT SetBorderColor(
        [in] COLORREF clrBorder
        );
};



///////////////////////////////////////////////////////////////////////////////
//
// Application control and configuration interfaces
//
///////////////////////////////////////////////////////////////////////////////


//=====================================================================
//
// IVMRWindowlessControl
//
//=====================================================================
typedef enum {
    VMR_ARMODE_NONE,
    VMR_ARMODE_LETTER_BOX
} VMR_ASPECT_RATIO_MODE;

[
    local,
    object,
    local,
    uuid(0eb1088c-4dcd-46f0-878f-39dae86a51b7),
    helpstring("IVMRWindowlessControl Interface"),
    pointer_default(unique)
]
interface IVMRWindowlessControl : IUnknown
{
    //
    //////////////////////////////////////////////////////////
    // Video size and position information
    //////////////////////////////////////////////////////////
    //
    HRESULT GetNativeVideoSize(
        [out] LONG* lpWidth,
        [out] LONG* lpHeight,
        [out] LONG* lpARWidth,
        [out] LONG* lpARHeight
        );

    HRESULT GetMinIdealVideoSize(
        [out] LONG* lpWidth,
        [out] LONG* lpHeight
        );

    HRESULT GetMaxIdealVideoSize(
        [out] LONG* lpWidth,
        [out] LONG* lpHeight
        );

    HRESULT SetVideoPosition(
        [in] const LPRECT lpSRCRect,
        [in] const LPRECT lpDSTRect
        );

    HRESULT GetVideoPosition(
        [out] LPRECT lpSRCRect,
        [out] LPRECT lpDSTRect
        );

    HRESULT GetAspectRatioMode(
        [out] DWORD* lpAspectRatioMode
        );

    HRESULT SetAspectRatioMode(
        [in] DWORD AspectRatioMode
        );

    //
    //////////////////////////////////////////////////////////
    // Display and clipping management
    //////////////////////////////////////////////////////////
    //
    HRESULT SetVideoClippingWindow(
        [in] HWND hwnd
        );

    HRESULT RepaintVideo(
        [in] HWND hwnd,
        [in] HDC hdc
        );

    HRESULT DisplayModeChanged();


    //
    //////////////////////////////////////////////////////////
    // GetCurrentImage
    //
    // Returns the current image being displayed.  This images
    // is returned in the form of packed Windows DIB.
    //
    // GetCurrentImage can be called at any time, also
    // the caller is responsible for free the returned memory
    // by calling CoTaskMemFree.
    //
    // Excessive use of this function will degrade video
    // playback performed.
    //////////////////////////////////////////////////////////
    //
    HRESULT GetCurrentImage(
        [out] BYTE** lpDib
        );

    //
    //////////////////////////////////////////////////////////
    // Border Color control
    //
    // The border color is color used to fill any area of the
    // the destination rectangle that does not contain video.
    // It is typically used in two instances.  When the video
    // straddles two monitors and when the VMR is trying
    // to maintain the aspect ratio of the movies by letter
    // boxing the video to fit within the specified destination
    // rectangle. See SetAspectRatioMode above.
    //////////////////////////////////////////////////////////
    //
    HRESULT SetBorderColor(
        [in] COLORREF Clr
        );

    HRESULT GetBorderColor(
        [out] COLORREF* lpClr
        );

    //
    //////////////////////////////////////////////////////////
    // Color key control only meaningful when the VMR is using
    // and overlay
    //////////////////////////////////////////////////////////
    //
    HRESULT SetColorKey(
        [in] COLORREF Clr
        );

    HRESULT GetColorKey(
        [out] COLORREF* lpClr
        );
};



//=====================================================================
//
// IVMRMixerControl
//
//=====================================================================

typedef enum {
    MixerPref_NoDecimation                 = 0x00000001, // No decimation - full size
    MixerPref_DecimateOutput               = 0x00000002, // decimate output by 2 in x & y
    MixerPref_ARAdjustXorY          = 0x00000004, // adjust the aspect ratio in x or y
    MixerPref_DecimationReserved    = 0x00000008, // bits reserved for future use.
    MixerPref_DecimateMask                 = 0x0000000F,

    MixerPref_BiLinearFiltering            = 0x00000010, // use bi-linear filtering
    MixerPref_PointFiltering               = 0x00000020, // use point filtering
    MixerPref_FilteringMask                = 0x000000F0, // OR of all above flags

    MixerPref_RenderTargetRGB       = 0x00000100, // Uses D3D to perform mixing
    MixerPref_RenderTargetYUV       = 0x00001000, // Uses DXVA to perform mixing

    MixerPref_RenderTargetYUV420    = 0x00000200, // Deprecated render target
    MixerPref_RenderTargetYUV422    = 0x00000400, // Deprecated render target
    MixerPref_RenderTargetYUV444    = 0x00000800, // Deprecated render target
    MixerPref_RenderTargetReserved  = 0x0000E000, // 3 bits reserved for future use.
    MixerPref_RenderTargetMask      = 0x0000FF00, // OR of all above flags

    //
    // Dynamic changes that can be performed when the VMR's mixer is
    // configured to use the YUV Render target (see MixerPref_RenderTargetYUV)
    // These preferences can be applied while the graph is running and take effect
    // when the next frame is composed by the mixer.
    //
    MixerPref_DynamicSwitchToBOB           = 0x00010000,
    MixerPref_DynamicDecimateBy2           = 0x00020000,

    MixerPref_DynamicReserved              = 0x000C0000,
    MixerPref_DynamicMask                  = 0x000F0000

} VMRMixerPrefs;

//
//  Normalized relative rectangle
//  Coordinate ranges: x=[0...1) y=[0...1)
//  Where the output window goes from 0,0 (closed inclusive lower bound)
//  to 1,1 (open exclusive upper bound)
//
typedef struct _NORMALIZEDRECT
{
	float left;
	float top;
	float right;
	float bottom;
} NORMALIZEDRECT, *PNORMALIZEDRECT;

[
    local,
    object,
    local,
    uuid(1c1a17b0-bed0-415d-974b-dc6696131599),
    helpstring("IVMRMixerControl Interface"),
    pointer_default(unique)
]
interface IVMRMixerControl : IUnknown
{
    HRESULT SetAlpha(
        [in] DWORD dwStreamID,
        [in] float Alpha // Source alpha premultication factor (global alpha for source)
        );

    HRESULT GetAlpha(
        [in] DWORD dwStreamID,
        [out] float* pAlpha
        );

    HRESULT SetZOrder(
        [in] DWORD dwStreamID,
        [in] DWORD dwZ
        );

    HRESULT GetZOrder(
        [in] DWORD dwStreamID,
        [out] DWORD* pZ
        );

    HRESULT SetOutputRect(
        [in] DWORD dwStreamID,
        [in] const NORMALIZEDRECT *pRect
        );

    HRESULT GetOutputRect(
        [in] DWORD dwStreamID,
        [out] NORMALIZEDRECT *pRect
        );

    HRESULT SetBackgroundClr(
        [in] COLORREF ClrBkg
        );

    HRESULT GetBackgroundClr(
        [in] COLORREF* lpClrBkg
        );

    HRESULT SetMixingPrefs(
        [in] DWORD dwMixerPrefs  // a combination of VMRMixingPrefFlags
        );

    HRESULT GetMixingPrefs(
        [out] DWORD* pdwMixerPrefs
        );
};


///////////////////////////////////////////////////////////////////////////////
//
// VMR Multimon configuration interface
//
///////////////////////////////////////////////////////////////////////////////
typedef struct tagVMRGUID {
    GUID*       pGUID; // is NULL if the default DDraw device
    GUID        GUID;   // otherwise points to this GUID
} VMRGUID;

#define VMRDEVICENAMELEN 32
#define VMRDEVICEDESCRIPTIONLEN  256

typedef struct tagVMRMONITORINFO {
    VMRGUID     guid;
    RECT        rcMonitor;
    HMONITOR    hMon;
    DWORD       dwFlags;    // described in MONITORINFOEX, currently only MONITORINFOF_PRIMARY
    wchar_t     szDevice[VMRDEVICENAMELEN];
    wchar_t     szDescription[VMRDEVICEDESCRIPTIONLEN];
    LARGE_INTEGER liDriverVersion;
    DWORD       dwVendorId;
    DWORD       dwDeviceId;
    DWORD       dwSubSysId;
    DWORD       dwRevision;
    // find out the DDCAPS using DDrawCreate on the monitor GUID
} VMRMONITORINFO;

[
    object,
    local,
    uuid(9cf0b1b6-fbaa-4b7f-88cf-cf1f130a0dce),
    helpstring("IVMRMonitorConfig Interface"),
    pointer_default(unique)
]
interface IVMRMonitorConfig : IUnknown
{
    // Use this method on a Multi-Monitor system to specify to the
    // mixer filter which Direct Draw driver should be used when connecting
    // to an upstream decoder filter.
    //
    HRESULT SetMonitor(
        [in] const VMRGUID *pGUID
        );

    // Use this method to determine the direct draw object that will be used when
    // connecting the  mixer filter to an upstream decoder filter.
    //
    HRESULT GetMonitor(
        [out] VMRGUID *pGUID
        );

    // Use this method on a multi-monitor system to specify to the
    //  mixer filter the default Direct Draw device to use when
    // connecting to an upstream filter.  The default direct draw device
    // can be overriden for a particular connection by SetMonitor method
    // described above.
    //
    HRESULT SetDefaultMonitor(
        [in] const VMRGUID *pGUID
        );

    // Use this method on a multi-monitor system to determine which
    // is the default direct draw device the overlay mixer filter
    // will  use when connecting to an upstream filter.
    //
    HRESULT GetDefaultMonitor(
        [out] VMRGUID *pGUID
        );

    // Use this method to get a list of Direct Draw device GUIDs and thier
    // associated monitor information that the mixer can use when
    // connecting to an upstream decoder filter.  Passing down a NULL pInfo
    // parameter allows the app to determine the required array size (returned
    // in pdwNumDevices).  Otherwise, dwNumDevices returns the actual
    // number of devices retrieved.
    //
    HRESULT GetAvailableMonitors(
        [out, size_is(dwMaxInfoArraySize)] VMRMONITORINFO* pInfo,
        [in] DWORD dwMaxInfoArraySize, // in array members
        [out] DWORD* pdwNumDevices // actual number of devices retrieved
        );
};




///////////////////////////////////////////////////////////////////////////////
//
// VMR Filter configuration interfaces
//
///////////////////////////////////////////////////////////////////////////////


typedef enum {
    RenderPrefs_RestrictToInitialMonitor     = 0x00000000, // not implemented do not use
    RenderPrefs_ForceOffscreen               = 0x00000001,
    RenderPrefs_ForceOverlays                = 0x00000002, // fail if no overlays
    RenderPrefs_AllowOverlays                = 0x00000000, // overlay used by default
    RenderPrefs_AllowOffscreen               = 0x00000000, // offscreen used if no overlay
    RenderPrefs_DoNotRenderColorKeyAndBorder = 0x00000008, // app paints color keys
    RenderPrefs_Reserved                     = 0x00000010, // note: used to be RestrictToInitialMonitor
    RenderPrefs_PreferAGPMemWhenMixing       = 0x00000020, // try agp mem when allocating textures

    RenderPrefs_Mask                         = 0x0000003f, // OR of all above flags
} VMRRenderPrefs;

typedef enum {
    VMRMode_Windowed                         = 0x00000001,
    VMRMode_Windowless                       = 0x00000002,
    VMRMode_Renderless                       = 0x00000004,

    // not a valid value to pass to SetRenderMode
    VMRMode_Mask                             = 0x00000007, // OR of all above flags
} VMRMode;

enum {
        MAX_NUMBER_OF_STREAMS = 16
};

[
    object,
    local,
    uuid(9e5530c5-7034-48b4-bb46-0b8a6efc8e36),
    helpstring("IVMRFilterConfig Interface"),
    pointer_default(unique)
]
interface IVMRFilterConfig : IUnknown
{
    HRESULT SetImageCompositor(
        [in] IVMRImageCompositor* lpVMRImgCompositor
        );

    HRESULT SetNumberOfStreams(
        [in] DWORD dwMaxStreams
        );

    HRESULT GetNumberOfStreams(
        [out] DWORD* pdwMaxStreams
        );

    HRESULT SetRenderingPrefs(
        [in] DWORD dwRenderFlags  // a combination of VMRRenderingPrefFlags
        );

    HRESULT GetRenderingPrefs(
        [out] DWORD* pdwRenderFlags
        );

    HRESULT SetRenderingMode(
        [in] DWORD Mode  // a combination of VMRMode
        );

    HRESULT GetRenderingMode(
        [out] DWORD* pMode
        );
}


//=====================================================================
//
// IVMRAspectRatioControl
//
//=====================================================================
[
    object,
    local,
    uuid(ede80b5c-bad6-4623-b537-65586c9f8dfd),
    helpstring("IVMRAspectRatioControl Interface"),
    pointer_default(unique)
]
interface IVMRAspectRatioControl : IUnknown
{
    HRESULT GetAspectRatioMode(
        [out] LPDWORD lpdwARMode
            );

    HRESULT SetAspectRatioMode(
        [in] DWORD dwARMode
            );
}


//=====================================================================
//
// IVMRDeinterlaceControl
//
// New interfaced introduced into the WindowsXP SP1 release of the VMR.
// This interface allows applications to control the DX-VA deinterlacing
// support provided by the VMR.
//
// The VMR needs to be set into "mixing" mode for this interface to work.
//
// SetDeinterlaceMode is only effective for new connections made to the
// VMR.  It should be noted that the graphics device driver may refuse
// to use the specified deinterlace mode, in which case 3 fallback
// policies are offered by the VMR, these being:
//
//      1. Fallback to the next best mode offered by the driver.
//      2. Fallback to the BOB deinterlace mode.
//      3. Fallback to the WEAVE deinterlace mode (ie. turn deinterlacing off).
//
//=====================================================================

typedef enum {
    DeinterlacePref_NextBest = 0x01,
    DeinterlacePref_BOB = 0x02,
    DeinterlacePref_Weave = 0x04,
    DeinterlacePref_Mask = 0x07
} VMRDeinterlacePrefs;

typedef enum {

    // the algorithm is unknown or proprietary
    DeinterlaceTech_Unknown                = 0x0000,

    // the algorithm creates the missing lines by repeating
    // the line either above or below it - this method will look very jaggy and
    // isn't recommended
    DeinterlaceTech_BOBLineReplicate       = 0x0001,


    // the algorithm creates the missing lines by vertically stretching each
    // video field by a factor of two, for example by averaging two lines or
    // using a [-1, 9, 9, -1]/16 filter across four lines.
    // Slight vertical adjustments are made to ensure that the resulting image
    // does not "bob" up and down.
    DeinterlaceTech_BOBVerticalStretch     = 0x0002,

    // the pixels in the missing line are recreated by a median filtering operation
    DeinterlaceTech_MedianFiltering        = 0x0004,

    // the pixels in the missing line are recreated by an edge filter.
    // In this process, spatial directional filters are applied to determine
    // the orientation of edges in the picture content, and missing
    // pixels are created by filtering along (rather than across) the
    // detected edges.
    DeinterlaceTech_EdgeFiltering          = 0x0010,

    // the pixels in the missing line are recreated by switching on a field by
    // field basis between using either spatial or temporal interpolation
    // depending on the amount of motion.
    DeinterlaceTech_FieldAdaptive          = 0x0020,

    // the pixels in the missing line are recreated by switching on a pixel by pixel
    // basis between using either spatial or temporal interpolation depending on
    // the amount of motion..
    DeinterlaceTech_PixelAdaptive          = 0x0040,

    // Motion Vector Steering  identifies objects within a sequence of video
    // fields.  The missing pixels are recreated after first aligning the
    // movement axes of the individual objects in the scene to make them
    // parallel with the time axis.
    DeinterlaceTech_MotionVectorSteered      = 0x0080

} VMRDeinterlaceTech;

typedef struct _VMRFrequency {
    DWORD dwNumerator;
    DWORD dwDenominator;
} VMRFrequency;

typedef struct _VMRVideoDesc {
    DWORD               dwSize;
    DWORD               dwSampleWidth;
    DWORD               dwSampleHeight;
    BOOL                SingleFieldPerSample;
    DWORD               dwFourCC;
    VMRFrequency        InputSampleFreq;
    VMRFrequency        OutputFrameFreq;
} VMRVideoDesc;

typedef struct _VMRDeinterlaceCaps {
    DWORD               dwSize;
    DWORD               dwNumPreviousOutputFrames;
    DWORD               dwNumForwardRefSamples;
    DWORD               dwNumBackwardRefSamples;
    VMRDeinterlaceTech  DeinterlaceTechnology;
} VMRDeinterlaceCaps;

[
    object,
    local,
    uuid(bb057577-0db8-4e6a-87a7-1a8c9a505a0f),
    helpstring("IVMRDeinterlaceControl Interface"),
    pointer_default(unique)
]
interface IVMRDeinterlaceControl : IUnknown
{
    //
    // For the specified video description returns the
    // number of deinterlacing modes available to the VMR.
    // The deinterlacing modes are returned in descending
    // quality order ie. the best quality mode is at
    // lpdwNumDeinterlaceModes[0], the next best at
    // lpdwNumDeinterlaceModes[1] and so on.
    //
    // To determine how big an array of guids to pass to the
    // GetNumberOfDeinterlaceModes method call
    // GetNumberOfDeinterlaceModes(lpVideoDescription, &dwNumModes, NULL);
    //
    HRESULT GetNumberOfDeinterlaceModes(
        [in] VMRVideoDesc* lpVideoDescription,
        [in] [out] LPDWORD lpdwNumDeinterlaceModes,
        [out] LPGUID lpDeinterlaceModes
        );

    //
    // For the given video description get the capabilities of the
    // specified de-interlace mode.
    //
    HRESULT GetDeinterlaceModeCaps(
        [in] LPGUID lpDeinterlaceMode,
        [in] VMRVideoDesc* lpVideoDescription,
        [in] [out] VMRDeinterlaceCaps* lpDeinterlaceCaps
        );

    //
    // Get/Set the deinterlace mode that you would like the
    // VMR to use when de-interlacing the specified stream.
    // It should be noted that the VMR may not actually be able
    // to use the requested deinterlace mode, in which case the
    // the VMR will fall back to other de-interlace modes as specified
    // by the de-interlace preferences (see SetDeinterlacePrefs below).
    //
    HRESULT GetDeinterlaceMode(
        [in] DWORD dwStreamID,
        [out] LPGUID lpDeinterlaceMode  // returns GUID_NULL if SetDeinterlaceMode
        );                              // has not been called yet.

    HRESULT SetDeinterlaceMode(
        [in] DWORD dwStreamID,          // use 0xFFFFFFFF to set mode for all streams
        [in] LPGUID lpDeinterlaceMode   // GUID_NULL == turn deinterlacing off
        );


    HRESULT GetDeinterlacePrefs(
        [out] LPDWORD lpdwDeinterlacePrefs
        );

    HRESULT SetDeinterlacePrefs(
        [in] DWORD dwDeinterlacePrefs
        );

    //
    // Get the DeinterlaceMode currently in use for the specified
    // video stream (ie. pin).  The returned GUID will be NULL if
    // the de-interlacing h/w has not been created by the VMR at the
    // time the function is called, or if the VMR determines that
    // this stream should not or can be de-interlaced.
    //
    HRESULT GetActualDeinterlaceMode(
        [in] DWORD dwStreamID,
        [out] LPGUID lpDeinterlaceMode
        );
}


//=====================================================================
//
// IVMRMixerBitmap
//
//=====================================================================
typedef struct _VMRALPHABITMAP
{
    DWORD                   dwFlags;    // flags word
    HDC                     hdc;        // DC for the bitmap to copy
    LPDIRECTDRAWSURFACE7    pDDS;       // DirectDraw surface to copy
    RECT                    rSrc;       // rectangle to copy from the DC/DDS
    NORMALIZEDRECT          rDest;      // output rectangle in composition space
    FLOAT	            fAlpha;     // opacity of the bitmap
    COLORREF                clrSrcKey;  // src color key
} VMRALPHABITMAP, *PVMRALPHABITMAP;

// Disable the alpha bitmap for now
cpp_quote("#define VMRBITMAP_DISABLE            0x00000001")

// Take the bitmap from the HDC rather than the DirectDraw surface
cpp_quote("#define VMRBITMAP_HDC                0x00000002")

// Take the entire DDraw surface - rSrc is ignored
cpp_quote("#define VMRBITMAP_ENTIREDDS          0x00000004")

// Indicates that the clrTrans value is valid and should be
// used when blending
cpp_quote("#define VMRBITMAP_SRCCOLORKEY        0x00000008")

// Indicates that the rSrc rectangle is valid and specifies a
// sub-rectangle of the of original app image to be blended.
// Use of this parameter enables "Image Strips"
cpp_quote("#define VMRBITMAP_SRCRECT            0x00000010")

[
    object,
    local,
    uuid(1E673275-0257-40aa-AF20-7C608D4A0428),
    helpstring("IVMRMixerBitmap Interface"),
    pointer_default(unique)
]
interface IVMRMixerBitmap : IUnknown
{
    // Set bitmap, location to blend it, and blending value
    HRESULT SetAlphaBitmap(
        [in] const VMRALPHABITMAP *pBmpParms
        );

    // Change bitmap location, size and blending value,
    // graph must be running for change to take effect.
    HRESULT UpdateAlphaBitmapParameters(
        [in] PVMRALPHABITMAP pBmpParms
        );

    // Get bitmap, location to blend it, and blending value
    HRESULT GetAlphaBitmapParameters(
        [out] PVMRALPHABITMAP pBmpParms
        );
};





//=====================================================================
//
// IVMRImageCompositor
//
//=====================================================================

typedef struct _VMRVIDEOSTREAMINFO {
    LPDIRECTDRAWSURFACE7        pddsVideoSurface;
    DWORD                       dwWidth, dwHeight;
    DWORD                       dwStrmID;
    FLOAT                       fAlpha;
    DDCOLORKEY                  ddClrKey;
    NORMALIZEDRECT              rNormal;
} VMRVIDEOSTREAMINFO;
[
    local,
    object,
    local,
    uuid(7a4fb5af-479f-4074-bb40-ce6722e43c82),
    helpstring("IVMRImageCompositor Interface"),
    pointer_default(unique)
]
interface IVMRImageCompositor : IUnknown
{
    HRESULT InitCompositionTarget(
        [in] IUnknown* pD3DDevice,
        [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget
        );

    HRESULT TermCompositionTarget(
        [in] IUnknown* pD3DDevice,
        [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget
        );

    HRESULT SetStreamMediaType(
        [in] DWORD dwStrmID,
        [in] AM_MEDIA_TYPE* pmt,
        [in] BOOL fTexture
        );

    HRESULT CompositeImage(
        [in] IUnknown* pD3DDevice,
        [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget,
        [in] AM_MEDIA_TYPE* pmtRenderTarget,
        [in] REFERENCE_TIME rtStart,
        [in] REFERENCE_TIME rtEnd,
        [in] DWORD dwClrBkGnd,
        [in] VMRVIDEOSTREAMINFO* pVideoStreamInfo,
        [in] UINT cStreams
        );
};



//=====================================================================
//
// IVMRVideoStreamControl
//
//=====================================================================
[
    object,
    local,
    uuid(058d1f11-2a54-4bef-bd54-df706626b727),
    helpstring("IVMRMixerStreamConfig Interface"),
    pointer_default(unique)
]
interface IVMRVideoStreamControl: IUnknown
{
    HRESULT SetColorKey(
        [in] LPDDCOLORKEY lpClrKey // Source color key, set to 0xFFFFFFFF to disable
        );

    HRESULT GetColorKey(
        [out] LPDDCOLORKEY lpClrKey
        );


    HRESULT SetStreamActiveState(
        [in] BOOL fActive
        );

    HRESULT GetStreamActiveState(
        [out] BOOL* lpfActive
        );
};



//=====================================================================
//
// IVMRSurface
//
//=====================================================================
[
    local,
    object,
    local,
    uuid(a9849bbe-9ec8-4263-b764-62730f0d15d0),
    helpstring("IVMRSurface Interface"),
    pointer_default(unique)
]
interface IVMRSurface : IUnknown
{
    HRESULT IsSurfaceLocked();

    HRESULT LockSurface(
        [out] BYTE** lpSurface
        );

    HRESULT UnlockSurface();

    HRESULT GetSurface(
        [out] LPDIRECTDRAWSURFACE7 *lplpSurface
        );
};



//=====================================================================
//
// IID_IVMRImagePresenterConfig - this interface allows applications
// to configure the default Microsoft provided allocator-presenter
// inorder to simplify the implementation of their own
// allocator-presenter plug-in.
//
//=====================================================================
[
    local,
    object,
    local,
    uuid(9f3a1c85-8555-49ba-935f-be5b5b29d178),
    helpstring("IVMRImagePresenterConfig Interface"),
    pointer_default(unique)
]

interface IVMRImagePresenterConfig : IUnknown
{

    HRESULT SetRenderingPrefs(
        [in] DWORD dwRenderFlags   // see VMRRenderPrefs for valid flags
        );

    HRESULT GetRenderingPrefs(
        [out] DWORD* dwRenderFlags // see VMRRenderPrefs for valid flags
        );

}

//=====================================================================
//
// IID_IVMRImagePresenterExclModeConfig - this interface allows applications
// to configure the DDraw exclusive mode allocator-presenter.  This
// interface extends the IVMRImagePresenterConfig interface defined
// above and is only implemented by the CLSID_AllocPresenterDDXclMode
// allocator-presenter object.
//
//=====================================================================
[
    local,
    object,
    local,
    uuid(e6f7ce40-4673-44f1-8f77-5499d68cb4ea),
    helpstring("IVMRImagePresenterExclModeConfig Interface"),
    pointer_default(unique)
]

interface IVMRImagePresenterExclModeConfig : IVMRImagePresenterConfig
{
    HRESULT SetXlcModeDDObjAndPrimarySurface(
        [in] LPDIRECTDRAW7 lpDDObj,
        [in] LPDIRECTDRAWSURFACE7 lpPrimarySurf
        );

    HRESULT GetXlcModeDDObjAndPrimarySurface(
        [out] LPDIRECTDRAW7* lpDDObj,
        [out] LPDIRECTDRAWSURFACE7* lpPrimarySurf
        );
}


//=====================================================================
//
// IVPManager
//
//=====================================================================
[
    local,
    object,
    local,
    uuid(aac18c18-e186-46d2-825d-a1f8dc8e395a),
    helpstring("IVPManager Interface"),
    pointer_default(unique)
]
interface IVPManager : IUnknown
{
    // Use this method on a Multi-Monitor system to specify to the
    // video port manager filter which videoport index is used
    // to an upstream decoder filter.
    //
    HRESULT SetVideoPortIndex(
        [in] DWORD dwVideoPortIndex // the video port number that this is connected to
        );

    // This method returns the current video port index being used by the VPM.
    //
    HRESULT GetVideoPortIndex(
        [out] DWORD* pdwVideoPortIndex // the video port number that this is connected to
        );
};