1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 use ctypes::c_void;
7 use shared::d3d9::{IDirect3DDevice9Ex, IDirect3DSurface9};
8 use shared::d3d9types::{D3DCOLOR, D3DFORMAT, D3DPOOL};
9 use shared::guiddef::GUID;
10 use shared::minwindef::{BOOL, DWORD, FLOAT, INT, UINT};
11 use shared::windef::{RECT, SIZE};
12 use um::unknwnbase::{IUnknown, IUnknownVtbl};
13 use um::winnt::{HANDLE, HRESULT, ULONGLONG};
14 DEFINE_GUID!{IID_IDXVAHD_Device,
15     0x95f12dfd, 0xd77e, 0x49be, 0x81, 0x5f, 0x57, 0xd5, 0x79, 0x63, 0x4d, 0x6d}
16 DEFINE_GUID!{IID_IDXVAHD_VideoProcessor,
17     0x95f4edf4, 0x6e03, 0x4cd7, 0xbe, 0x1b, 0x30, 0x75, 0xd6, 0x65, 0xaa, 0x52}
18 ENUM!{enum DXVAHD_FRAME_FORMAT {
19     DXVAHD_FRAME_FORMAT_PROGRESSIVE = 0,
20     DXVAHD_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1,
21     DXVAHD_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2,
22 }}
23 ENUM!{enum DXVAHD_DEVICE_USAGE {
24     DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL = 0,
25     DXVAHD_DEVICE_USAGE_OPTIMAL_SPEED = 1,
26     DXVAHD_DEVICE_USAGE_OPTIMAL_QUALITY = 2,
27 }}
28 ENUM!{enum DXVAHD_SURFACE_TYPE {
29     DXVAHD_SURFACE_TYPE_VIDEO_INPUT = 0,
30     DXVAHD_SURFACE_TYPE_VIDEO_INPUT_PRIVATE = 1,
31     DXVAHD_SURFACE_TYPE_VIDEO_OUTPUT = 2,
32 }}
33 ENUM!{enum DXVAHD_DEVICE_TYPE {
34     DXVAHD_DEVICE_TYPE_HARDWARE = 0,
35     DXVAHD_DEVICE_TYPE_SOFTWARE = 1,
36     DXVAHD_DEVICE_TYPE_REFERENCE = 2,
37     DXVAHD_DEVICE_TYPE_OTHER = 3,
38 }}
39 ENUM!{enum DXVAHD_DEVICE_CAPS {
40     DXVAHD_DEVICE_CAPS_LINEAR_SPACE = 0x1,
41     DXVAHD_DEVICE_CAPS_xvYCC = 0x2,
42     DXVAHD_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x4,
43     DXVAHD_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x8,
44 }}
45 ENUM!{enum DXVAHD_FEATURE_CAPS {
46     DXVAHD_FEATURE_CAPS_ALPHA_FILL = 0x1,
47     DXVAHD_FEATURE_CAPS_CONSTRICTION = 0x2,
48     DXVAHD_FEATURE_CAPS_LUMA_KEY = 0x4,
49     DXVAHD_FEATURE_CAPS_ALPHA_PALETTE = 0x8,
50 }}
51 ENUM!{enum DXVAHD_FILTER_CAPS {
52     DXVAHD_FILTER_CAPS_BRIGHTNESS = 0x1,
53     DXVAHD_FILTER_CAPS_CONTRAST = 0x2,
54     DXVAHD_FILTER_CAPS_HUE = 0x4,
55     DXVAHD_FILTER_CAPS_SATURATION = 0x8,
56     DXVAHD_FILTER_CAPS_NOISE_REDUCTION = 0x10,
57     DXVAHD_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20,
58     DXVAHD_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40,
59 }}
60 ENUM!{enum DXVAHD_INPUT_FORMAT_CAPS {
61     DXVAHD_INPUT_FORMAT_CAPS_RGB_INTERLACED = 0x1,
62     DXVAHD_INPUT_FORMAT_CAPS_RGB_PROCAMP = 0x2,
63     DXVAHD_INPUT_FORMAT_CAPS_RGB_LUMA_KEY = 0x4,
64     DXVAHD_INPUT_FORMAT_CAPS_PALETTE_INTERLACED = 0x8,
65 }}
66 ENUM!{enum DXVAHD_PROCESSOR_CAPS {
67     DXVAHD_PROCESSOR_CAPS_DEINTERLACE_BLEND = 0x1,
68     DXVAHD_PROCESSOR_CAPS_DEINTERLACE_BOB = 0x2,
69     DXVAHD_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = 0x4,
70     DXVAHD_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = 0x8,
71     DXVAHD_PROCESSOR_CAPS_INVERSE_TELECINE = 0x10,
72     DXVAHD_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = 0x20,
73 }}
74 ENUM!{enum DXVAHD_ITELECINE_CAPS {
75     DXVAHD_ITELECINE_CAPS_32 = 0x1,
76     DXVAHD_ITELECINE_CAPS_22 = 0x2,
77     DXVAHD_ITELECINE_CAPS_2224 = 0x4,
78     DXVAHD_ITELECINE_CAPS_2332 = 0x8,
79     DXVAHD_ITELECINE_CAPS_32322 = 0x10,
80     DXVAHD_ITELECINE_CAPS_55 = 0x20,
81     DXVAHD_ITELECINE_CAPS_64 = 0x40,
82     DXVAHD_ITELECINE_CAPS_87 = 0x80,
83     DXVAHD_ITELECINE_CAPS_222222222223 = 0x100,
84     DXVAHD_ITELECINE_CAPS_OTHER = 0x80000000,
85 }}
86 ENUM!{enum DXVAHD_FILTER {
87     DXVAHD_FILTER_BRIGHTNESS = 0,
88     DXVAHD_FILTER_CONTRAST = 1,
89     DXVAHD_FILTER_HUE = 2,
90     DXVAHD_FILTER_SATURATION = 3,
91     DXVAHD_FILTER_NOISE_REDUCTION = 4,
92     DXVAHD_FILTER_EDGE_ENHANCEMENT = 5,
93     DXVAHD_FILTER_ANAMORPHIC_SCALING = 6,
94 }}
95 ENUM!{enum DXVAHD_BLT_STATE {
96     DXVAHD_BLT_STATE_TARGET_RECT = 0,
97     DXVAHD_BLT_STATE_BACKGROUND_COLOR = 1,
98     DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE = 2,
99     DXVAHD_BLT_STATE_ALPHA_FILL = 3,
100     DXVAHD_BLT_STATE_CONSTRICTION = 4,
101     DXVAHD_BLT_STATE_PRIVATE = 1000,
102 }}
103 ENUM!{enum DXVAHD_ALPHA_FILL_MODE {
104     DXVAHD_ALPHA_FILL_MODE_OPAQUE = 0,
105     DXVAHD_ALPHA_FILL_MODE_BACKGROUND = 1,
106     DXVAHD_ALPHA_FILL_MODE_DESTINATION = 2,
107     DXVAHD_ALPHA_FILL_MODE_SOURCE_STREAM = 3,
108 }}
109 ENUM!{enum DXVAHD_STREAM_STATE {
110     DXVAHD_STREAM_STATE_D3DFORMAT = 0,
111     DXVAHD_STREAM_STATE_FRAME_FORMAT = 1,
112     DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE = 2,
113     DXVAHD_STREAM_STATE_OUTPUT_RATE = 3,
114     DXVAHD_STREAM_STATE_SOURCE_RECT = 4,
115     DXVAHD_STREAM_STATE_DESTINATION_RECT = 5,
116     DXVAHD_STREAM_STATE_ALPHA = 6,
117     DXVAHD_STREAM_STATE_PALETTE = 7,
118     DXVAHD_STREAM_STATE_LUMA_KEY = 8,
119     DXVAHD_STREAM_STATE_ASPECT_RATIO = 9,
120     DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS = 100,
121     DXVAHD_STREAM_STATE_FILTER_CONTRAST = 101,
122     DXVAHD_STREAM_STATE_FILTER_HUE = 102,
123     DXVAHD_STREAM_STATE_FILTER_SATURATION = 103,
124     DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION = 104,
125     DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT = 105,
126     DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING = 106,
127     DXVAHD_STREAM_STATE_PRIVATE = 1000,
128 }}
129 ENUM!{enum DXVAHD_OUTPUT_RATE {
130     DXVAHD_OUTPUT_RATE_NORMAL = 0,
131     DXVAHD_OUTPUT_RATE_HALF = 1,
132     DXVAHD_OUTPUT_RATE_CUSTOM = 2,
133 }}
134 STRUCT!{struct DXVAHD_RATIONAL {
135     Numerator: UINT,
136     Denominator: UINT,
137 }}
138 STRUCT!{struct DXVAHD_COLOR_RGBA {
139     R: FLOAT,
140     G: FLOAT,
141     B: FLOAT,
142     A: FLOAT,
143 }}
144 STRUCT!{struct DXVAHD_COLOR_YCbCrA {
145     Y: FLOAT,
146     Cb: FLOAT,
147     Cr: FLOAT,
148     A: FLOAT,
149 }}
150 UNION!{union DXVAHD_COLOR {
151     [u32; 4],
152     RGB RGB_mut: DXVAHD_COLOR_RGBA,
153     YCbCr YCbCr_mut: DXVAHD_COLOR_YCbCrA,
154 }}
155 STRUCT!{struct DXVAHD_CONTENT_DESC {
156     InputFrameFormat: DXVAHD_FRAME_FORMAT,
157     InputFrameRate: DXVAHD_RATIONAL,
158     InputWidth: UINT,
159     InputHeight: UINT,
160     OutputFrameRate: DXVAHD_RATIONAL,
161     OutputWidth: UINT,
162     OutputHeight: UINT,
163 }}
164 STRUCT!{struct DXVAHD_VPDEVCAPS {
165     DeviceType: DXVAHD_DEVICE_TYPE,
166     DeviceCaps: UINT,
167     FeatureCaps: UINT,
168     FilterCaps: UINT,
169     InputFormatCaps: UINT,
170     InputPool: D3DPOOL,
171     OutputFormatCount: UINT,
172     InputFormatCount: UINT,
173     VideoProcessorCount: UINT,
174     MaxInputStreams: UINT,
175     MaxStreamStates: UINT,
176 }}
177 STRUCT!{struct DXVAHD_VPCAPS {
178     VPGuid: GUID,
179     PastFrames: UINT,
180     FutureFrames: UINT,
181     ProcessorCaps: UINT,
182     ITelecineCaps: UINT,
183     CustomRateCount: UINT,
184 }}
185 STRUCT!{struct DXVAHD_CUSTOM_RATE_DATA {
186     CustomRate: DXVAHD_RATIONAL,
187     OutputFrames: UINT,
188     InputInterlaced: BOOL,
189     InputFramesOrFields: UINT,
190 }}
191 STRUCT!{struct DXVAHD_FILTER_RANGE_DATA {
192     Minimum: INT,
193     Maximum: INT,
194     Default: INT,
195     Multiplier: FLOAT,
196 }}
197 STRUCT!{struct DXVAHD_BLT_STATE_TARGET_RECT_DATA {
198     Enable: BOOL,
199     TargetRect: RECT,
200 }}
201 STRUCT!{struct DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA {
202     YCbCr: BOOL,
203     BackgroundColor: DXVAHD_COLOR,
204 }}
205 STRUCT!{struct DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA {
206     Value: UINT,
207 }}
208 BITFIELD!{DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA Value: UINT [
209     Usage set_Usage[0..1],
210     RGB_Range set_RGB_Range[1..2],
211     YCbCr_Matrix set_YCbCr_Matrix[2..3],
212     YCbCr_xvYCC set_YCbCr_xvYCC[3..4],
213     Reserved set_Reserved[4..32],
214 ]}
215 STRUCT!{struct DXVAHD_BLT_STATE_ALPHA_FILL_DATA {
216     Mode: DXVAHD_ALPHA_FILL_MODE,
217     StreamNumber: UINT,
218 }}
219 STRUCT!{struct DXVAHD_BLT_STATE_CONSTRICTION_DATA {
220     Enable: BOOL,
221     Size: SIZE,
222 }}
223 STRUCT!{struct DXVAHD_BLT_STATE_PRIVATE_DATA {
224     Guid: GUID,
225     DataSize: UINT,
226     pData: *mut c_void,
227 }}
228 STRUCT!{struct DXVAHD_STREAM_STATE_D3DFORMAT_DATA {
229     Format: D3DFORMAT,
230 }}
231 STRUCT!{struct DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA {
232     FrameFormat: DXVAHD_FRAME_FORMAT,
233 }}
234 STRUCT!{struct DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA {
235     Value: UINT,
236 }}
237 BITFIELD!{DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA Value: UINT [
238     Type set_Type[0..1],
239     RGB_Range set_RGB_Range[1..2],
240     YCbCr_Matrix set_YCbCr_Matrix[2..3],
241     YCbCr_xvYCC set_YCbCr_xvYCC[3..4],
242     Reserved set_Reserved[4..32],
243 ]}
244 STRUCT!{struct DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA {
245     RepeatFrame: BOOL,
246     OutputRate: DXVAHD_OUTPUT_RATE,
247     CustomRate: DXVAHD_RATIONAL,
248 }}
249 STRUCT!{struct DXVAHD_STREAM_STATE_SOURCE_RECT_DATA {
250     Enable: BOOL,
251     SourceRect: RECT,
252 }}
253 STRUCT!{struct DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA {
254     Enable: BOOL,
255     DestinationRect: RECT,
256 }}
257 STRUCT!{struct DXVAHD_STREAM_STATE_ALPHA_DATA {
258     Enable: BOOL,
259     Alpha: FLOAT,
260 }}
261 STRUCT!{struct DXVAHD_STREAM_STATE_PALETTE_DATA {
262     Count: UINT,
263     pEntries: *mut D3DCOLOR,
264 }}
265 STRUCT!{struct DXVAHD_STREAM_STATE_LUMA_KEY_DATA {
266     Enable: BOOL,
267     Lower: FLOAT,
268     Upper: FLOAT,
269 }}
270 STRUCT!{struct DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA {
271     Enable: BOOL,
272     SourceAspectRatio: DXVAHD_RATIONAL,
273     DestinationAspectRatio: DXVAHD_RATIONAL,
274 }}
275 STRUCT!{struct DXVAHD_STREAM_STATE_FILTER_DATA {
276     Enable: BOOL,
277     Level: INT,
278 }}
279 STRUCT!{struct DXVAHD_STREAM_STATE_PRIVATE_DATA {
280     Guid: GUID,
281     DataSize: UINT,
282     pData: *mut c_void,
283 }}
284 STRUCT!{struct DXVAHD_STREAM_DATA {
285     Enable: BOOL,
286     OutputIndex: UINT,
287     InputFrameOrField: UINT,
288     PastFrames: UINT,
289     FutureFrames: UINT,
290     ppPastSurfaces: *mut *mut IDirect3DSurface9,
291     pInputSurface: *mut IDirect3DSurface9,
292     ppFutureSurfaces: *mut *mut IDirect3DSurface9,
293 }}
294 STRUCT!{struct DXVAHD_STREAM_STATE_PRIVATE_IVTC_DATA {
295     Enable: BOOL,
296     ITelecineFlags: UINT,
297     Frames: UINT,
298     InputField: UINT,
299 }}
300 RIDL!{#[uuid(0x95f12dfd, 0xd77e, 0x49be, 0x81, 0x5f, 0x57, 0xd5, 0x79, 0x63, 0x4d, 0x6d)]
301 interface IDXVAHD_Device(IDXVAHD_DeviceVtbl): IUnknown(IUnknownVtbl) {
302     fn CreateVideoSurface(
303         Width: UINT,
304         Height: UINT,
305         Format: D3DFORMAT,
306         Pool: D3DPOOL,
307         Usage: DWORD,
308         Type: DXVAHD_SURFACE_TYPE,
309         NumSurfaces: UINT,
310         ppSurfaces: *mut *mut IDirect3DSurface9,
311         pSharedHandle: *mut HANDLE,
312     ) -> HRESULT,
313     fn GetVideoProcessorDeviceCaps(
314         pCaps: *mut DXVAHD_VPDEVCAPS,
315     ) -> HRESULT,
316     fn GetVideoProcessorOutputFormats(
317         Count: UINT,
318         pFormats: *mut D3DFORMAT,
319     ) -> HRESULT,
320     fn GetVideoProcessorInputFormats(
321         Count: UINT,
322         pFormats: *mut D3DFORMAT,
323     ) -> HRESULT,
324     fn GetVideoProcessorCaps(
325         Count: UINT,
326         pCaps: *mut DXVAHD_VPCAPS,
327     ) -> HRESULT,
328     fn GetVideoProcessorCustomRates(
329         pVPGuid: *const GUID,
330         Count: UINT,
331         pRates: *mut DXVAHD_CUSTOM_RATE_DATA,
332     ) -> HRESULT,
333     fn GetVideoProcessorFilterRange(
334         Filter: DXVAHD_FILTER,
335         pRange: *mut DXVAHD_FILTER_RANGE_DATA,
336     ) -> HRESULT,
337     fn CreateVideoProcessor(
338         pVPGuid: *const GUID,
339         ppVideoProcessor: *mut *mut IDXVAHD_VideoProcessor,
340     ) -> HRESULT,
341 }}
342 RIDL!{#[uuid(0x95f4edf4, 0x6e03, 0x4cd7, 0xbe, 0x1b, 0x30, 0x75, 0xd6, 0x65, 0xaa, 0x52)]
343 interface IDXVAHD_VideoProcessor(IDXVAHD_VideoProcessorVtbl): IUnknown(IUnknownVtbl) {
344     fn SetVideoProcessBltState(
345         State: DXVAHD_BLT_STATE,
346         DataSize: UINT,
347         pData: *const c_void,
348     ) -> HRESULT,
349     fn GetVideoProcessBltState(
350         State: DXVAHD_BLT_STATE,
351         DataSize: UINT,
352         pData: *mut c_void,
353     ) -> HRESULT,
354     fn SetVideoProcessStreamState(
355         StreamNumber: UINT,
356         State: DXVAHD_STREAM_STATE,
357         DataSize: UINT,
358         pData: *const c_void,
359     ) -> HRESULT,
360     fn GetVideoProcessStreamState(
361         StreamNumber: UINT,
362         State: DXVAHD_STREAM_STATE,
363         DataSize: UINT,
364         pData: *mut c_void,
365     ) -> HRESULT,
366     fn VideoProcessBltHD(
367         pOutputSurface: *mut IDirect3DSurface9,
368         OutputFrame: UINT,
369         StreamCount: UINT,
370         pStreams: *const DXVAHD_STREAM_DATA,
371     ) -> HRESULT,
372 }}
373 FN!{stdcall PDXVAHDSW_CreateDevice(
374     pD3DDevice: *mut IDirect3DDevice9Ex,
375     phDevice: *mut HANDLE,
376 ) -> HRESULT}
377 FN!{stdcall PDXVAHDSW_ProposeVideoPrivateFormat(
378     hDevice: HANDLE,
379     pFormat: *mut D3DFORMAT,
380 ) -> HRESULT}
381 FN!{stdcall PDXVAHDSW_GetVideoProcessorDeviceCaps(
382     hDevice: HANDLE,
383     pContentDesc: *const DXVAHD_CONTENT_DESC,
384     Usage: DXVAHD_DEVICE_USAGE,
385     pCaps: *mut DXVAHD_VPDEVCAPS,
386 ) -> HRESULT}
387 FN!{stdcall PDXVAHDSW_GetVideoProcessorOutputFormats(
388     hDevice: HANDLE,
389     pContentDesc: *const DXVAHD_CONTENT_DESC,
390     Usage: DXVAHD_DEVICE_USAGE,
391     Count: UINT,
392     pFormats: *mut D3DFORMAT,
393 ) -> HRESULT}
394 FN!{stdcall PDXVAHDSW_GetVideoProcessorInputFormats(
395     hDevice: HANDLE,
396     pContentDesc: *const DXVAHD_CONTENT_DESC,
397     Usage: DXVAHD_DEVICE_USAGE,
398     Count: UINT,
399     pFormats: *mut D3DFORMAT,
400 ) -> HRESULT}
401 FN!{stdcall PDXVAHDSW_GetVideoProcessorCaps(
402     hDevice: HANDLE,
403     pContentDesc: *const DXVAHD_CONTENT_DESC,
404     Usage: DXVAHD_DEVICE_USAGE,
405     Count: UINT,
406     pCaps: *mut DXVAHD_VPCAPS,
407 ) -> HRESULT}
408 FN!{stdcall PDXVAHDSW_GetVideoProcessorCustomRates(
409     hDevice: HANDLE,
410     pVPGuid: *const GUID,
411     Count: UINT,
412     pRates: *mut DXVAHD_CUSTOM_RATE_DATA,
413 ) -> HRESULT}
414 FN!{stdcall PDXVAHDSW_GetVideoProcessorFilterRange(
415     hDevice: HANDLE,
416     Filter: DXVAHD_FILTER,
417     pRange: *mut DXVAHD_FILTER_RANGE_DATA,
418 ) -> HRESULT}
419 FN!{stdcall PDXVAHDSW_DestroyDevice(
420     hDevice: HANDLE,
421 ) -> HRESULT}
422 FN!{stdcall PDXVAHDSW_CreateVideoProcessor(
423     hDevice: HANDLE,
424     pVPGuid: *const GUID,
425     phVideoProcessor: *mut HANDLE,
426 ) -> HRESULT}
427 FN!{stdcall PDXVAHDSW_SetVideoProcessBltState(
428     hVideoProcessor: HANDLE,
429     State: DXVAHD_BLT_STATE,
430     DataSize: UINT,
431     pData: *const c_void,
432 ) -> HRESULT}
433 FN!{stdcall PDXVAHDSW_GetVideoProcessBltStatePrivate(
434     hVideoProcessor: HANDLE,
435     pData: *mut DXVAHD_BLT_STATE_PRIVATE_DATA,
436 ) -> HRESULT}
437 FN!{stdcall PDXVAHDSW_SetVideoProcessStreamState(
438     hVideoProcessor: HANDLE,
439     StreamNumber: UINT,
440     State: DXVAHD_STREAM_STATE,
441     DataSize: UINT,
442     pData: *const c_void,
443 ) -> HRESULT}
444 FN!{stdcall PDXVAHDSW_GetVideoProcessStreamStatePrivate(
445     hVideoProcessor: HANDLE,
446     StreamNumber: UINT,
447     pData: *mut DXVAHD_STREAM_STATE_PRIVATE_DATA,
448 ) -> HRESULT}
449 FN!{stdcall PDXVAHDSW_VideoProcessBltHD(
450     hVideoProcessor: HANDLE,
451     pOutputSurface: *mut IDirect3DSurface9,
452     OutputFrame: UINT,
453     StreamCount: UINT,
454     pStreams: *const DXVAHD_STREAM_DATA,
455 ) -> HRESULT}
456 FN!{stdcall PDXVAHDSW_DestroyVideoProcessor(
457     hVideoProcessor: HANDLE,
458 ) -> HRESULT}
459 STRUCT!{struct DXVAHDSW_CALLBACKS {
460     CreateDevice: PDXVAHDSW_CreateDevice,
461     ProposeVideoPrivateFormat: PDXVAHDSW_ProposeVideoPrivateFormat,
462     GetVideoProcessorDeviceCaps: PDXVAHDSW_GetVideoProcessorDeviceCaps,
463     GetVideoProcessorOutputFormats: PDXVAHDSW_GetVideoProcessorOutputFormats,
464     GetVideoProcessorInputFormats: PDXVAHDSW_GetVideoProcessorInputFormats,
465     GetVideoProcessorCaps: PDXVAHDSW_GetVideoProcessorCaps,
466     GetVideoProcessorCustomRates: PDXVAHDSW_GetVideoProcessorCustomRates,
467     GetVideoProcessorFilterRange: PDXVAHDSW_GetVideoProcessorFilterRange,
468     DestroyDevice: PDXVAHDSW_DestroyDevice,
469     CreateVideoProcessor: PDXVAHDSW_CreateVideoProcessor,
470     SetVideoProcessBltState: PDXVAHDSW_SetVideoProcessBltState,
471     GetVideoProcessBltStatePrivate: PDXVAHDSW_GetVideoProcessBltStatePrivate,
472     SetVideoProcessStreamState: PDXVAHDSW_SetVideoProcessStreamState,
473     GetVideoProcessStreamStatePrivate: PDXVAHDSW_GetVideoProcessStreamStatePrivate,
474     VideoProcessBltHD: PDXVAHDSW_VideoProcessBltHD,
475     DestroyVideoProcessor: PDXVAHDSW_DestroyVideoProcessor,
476 }}
477 FN!{stdcall PDXVAHDSW_Plugin(
478     Size: UINT,
479     pCallbacks: *mut c_void,
480 ) -> HRESULT}
481 DEFINE_GUID!{DXVAHDControlGuid,
482     0xa0386e75, 0xf70c, 0x464c, 0xa9, 0xce, 0x33, 0xc4, 0x4e, 0x09, 0x16, 0x23}
483 DEFINE_GUID!{DXVAHDETWGUID_CREATEVIDEOPROCESSOR,
484     0x681e3d1e, 0x5674, 0x4fb3, 0xa5, 0x03, 0x2f, 0x20, 0x55, 0xe9, 0x1f, 0x60}
485 DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSBLTSTATE,
486     0x76c94b5a, 0x193f, 0x4692, 0x94, 0x84, 0xa4, 0xd9, 0x99, 0xda, 0x81, 0xa8}
487 DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSSTREAMSTATE,
488     0x262c0b02, 0x209d, 0x47ed, 0x94, 0xd8, 0x82, 0xae, 0x02, 0xb8, 0x4a, 0xa7}
489 DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSBLTHD,
490     0xbef3d435, 0x78c7, 0x4de3, 0x97, 0x07, 0xcd, 0x1b, 0x08, 0x3b, 0x16, 0x0a}
491 DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSBLTHD_STREAM,
492     0x27ae473e, 0xa5fc, 0x4be5, 0xb4, 0xe3, 0xf2, 0x49, 0x94, 0xd3, 0xc4, 0x95}
493 DEFINE_GUID!{DXVAHDETWGUID_DESTROYVIDEOPROCESSOR,
494     0xf943f0a0, 0x3f16, 0x43e0, 0x80, 0x93, 0x10, 0x5a, 0x98, 0x6a, 0xa5, 0xf1}
495 STRUCT!{struct DXVAHDETW_CREATEVIDEOPROCESSOR {
496     pObject: ULONGLONG,
497     pD3D9Ex: ULONGLONG,
498     VPGuid: GUID,
499 }}
500 STRUCT!{struct DXVAHDETW_VIDEOPROCESSBLTSTATE {
501     pObject: ULONGLONG,
502     State: DXVAHD_BLT_STATE,
503     DataSize: UINT,
504     SetState: BOOL,
505 }}
506 STRUCT!{struct DXVAHDETW_VIDEOPROCESSSTREAMSTATE {
507     pObject: ULONGLONG,
508     StreamNumber: UINT,
509     State: DXVAHD_STREAM_STATE,
510     DataSize: UINT,
511     SetState: BOOL,
512 }}
513 STRUCT!{struct DXVAHDETW_VIDEOPROCESSBLTHD {
514     pObject: ULONGLONG,
515     pOutputSurface: ULONGLONG,
516     TargetRect: RECT,
517     OutputFormat: D3DFORMAT,
518     ColorSpace: UINT,
519     OutputFrame: UINT,
520     StreamCount: UINT,
521     Enter: BOOL,
522 }}
523 STRUCT!{struct DXVAHDETW_VIDEOPROCESSBLTHD_STREAM {
524     pObject: ULONGLONG,
525     pInputSurface: ULONGLONG,
526     SourceRect: RECT,
527     DestinationRect: RECT,
528     InputFormat: D3DFORMAT,
529     FrameFormat: DXVAHD_FRAME_FORMAT,
530     ColorSpace: UINT,
531     StreamNumber: UINT,
532     OutputIndex: UINT,
533     InputFrameOrField: UINT,
534     PastFrames: UINT,
535     FutureFrames: UINT,
536 }}
537 STRUCT!{struct DXVAHDETW_DESTROYVIDEOPROCESSOR {
538     pObject: ULONGLONG,
539 }}
540 extern "system" {
DXVAHD_CreateDevice( pD3DDevice: *mut IDirect3DDevice9Ex, pContentDesc: *const DXVAHD_CONTENT_DESC, Usage: DXVAHD_DEVICE_USAGE, pPlugin: PDXVAHDSW_Plugin, ppDevice: *mut *mut IDXVAHD_Device, ) -> HRESULT541     pub fn DXVAHD_CreateDevice(
542         pD3DDevice: *mut IDirect3DDevice9Ex,
543         pContentDesc: *const DXVAHD_CONTENT_DESC,
544         Usage: DXVAHD_DEVICE_USAGE,
545         pPlugin: PDXVAHDSW_Plugin,
546         ppDevice: *mut *mut IDXVAHD_Device,
547     ) -> HRESULT;
548 }
549 FN!{stdcall PDXVAHD_CreateDevice(
550     pD3DDevice: *mut IDirect3DDevice9Ex,
551     pContentDesc: *const DXVAHD_CONTENT_DESC,
552     Usage: DXVAHD_DEVICE_USAGE,
553     pPlugin: PDXVAHDSW_Plugin,
554     ppDevice: *mut *mut IDXVAHD_Device,
555 ) -> HRESULT}
556