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