1 // Copyright © 2015-2017 winapi-rs developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
5 // All files in the project carrying such notice may not be copied, modified, or distributed
6 // except according to those terms.
7 use ctypes::{c_float, c_void};
8 use shared::basetsd::UINT64;
9 use shared::d3d9::{IDirect3DDevice9, IDirect3DSurface9};
10 use shared::d3d9types::{D3DFORMAT, D3DPOOL};
11 use shared::guiddef::{GUID, REFGUID, REFIID};
12 use shared::minwindef::{BOOL, DWORD, FLOAT, HIWORD, LOWORD, UCHAR, UINT, USHORT};
13 use shared::windef::{RECT, SIZE};
14 use um::unknwnbase::{IUnknown, IUnknownVtbl};
15 use um::winnt::{HANDLE, HRESULT, LONG, LONGLONG, PVOID, SHORT};
16 DEFINE_GUID!{DXVA2_ModeMPEG2_MoComp,
17 0xe6a9f44b, 0x61b0, 0x4563, 0x9e, 0xa4, 0x63, 0xd2, 0xa3, 0xc6, 0xfe, 0x66}
18 DEFINE_GUID!{DXVA2_ModeMPEG2_IDCT,
19 0xbf22ad00, 0x03ea, 0x4690, 0x80, 0x77, 0x47, 0x33, 0x46, 0x20, 0x9b, 0x7e}
20 DEFINE_GUID!{DXVA2_ModeMPEG2_VLD,
21 0xee27417f, 0x5e28, 0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9}
22 DEFINE_GUID!{DXVA2_ModeMPEG1_VLD,
23 0x6f3ec719, 0x3735, 0x42cc, 0x80, 0x63, 0x65, 0xcc, 0x3c, 0xb3, 0x66, 0x16}
24 DEFINE_GUID!{DXVA2_ModeMPEG2and1_VLD,
25 0x86695f12, 0x340e, 0x4f04, 0x9f, 0xd3, 0x92, 0x53, 0xdd, 0x32, 0x74, 0x60}
26 DEFINE_GUID!{DXVA2_ModeH264_A,
27 0x1b81be64, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
28 DEFINE_GUID!{DXVA2_ModeH264_B,
29 0x1b81be65, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
30 DEFINE_GUID!{DXVA2_ModeH264_C,
31 0x1b81be66, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
32 DEFINE_GUID!{DXVA2_ModeH264_D,
33 0x1b81be67, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
34 DEFINE_GUID!{DXVA2_ModeH264_E,
35 0x1b81be68, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
36 DEFINE_GUID!{DXVA2_ModeH264_F,
37 0x1b81be69, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
38 DEFINE_GUID!{DXVA2_ModeH264_VLD_WithFMOASO_NoFGT,
39 0xd5f04ff9, 0x3418, 0x45d8, 0x95, 0x61, 0x32, 0xa7, 0x6a, 0xae, 0x2d, 0xdd}
40 DEFINE_GUID!{DXVA2_ModeH264_VLD_Stereo_Progressive_NoFGT,
41 0xd79be8da, 0x0cf1, 0x4c81, 0xb8, 0x2a, 0x69, 0xa4, 0xe2, 0x36, 0xf4, 0x3d}
42 DEFINE_GUID!{DXVA2_ModeH264_VLD_Stereo_NoFGT,
43 0xf9aaccbb, 0xc2b6, 0x4cfc, 0x87, 0x79, 0x57, 0x07, 0xb1, 0x76, 0x05, 0x52}
44 DEFINE_GUID!{DXVA2_ModeH264_VLD_Multiview_NoFGT,
45 0x705b9d82, 0x76cf, 0x49d6, 0xb7, 0xe6, 0xac, 0x88, 0x72, 0xdb, 0x01, 0x3c}
46 DEFINE_GUID!{DXVA2_ModeWMV8_A,
47 0x1b81be80, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
48 DEFINE_GUID!{DXVA2_ModeWMV8_B,
49 0x1b81be81, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
50 DEFINE_GUID!{DXVA2_ModeWMV9_A,
51 0x1b81be90, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
52 DEFINE_GUID!{DXVA2_ModeWMV9_B,
53 0x1b81be91, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
54 DEFINE_GUID!{DXVA2_ModeWMV9_C,
55 0x1b81be94, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
56 DEFINE_GUID!{DXVA2_ModeVC1_A,
57 0x1b81bea0, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
58 DEFINE_GUID!{DXVA2_ModeVC1_B,
59 0x1b81bea1, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
60 DEFINE_GUID!{DXVA2_ModeVC1_C,
61 0x1b81bea2, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
62 DEFINE_GUID!{DXVA2_ModeVC1_D,
63 0x1b81bea3, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
64 DEFINE_GUID!{DXVA2_ModeVC1_D2010,
65 0x1b81bea4, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
66 DEFINE_GUID!{DXVA2_NoEncrypt,
67 0x1b81bed0, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5}
68 DEFINE_GUID!{DXVA2_VideoProcProgressiveDevice,
69 0x5a54a0c9, 0xc7ec, 0x4bd9, 0x8e, 0xde, 0xf3, 0xc7, 0x5d, 0xc4, 0x39, 0x3b}
70 DEFINE_GUID!{DXVA2_VideoProcBobDevice,
71 0x335aa36e, 0x7884, 0x43a4, 0x9c, 0x91, 0x7f, 0x87, 0xfa, 0xf3, 0xe3, 0x7e}
72 DEFINE_GUID!{DXVA2_VideoProcSoftwareDevice,
73 0x4553d47f, 0xee7e, 0x4e3f, 0x94, 0x75, 0xdb, 0xf1, 0x37, 0x6c, 0x48, 0x10}
74 DEFINE_GUID!{DXVA2_ModeMPEG4pt2_VLD_Simple,
75 0xefd64d74, 0xc9e8, 0x41d7, 0xa5, 0xe9, 0xe9, 0xb0, 0xe3, 0x9f, 0xa3, 0x19}
76 DEFINE_GUID!{DXVA2_ModeMPEG4pt2_VLD_AdvSimple_NoGMC,
77 0xed418a9f, 0x010d, 0x4eda, 0x9a, 0xe3, 0x9a, 0x65, 0x35, 0x8d, 0x8d, 0x2e}
78 DEFINE_GUID!{DXVA2_ModeMPEG4pt2_VLD_AdvSimple_GMC,
79 0xab998b5b, 0x4258, 0x44a9, 0x9f, 0xeb, 0x94, 0xe5, 0x97, 0xa6, 0xba, 0xae}
80 DEFINE_GUID!{DXVA2_ModeHEVC_VLD_Main,
81 0x5b11d51b, 0x2f4c, 0x4452, 0xbc, 0xc3, 0x09, 0xf2, 0xa1, 0x16, 0x0c, 0xc0}
82 DEFINE_GUID!{DXVA2_ModeHEVC_VLD_Main10,
83 0x107af0e0, 0xef1a, 0x4d19, 0xab, 0xa8, 0x67, 0xa1, 0x63, 0x07, 0x3d, 0x13}
84 DEFINE_GUID!{DXVA2_ModeVP9_VLD_Profile0,
85 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e}
86 DEFINE_GUID!{DXVA2_ModeVP9_VLD_10bit_Profile2,
87 0xa4c749ef, 0x6ecf, 0x48aa, 0x84, 0x48, 0x50, 0xa7, 0xa1, 0x16, 0x5f, 0xf7}
88 DEFINE_GUID!{DXVA2_ModeVP8_VLD,
89 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7}
90 pub const DXVA2_ModeMPEG2_MOCOMP: GUID = DXVA2_ModeMPEG2_MoComp;
91 pub const DXVA2_ModeWMV8_PostProc: GUID = DXVA2_ModeWMV8_A;
92 pub const DXVA2_ModeWMV8_MoComp: GUID = DXVA2_ModeWMV8_B;
93 pub const DXVA2_ModeWMV9_PostProc: GUID = DXVA2_ModeWMV9_A;
94 pub const DXVA2_ModeWMV9_MoComp: GUID = DXVA2_ModeWMV9_B;
95 pub const DXVA2_ModeWMV9_IDCT: GUID = DXVA2_ModeWMV9_C;
96 pub const DXVA2_ModeVC1_PostProc: GUID = DXVA2_ModeVC1_A;
97 pub const DXVA2_ModeVC1_MoComp: GUID = DXVA2_ModeVC1_B;
98 pub const DXVA2_ModeVC1_IDCT: GUID = DXVA2_ModeVC1_C;
99 pub const DXVA2_ModeVC1_VLD: GUID = DXVA2_ModeVC1_D;
100 pub const DXVA2_ModeH264_MoComp_NoFGT: GUID = DXVA2_ModeH264_A;
101 pub const DXVA2_ModeH264_MoComp_FGT: GUID = DXVA2_ModeH264_B;
102 pub const DXVA2_ModeH264_IDCT_NoFGT: GUID = DXVA2_ModeH264_C;
103 pub const DXVA2_ModeH264_IDCT_FGT: GUID = DXVA2_ModeH264_D;
104 pub const DXVA2_ModeH264_VLD_NoFGT: GUID = DXVA2_ModeH264_E;
105 pub const DXVA2_ModeH264_VLD_FGT: GUID = DXVA2_ModeH264_F;
106 pub const DXVA2_E_NOT_INITIALIZED: HRESULT = 0x80041000;
107 pub const DXVA2_E_NEW_VIDEO_DEVICE: HRESULT = 0x80041001;
108 pub const DXVA2_E_VIDEO_DEVICE_LOCKED: HRESULT = 0x80041002;
109 pub const DXVA2_E_NOT_AVAILABLE: HRESULT = 0x80041003;
110 DEFINE_GUID!{IID_IDirect3DDeviceManager9,
111 0xa0cade0f, 0x06d5, 0x4cf4, 0xa1, 0xc7, 0xf3, 0xcd, 0xd7, 0x25, 0xaa, 0x75}
112 DEFINE_GUID!{IID_IDirectXVideoAccelerationService,
113 0xfc51a550, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x00, 0x05, 0x4e, 0x43, 0xff, 0x02}
114 DEFINE_GUID!{IID_IDirectXVideoDecoderService,
115 0xfc51a551, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x00, 0x05, 0x4e, 0x43, 0xff, 0x02}
116 DEFINE_GUID!{IID_IDirectXVideoProcessorService,
117 0xfc51a552, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x00, 0x05, 0x4e, 0x43, 0xff, 0x02}
118 DEFINE_GUID!{IID_IDirectXVideoDecoder,
119 0xf2b0810a, 0xfd00, 0x43c9, 0x91, 0x8c, 0xdf, 0x94, 0xe2, 0xd8, 0xef, 0x7d}
120 DEFINE_GUID!{IID_IDirectXVideoProcessor,
121 0x8c3a39f0, 0x916e, 0x4690, 0x80, 0x4f, 0x4c, 0x80, 0x01, 0x35, 0x5d, 0x25}
122 DEFINE_GUID!{IID_IDirectXVideoMemoryConfiguration,
123 0xb7f916dd, 0xdb3b, 0x49c1, 0x84, 0xd7, 0xe4, 0x5e, 0xf9, 0x9e, 0xc7, 0x26}
124 pub const MAX_DEINTERLACE_SURFACES: usize = 32;
125 pub const MAX_SUBSTREAMS: usize = 15;
126 STRUCT!{struct DXVA2_ExtendedFormat {
127 value: UINT,
128 }}
129 BITFIELD!{DXVA2_ExtendedFormat value: UINT [
130 SampleFormat set_SampleFormat[0..8],
131 VideoChromaSubsampling set_VideoChromaSubsampling[8..12],
132 NominalRange set_NominalRange[12..15],
133 VideoTransferMatrix set_VideoTransferMatrix[15..18],
134 VideoLighting set_VideoLighting[18..22],
135 VideoPrimaries set_VideoPrimaries[22..27],
136 VideoTransferFunction set_VideoTransferFunction[27..32],
137 ]}
138 ENUM!{enum DXVA2_SampleFormat {
139 DXVA2_SampleFormatMask = 0xff,
140 DXVA2_SampleUnknown = 0,
141 DXVA2_SampleProgressiveFrame = 2,
142 DXVA2_SampleFieldInterleavedEvenFirst = 3,
143 DXVA2_SampleFieldInterleavedOddFirst = 4,
144 DXVA2_SampleFieldSingleEven = 5,
145 DXVA2_SampleFieldSingleOdd = 6,
146 DXVA2_SampleSubStream = 7,
147 }}
148 ENUM!{enum DXVA2_VideoChromaSubSampling {
149 DXVA2_VideoChromaSubsamplingMask = 0xf,
150 DXVA2_VideoChromaSubsampling_Unknown = 0,
151 DXVA2_VideoChromaSubsampling_ProgressiveChroma = 0x8,
152 DXVA2_VideoChromaSubsampling_Horizontally_Cosited = 0x4,
153 DXVA2_VideoChromaSubsampling_Vertically_Cosited = 0x2,
154 DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes = 0x1,
155 DXVA2_VideoChromaSubsampling_MPEG2 = DXVA2_VideoChromaSubsampling_Horizontally_Cosited |
156 DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
157 DXVA2_VideoChromaSubsampling_MPEG1 =
158 DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
159 DXVA2_VideoChromaSubsampling_DV_PAL = DXVA2_VideoChromaSubsampling_Horizontally_Cosited |
160 DXVA2_VideoChromaSubsampling_Vertically_Cosited,
161 DXVA2_VideoChromaSubsampling_Cosited = DXVA2_VideoChromaSubsampling_Horizontally_Cosited |
162 DXVA2_VideoChromaSubsampling_Vertically_Cosited |
163 DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,
164 }}
165 ENUM!{enum DXVA2_NominalRange {
166 DXVA2_NominalRangeMask = 0x7,
167 DXVA2_NominalRange_Unknown = 0,
168 DXVA2_NominalRange_Normal = 1,
169 DXVA2_NominalRange_Wide = 2,
170 DXVA2_NominalRange_0_255 = 1,
171 DXVA2_NominalRange_16_235 = 2,
172 DXVA2_NominalRange_48_208 = 3,
173 }}
174 ENUM!{enum DXVA2_VideoTransferMatrix {
175 DXVA2_VideoTransferMatrixMask = 0x7,
176 DXVA2_VideoTransferMatrix_Unknown = 0,
177 DXVA2_VideoTransferMatrix_BT709 = 1,
178 DXVA2_VideoTransferMatrix_BT601 = 2,
179 DXVA2_VideoTransferMatrix_SMPTE240M = 3,
180 }}
181 ENUM!{enum DXVA2_VideoLighting {
182 DXVA2_VideoLightingMask = 0xf,
183 DXVA2_VideoLighting_Unknown = 0,
184 DXVA2_VideoLighting_bright = 1,
185 DXVA2_VideoLighting_office = 2,
186 DXVA2_VideoLighting_dim = 3,
187 DXVA2_VideoLighting_dark = 4,
188 }}
189 ENUM!{enum DXVA2_VideoPrimaries {
190 DXVA2_VideoPrimariesMask = 0x1f,
191 DXVA2_VideoPrimaries_Unknown = 0,
192 DXVA2_VideoPrimaries_reserved = 1,
193 DXVA2_VideoPrimaries_BT709 = 2,
194 DXVA2_VideoPrimaries_BT470_2_SysM = 3,
195 DXVA2_VideoPrimaries_BT470_2_SysBG = 4,
196 DXVA2_VideoPrimaries_SMPTE170M = 5,
197 DXVA2_VideoPrimaries_SMPTE240M = 6,
198 DXVA2_VideoPrimaries_EBU3213 = 7,
199 DXVA2_VideoPrimaries_SMPTE_C = 8,
200 }}
201 ENUM!{enum DXVA2_VideoTransferFunction {
202 DXVA2_VideoTransFuncMask = 0x1f,
203 DXVA2_VideoTransFunc_Unknown = 0,
204 DXVA2_VideoTransFunc_10 = 1,
205 DXVA2_VideoTransFunc_18 = 2,
206 DXVA2_VideoTransFunc_20 = 3,
207 DXVA2_VideoTransFunc_22 = 4,
208 DXVA2_VideoTransFunc_709 = 5,
209 DXVA2_VideoTransFunc_240M = 6,
210 DXVA2_VideoTransFunc_sRGB = 7,
211 DXVA2_VideoTransFunc_28 = 8,
212 }}
213 pub const DXVA2_VideoTransFunc_22_709: DWORD = DXVA2_VideoTransFunc_709;
214 pub const DXVA2_VideoTransFunc_22_240M: DWORD = DXVA2_VideoTransFunc_240M;
215 pub const DXVA2_VideoTransFunc_22_8bit_sRGB: DWORD = DXVA2_VideoTransFunc_sRGB;
216 STRUCT!{struct DXVA2_Frequency {
217 Numerator: UINT,
218 Denominator: UINT,
219 }}
220 STRUCT!{struct DXVA2_VideoDesc {
221 SampleWidth: UINT,
222 SampleHeight: UINT,
223 SampleFormat: DXVA2_ExtendedFormat,
224 Format: D3DFORMAT,
225 InputSampleFreq: DXVA2_Frequency,
226 OutputFrameFreq: DXVA2_Frequency,
227 UABProtectionLevel: UINT,
228 Reserved: UINT,
229 }}
230 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0003 {
231 DXVA2_DeinterlaceTech_Unknown = 0,
232 DXVA2_DeinterlaceTech_BOBLineReplicate = 0x1,
233 DXVA2_DeinterlaceTech_BOBVerticalStretch = 0x2,
234 DXVA2_DeinterlaceTech_BOBVerticalStretch4Tap = 0x4,
235 DXVA2_DeinterlaceTech_MedianFiltering = 0x8,
236 DXVA2_DeinterlaceTech_EdgeFiltering = 0x10,
237 DXVA2_DeinterlaceTech_FieldAdaptive = 0x20,
238 DXVA2_DeinterlaceTech_PixelAdaptive = 0x40,
239 DXVA2_DeinterlaceTech_MotionVectorSteered = 0x80,
240 DXVA2_DeinterlaceTech_InverseTelecine = 0x100,
241 DXVA2_DeinterlaceTech_Mask = 0x1ff,
242 }}
243 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0004 {
244 DXVA2_NoiseFilterLumaLevel = 1,
245 DXVA2_NoiseFilterLumaThreshold = 2,
246 DXVA2_NoiseFilterLumaRadius = 3,
247 DXVA2_NoiseFilterChromaLevel = 4,
248 DXVA2_NoiseFilterChromaThreshold = 5,
249 DXVA2_NoiseFilterChromaRadius = 6,
250 DXVA2_DetailFilterLumaLevel = 7,
251 DXVA2_DetailFilterLumaThreshold = 8,
252 DXVA2_DetailFilterLumaRadius = 9,
253 DXVA2_DetailFilterChromaLevel = 10,
254 DXVA2_DetailFilterChromaThreshold = 11,
255 DXVA2_DetailFilterChromaRadius = 12,
256 }}
257 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0005 {
258 DXVA2_NoiseFilterTech_Unsupported = 0,
259 DXVA2_NoiseFilterTech_Unknown = 0x1,
260 DXVA2_NoiseFilterTech_Median = 0x2,
261 DXVA2_NoiseFilterTech_Temporal = 0x4,
262 DXVA2_NoiseFilterTech_BlockNoise = 0x8,
263 DXVA2_NoiseFilterTech_MosquitoNoise = 0x10,
264 DXVA2_NoiseFilterTech_Mask = 0x1f,
265 }}
266 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0006 {
267 DXVA2_DetailFilterTech_Unsupported = 0,
268 DXVA2_DetailFilterTech_Unknown = 0x1,
269 DXVA2_DetailFilterTech_Edge = 0x2,
270 DXVA2_DetailFilterTech_Sharpening = 0x4,
271 DXVA2_DetailFilterTech_Mask = 0x7,
272 }}
273 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0007 {
274 DXVA2_ProcAmp_None = 0,
275 DXVA2_ProcAmp_Brightness = 0x1,
276 DXVA2_ProcAmp_Contrast = 0x2,
277 DXVA2_ProcAmp_Hue = 0x4,
278 DXVA2_ProcAmp_Saturation = 0x8,
279 DXVA2_ProcAmp_Mask = 0xf,
280 }}
281 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0008 {
282 DXVA2_VideoProcess_None = 0,
283 DXVA2_VideoProcess_YUV2RGB = 0x1,
284 DXVA2_VideoProcess_StretchX = 0x2,
285 DXVA2_VideoProcess_StretchY = 0x4,
286 DXVA2_VideoProcess_AlphaBlend = 0x8,
287 DXVA2_VideoProcess_SubRects = 0x10,
288 DXVA2_VideoProcess_SubStreams = 0x20,
289 DXVA2_VideoProcess_SubStreamsExtended = 0x40,
290 DXVA2_VideoProcess_YUV2RGBExtended = 0x80,
291 DXVA2_VideoProcess_AlphaBlendExtended = 0x100,
292 DXVA2_VideoProcess_Constriction = 0x200,
293 DXVA2_VideoProcess_NoiseFilter = 0x400,
294 DXVA2_VideoProcess_DetailFilter = 0x800,
295 DXVA2_VideoProcess_PlanarAlpha = 0x1000,
296 DXVA2_VideoProcess_LinearScaling = 0x2000,
297 DXVA2_VideoProcess_GammaCompensated = 0x4000,
298 DXVA2_VideoProcess_MaintainsOriginalFieldData = 0x8000,
299 DXVA2_VideoProcess_Mask = 0xffff,
300 }}
301 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0009 {
302 DXVA2_VPDev_HardwareDevice = 0x1,
303 DXVA2_VPDev_EmulatedDXVA1 = 0x2,
304 DXVA2_VPDev_SoftwareDevice = 0x4,
305 DXVA2_VPDev_Mask = 0x7,
306 }}
307 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0010 {
308 DXVA2_SampleData_RFF = 0x1,
309 DXVA2_SampleData_TFF = 0x2,
310 DXVA2_SampleData_RFF_TFF_Present = 0x4,
311 DXVA2_SampleData_Mask = 0xffff,
312 }}
313 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0011 {
314 DXVA2_DestData_RFF = 0x1,
315 DXVA2_DestData_TFF = 0x2,
316 DXVA2_DestData_RFF_TFF_Present = 0x4,
317 DXVA2_DestData_Mask = 0xffff,
318 }}
319 STRUCT!{struct DXVA2_VideoProcessorCaps {
320 DeviceCaps: UINT,
321 InputPool: D3DPOOL,
322 NumForwardRefSamples: UINT,
323 NumBackwardRefSamples: UINT,
324 Reserved: UINT,
325 DeinterlaceTechnology: UINT,
326 ProcAmpControlCaps: UINT,
327 VideoProcessorOperations: UINT,
328 NoiseFilterTechnology: UINT,
329 DetailFilterTechnology: UINT,
330 }}
331 STRUCT!{struct DXVA2_Fixed32_s {
332 Fraction: USHORT,
333 Value: SHORT,
334 }}
335 UNION!{union DXVA2_Fixed32 {
336 [u32; 1],
337 s s_mut: DXVA2_Fixed32_s,
338 ll s_ll: LONG,
339 }}
340 STRUCT!{struct DXVA2_AYUVSample8 {
341 Cr: UCHAR,
342 Cb: UCHAR,
343 Y: UCHAR,
344 Alpha: UCHAR,
345 }}
346 STRUCT!{struct DXVA2_AYUVSample16 {
347 Cr: USHORT,
348 Cb: USHORT,
349 Y: USHORT,
350 Alpha: USHORT,
351 }}
352 pub type REFERENCE_TIME = LONGLONG;
353 STRUCT!{struct DXVA2_VideoSample {
354 Start: REFERENCE_TIME,
355 End: REFERENCE_TIME,
356 SampleFormat: DXVA2_ExtendedFormat,
357 SrcSurface: *mut IDirect3DSurface9,
358 SrcRect: RECT,
359 DstRect: RECT,
360 Pal: [DXVA2_AYUVSample8; 16],
361 PlanarAlpha: DXVA2_Fixed32,
362 SampleData: DWORD,
363 }}
364 STRUCT!{struct DXVA2_ValueRange {
365 MinValue: DXVA2_Fixed32,
366 MaxValue: DXVA2_Fixed32,
367 DefaultValue: DXVA2_Fixed32,
368 StepSize: DXVA2_Fixed32,
369 }}
370 STRUCT!{struct DXVA2_ProcAmpValues {
371 Brightness: DXVA2_Fixed32,
372 Contrast: DXVA2_Fixed32,
373 Hue: DXVA2_Fixed32,
374 Saturation: DXVA2_Fixed32,
375 }}
376 STRUCT!{struct DXVA2_FilterValues {
377 Level: DXVA2_Fixed32,
378 Threshold: DXVA2_Fixed32,
379 Radius: DXVA2_Fixed32,
380 }}
381 STRUCT!{struct DXVA2_VideoProcessBltParams {
382 TargetFrame: REFERENCE_TIME,
383 TargetRect: RECT,
384 ConstrictionSize: SIZE,
385 StreamingFlags: UINT,
386 BackgroundColor: DXVA2_AYUVSample16,
387 DestFormat: DXVA2_ExtendedFormat,
388 ProcAmpValues: DXVA2_ProcAmpValues,
389 Alpha: DXVA2_Fixed32,
390 NoiseFilterLuma: DXVA2_FilterValues,
391 NoiseFilterChroma: DXVA2_FilterValues,
392 DetailFilterLuma: DXVA2_FilterValues,
393 DetailFilterChroma: DXVA2_FilterValues,
394 DestData: DWORD,
395 }}
396 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0012 {
397 DXVA2_PictureParametersBufferType = 0,
398 DXVA2_MacroBlockControlBufferType = 1,
399 DXVA2_ResidualDifferenceBufferType = 2,
400 DXVA2_DeblockingControlBufferType = 3,
401 DXVA2_InverseQuantizationMatrixBufferType = 4,
402 DXVA2_SliceControlBufferType = 5,
403 DXVA2_BitStreamDateBufferType = 6,
404 DXVA2_MotionVectorBuffer = 7,
405 DXVA2_FilmGrainBuffer = 8,
406 }}
407 ENUM!{enum __MIDL___MIDL_itf_dxva2api_0000_0000_0013 {
408 DXVA2_VideoDecoderRenderTarget = 0,
409 DXVA2_VideoProcessorRenderTarget = 1,
410 DXVA2_VideoSoftwareRenderTarget = 2,
411 }}
412 STRUCT!{struct DXVA2_ConfigPictureDecode {
413 guidConfigBitstreamEncryption: GUID,
414 guidConfigMBcontrolEncryption: GUID,
415 guidConfigResidDiffEncryption: GUID,
416 ConfigBitstreamRaw: UINT,
417 ConfigMBcontrolRasterOrder: UINT,
418 ConfigResidDiffHost: UINT,
419 ConfigSpatialResid8: UINT,
420 ConfigResid8Subtraction: UINT,
421 ConfigSpatialHost8or9Clipping: UINT,
422 ConfigSpatialResidInterleaved: UINT,
423 ConfigIntraResidUnsigned: UINT,
424 ConfigResidDiffAccelerator: UINT,
425 ConfigHostInverseScan: UINT,
426 ConfigSpecificIDCT: UINT,
427 Config4GroupedCoefs: UINT,
428 ConfigMinRenderTargetBuffCount: USHORT,
429 ConfigDecoderSpecific: USHORT,
430 }}
431 STRUCT!{struct DXVA2_DecodeBufferDesc {
432 CompressedBufferType: DWORD,
433 BufferIndex: UINT,
434 DataOffset: UINT,
435 DataSize: UINT,
436 FirstMBaddress: UINT,
437 NumMBsInBuffer: UINT,
438 Width: UINT,
439 Height: UINT,
440 Stride: UINT,
441 ReservedBits: UINT,
442 pvPVPState: PVOID,
443 }}
444 STRUCT!{struct DXVA2_AES_CTR_IV {
445 IV: UINT64,
446 Count: UINT64,
447 }}
448 STRUCT!{struct DXVA2_DecodeExtensionData {
449 Function: UINT,
450 pPrivateInputData: PVOID,
451 PrivateInputDataSize: UINT,
452 pPrivateOutputData: PVOID,
453 PrivateOutputDataSize: UINT,
454 }}
455 pub const DXVA2_DECODE_GET_DRIVER_HANDLE: UINT = 0x725;
456 pub const DXVA2_DECODE_SPECIFY_ENCRYPTED_BLOCKS: UINT = 0x724;
457 STRUCT!{struct DXVA2_DecodeExecuteParams {
458 NumCompBuffers: UINT,
459 pCompressedBuffers: *mut DXVA2_DecodeBufferDesc,
460 pExtensionData: *mut DXVA2_DecodeExtensionData,
461 }}
462 RIDL!{#[uuid(0xa0cade0f, 0x06d5, 0x4cf4, 0xa1, 0xc7, 0xf3, 0xcd, 0xd7, 0x25, 0xaa, 0x75)]
463 interface IDirect3DDeviceManager9(IDirect3DDeviceManager9Vtbl): IUnknown(IUnknownVtbl) {
464 fn ResetDevice(
465 pDevice: *mut IDirect3DDevice9,
466 resetToken: UINT,
467 ) -> HRESULT,
468 fn OpenDeviceHandle(
469 phDevice: *mut HANDLE,
470 ) -> HRESULT,
471 fn CloseDeviceHandle(
472 hDevice: HANDLE,
473 ) -> HRESULT,
474 fn TestDevice(
475 hDevice: HANDLE,
476 ) -> HRESULT,
477 fn LockDevice(
478 hDevice: HANDLE,
479 ppDevice: *mut *mut IDirect3DDevice9,
480 fBloc: BOOL,
481 ) -> HRESULT,
482 fn UnlockDevice(
483 hDevice: HANDLE,
484 fSaveState: BOOL,
485 ) -> HRESULT,
486 fn GetVideoService(
487 hDevice: HANDLE,
488 riid: REFIID,
489 ppService: *mut *mut c_void,
490 ) -> HRESULT,
491 }}
492 RIDL!{#[uuid(0xfc51a550, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x00, 0x05, 0x4e, 0x43, 0xff, 0x02)]
493 interface IDirectXVideoAccelerationService(IDirectXVideoAccelerationServiceVtbl):
494 IUnknown(IUnknownVtbl) {
495 fn CreateSurface(
496 Width: UINT,
497 Height: UINT,
498 BackBuffers: UINT,
499 Format: D3DFORMAT,
500 Pool: D3DPOOL,
501 Usage: DWORD,
502 DxvaType: DWORD,
503 ppSurface: *mut *mut IDirect3DSurface9,
504 pSharedHandle: *mut HANDLE,
505 ) -> HRESULT,
506 }}
507 RIDL!{#[uuid(0xfc51a551, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x00, 0x05, 0x4e, 0x43, 0xff, 0x02)]
508 interface IDirectXVideoDecoderService(IDirectXVideoDecoderServiceVtbl):
509 IDirectXVideoAccelerationService(IDirectXVideoAccelerationServiceVtbl) {
510 fn GetDecoderDeviceGuids(
511 pCount: *mut UINT,
512 pGuids: *mut *mut GUID,
513 ) -> HRESULT,
514 fn GetDecoderRenderTargets(
515 Guid: REFGUID,
516 pCount: *mut UINT,
517 pFormats: *mut *mut D3DFORMAT,
518 ) -> HRESULT,
519 fn GetDecoderConfigurations(
520 Guid: REFGUID,
521 pVideoDesc: *const DXVA2_VideoDesc,
522 pReserved: *mut c_void,
523 pCount: *mut UINT,
524 ppConfigs: *mut *mut DXVA2_ConfigPictureDecode,
525 ) -> HRESULT,
526 fn CreateVideoDecoder(
527 Guid: REFGUID,
528 pVideoDesc: *const DXVA2_VideoDesc,
529 pConfig: *const DXVA2_ConfigPictureDecode,
530 ppDecoderRenderTargets: *mut *mut IDirect3DSurface9,
531 NumRenderTargets: UINT,
532 ppDecode: *mut *mut IDirectXVideoDecoder,
533 ) -> HRESULT,
534 }}
535 RIDL!{#[uuid(0xfc51a552, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x00, 0x05, 0x4e, 0x43, 0xff, 0x02)]
536 interface IDirectXVideoProcessorService(IDirectXVideoProcessorServiceVtbl):
537 IDirectXVideoAccelerationService(IDirectXVideoAccelerationServiceVtbl) {
538 fn RegisterVideoProcessorSoftwareDevice(
539 pCallbacks: *mut c_void,
540 ) -> HRESULT,
541 fn GetVideoProcessorDeviceGuids(
542 pVideoDesc: *mut DXVA2_VideoDesc,
543 pCount: *mut UINT,
544 pGuids: *mut *mut GUID,
545 ) -> HRESULT,
546 fn GetVideoProcessorRenderTargets(
547 VideoProcDeviceGuid: REFGUID,
548 pVideoDesc: *const DXVA2_VideoDesc,
549 pCount: *mut UINT,
550 pFormats: *mut *mut D3DFORMAT,
551 ) -> HRESULT,
552 fn GetVideoProcessorSubStreamFormats(
553 VideoProcDeviceGuid: REFGUID,
554 pVideoDesc: *const DXVA2_VideoDesc,
555 RenderTargetFormat: D3DFORMAT,
556 pCount: *mut UINT,
557 pFormats: *mut *mut D3DFORMAT,
558 ) -> HRESULT,
559 fn GetVideoProcessorCaps(
560 VideoProcDeviceGuid: REFGUID,
561 pVideoDesc: *const DXVA2_VideoDesc,
562 RenderTargetFormat: D3DFORMAT,
563 pCaps: *mut DXVA2_VideoProcessorCaps,
564 ) -> HRESULT,
565 fn GetProcAmpRange(
566 VideoProcDeviceGuid: REFGUID,
567 pVideoDesc: *const DXVA2_VideoDesc,
568 RenderTargetFormat: D3DFORMAT,
569 ProcAmpCap: UINT,
570 pRange: *mut DXVA2_ValueRange,
571 ) -> HRESULT,
572 fn GetFilterPropertyRange(
573 VideoProcDeviceGuid: REFGUID,
574 pVideoDesc: *const DXVA2_VideoDesc,
575 RenderTargetFormat: D3DFORMAT,
576 FilterSetting: UINT,
577 pRange: *mut DXVA2_ValueRange,
578 ) -> HRESULT,
579 fn CreateVideoProcessor(
580 VideoProcDeviceGuid: REFGUID,
581 pVideoDesc: *const DXVA2_VideoDesc,
582 RenderTargetFormat: D3DFORMAT,
583 MaxNumSubStreams: UINT,
584 ppVidProcess: *mut *mut IDirectXVideoProcessor,
585 ) -> HRESULT,
586 }}
587 RIDL!{#[uuid(0xf2b0810a, 0xfd00, 0x43c9, 0x91, 0x8c, 0xdf, 0x94, 0xe2, 0xd8, 0xef, 0x7d)]
588 interface IDirectXVideoDecoder(IDirectXVideoDecoderVtbl): IUnknown(IUnknownVtbl) {
589 fn GetVideoDecoderService(
590 ppService: *mut *mut IDirectXVideoDecoderService,
591 ) -> HRESULT,
592 fn GetCreationParameters(
593 pDeviceGuid: *mut GUID,
594 pVideoDesc: *mut DXVA2_VideoDesc,
595 pConfig: *mut DXVA2_ConfigPictureDecode,
596 pDecoderRenderTargets: *mut *mut *mut IDirect3DSurface9,
597 pNumSurfaces: *mut UINT,
598 ) -> HRESULT,
599 fn GetBuffer(
600 BufferType: UINT,
601 ppBuffer: *mut *mut c_void,
602 pBufferSize: *mut UINT,
603 ) -> HRESULT,
604 fn ReleaseBuffer(
605 BufferType: UINT,
606 ) -> HRESULT,
607 fn BeginFrame(
608 pRenderTarget: *mut IDirect3DSurface9,
609 pvPVPData: *mut c_void,
610 ) -> HRESULT,
611 fn EndFrame(
612 pHandleComplete: *mut HANDLE,
613 ) -> HRESULT,
614 fn Execute(
615 pExecuteParams: *const DXVA2_DecodeExecuteParams,
616 ) -> HRESULT,
617 }}
618 RIDL!{#[uuid(0x8c3a39f0, 0x916e, 0x4690, 0x80, 0x4f, 0x4c, 0x80, 0x01, 0x35, 0x5d, 0x25)]
619 interface IDirectXVideoProcessor(IDirectXVideoProcessorVtbl): IUnknown(IUnknownVtbl) {
620 fn GetVideoProcessorService(
621 ppService: *mut *mut IDirectXVideoProcessorService,
622 ) -> HRESULT,
623 fn GetCreationParameters(
624 pDeviceGuid: *mut GUID,
625 pVideoDesc: *mut DXVA2_VideoDesc,
626 pRenderTargetFormat: *mut D3DFORMAT,
627 pMaxNumSubStreams: *mut UINT,
628 ) -> HRESULT,
629 fn GetVideoProcessorCaps(
630 pCaps: *mut DXVA2_VideoProcessorCaps,
631 ) -> HRESULT,
632 fn GetProcAmpRange(
633 ProcAmpCap: UINT,
634 pRange: *mut DXVA2_ValueRange,
635 ) -> HRESULT,
636 fn GetFilterPropertyRange(
637 FilterSetting: UINT,
638 pRange: *mut DXVA2_ValueRange,
639 ) -> HRESULT,
640 fn VideoProcessBlt(
641 pRenderTarget: *mut IDirect3DSurface9,
642 pBltParams: *const DXVA2_VideoProcessBltParams,
643 pSamples: *const DXVA2_VideoSample,
644 NumSamples: UINT,
645 pHandleComplete: *mut HANDLE,
646 ) -> HRESULT,
647 }}
648 ENUM!{enum DXVA2_SurfaceType {
649 DXVA2_SurfaceType_DecoderRenderTarget = 0,
650 DXVA2_SurfaceType_ProcessorRenderTarget = 1,
651 DXVA2_SurfaceType_D3DRenderTargetTexture = 2,
652 }}
653 RIDL!{#[uuid(0xb7f916dd, 0xdb3b, 0x49c1, 0x84, 0xd7, 0xe4, 0x5e, 0xf9, 0x9e, 0xc7, 0x26)]
654 interface IDirectXVideoMemoryConfiguration(IDirectXVideoMemoryConfigurationVtbl):
655 IUnknown(IUnknownVtbl) {
656 fn GetAvailableSurfaceTypeByIndex(
657 dwTypeIndex: DWORD,
658 pdwType: *mut DXVA2_SurfaceType,
659 ) -> HRESULT,
660 fn SetSurfaceType(
661 dwType: DXVA2_SurfaceType,
662 ) -> HRESULT,
663 }}
664 extern "system" {
DXVA2CreateDirect3DDeviceManager9( pResetToken: *mut UINT, ppDeviceManager: *mut *mut IDirect3DDeviceManager9, ) -> HRESULT665 pub fn DXVA2CreateDirect3DDeviceManager9(
666 pResetToken: *mut UINT,
667 ppDeviceManager: *mut *mut IDirect3DDeviceManager9,
668 ) -> HRESULT;
DXVA2CreateVideoService( pDD: *mut IDirect3DDevice9, riid: REFIID, ppService: *mut *mut c_void, ) -> HRESULT669 pub fn DXVA2CreateVideoService(
670 pDD: *mut IDirect3DDevice9,
671 riid: REFIID,
672 ppService: *mut *mut c_void,
673 ) -> HRESULT;
674 }
675 #[inline]
DXVA2FloatToFixed(_float_: c_float) -> DXVA2_Fixed32676 pub fn DXVA2FloatToFixed(_float_: c_float) -> DXVA2_Fixed32 {
677 unsafe {
678 let mut _fixed_: DXVA2_Fixed32 = ::core::mem::uninitialized();
679 _fixed_.s_mut().Fraction = LOWORD((_float_ * 0x10000 as c_float) as DWORD);
680 _fixed_.s_mut().Value = HIWORD((_float_ * 0x10000 as c_float) as DWORD) as SHORT;
681 _fixed_
682 }
683 }
684 #[inline]
DXVA2FixedToFloat(_fixed_: DXVA2_Fixed32) -> c_float685 pub fn DXVA2FixedToFloat(_fixed_: DXVA2_Fixed32) -> c_float {
686 unsafe {
687 _fixed_.s().Value as FLOAT + _fixed_.s().Fraction as FLOAT / 0x10000 as FLOAT
688 }
689 }
690 #[inline]
DXVA2_Fixed32TransparentAlpha() -> DXVA2_Fixed32691 pub fn DXVA2_Fixed32TransparentAlpha() -> DXVA2_Fixed32 {
692 unsafe {
693 let mut _fixed_: DXVA2_Fixed32 = ::core::mem::uninitialized();
694 _fixed_.s_mut().Fraction = 0;
695 _fixed_.s_mut().Value = 0;
696 _fixed_
697 }
698 }
699 #[inline]
DXVA2_Fixed32OpaqueAlpha() -> DXVA2_Fixed32700 pub fn DXVA2_Fixed32OpaqueAlpha() -> DXVA2_Fixed32 {
701 unsafe {
702 let mut _fixed_: DXVA2_Fixed32 = ::core::mem::uninitialized();
703 _fixed_.s_mut().Fraction = 0;
704 _fixed_.s_mut().Value = 1;
705 _fixed_
706 }
707 }
708