summaryrefslogtreecommitdiffstats
path: root/vendor/winapi/src/um/dxvahd.rs
blob: 755dfdc2326aa86a77f853df36ab704f1b3880b9 (plain)
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
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
use ctypes::c_void;
use shared::d3d9::{IDirect3DDevice9Ex, IDirect3DSurface9};
use shared::d3d9types::{D3DCOLOR, D3DFORMAT, D3DPOOL};
use shared::guiddef::GUID;
use shared::minwindef::{BOOL, DWORD, FLOAT, INT, UINT};
use shared::windef::{RECT, SIZE};
use um::unknwnbase::{IUnknown, IUnknownVtbl};
use um::winnt::{HANDLE, HRESULT, ULONGLONG};
DEFINE_GUID!{IID_IDXVAHD_Device,
    0x95f12dfd, 0xd77e, 0x49be, 0x81, 0x5f, 0x57, 0xd5, 0x79, 0x63, 0x4d, 0x6d}
DEFINE_GUID!{IID_IDXVAHD_VideoProcessor,
    0x95f4edf4, 0x6e03, 0x4cd7, 0xbe, 0x1b, 0x30, 0x75, 0xd6, 0x65, 0xaa, 0x52}
ENUM!{enum DXVAHD_FRAME_FORMAT {
    DXVAHD_FRAME_FORMAT_PROGRESSIVE = 0,
    DXVAHD_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1,
    DXVAHD_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2,
}}
ENUM!{enum DXVAHD_DEVICE_USAGE {
    DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL = 0,
    DXVAHD_DEVICE_USAGE_OPTIMAL_SPEED = 1,
    DXVAHD_DEVICE_USAGE_OPTIMAL_QUALITY = 2,
}}
ENUM!{enum DXVAHD_SURFACE_TYPE {
    DXVAHD_SURFACE_TYPE_VIDEO_INPUT = 0,
    DXVAHD_SURFACE_TYPE_VIDEO_INPUT_PRIVATE = 1,
    DXVAHD_SURFACE_TYPE_VIDEO_OUTPUT = 2,
}}
ENUM!{enum DXVAHD_DEVICE_TYPE {
    DXVAHD_DEVICE_TYPE_HARDWARE = 0,
    DXVAHD_DEVICE_TYPE_SOFTWARE = 1,
    DXVAHD_DEVICE_TYPE_REFERENCE = 2,
    DXVAHD_DEVICE_TYPE_OTHER = 3,
}}
ENUM!{enum DXVAHD_DEVICE_CAPS {
    DXVAHD_DEVICE_CAPS_LINEAR_SPACE = 0x1,
    DXVAHD_DEVICE_CAPS_xvYCC = 0x2,
    DXVAHD_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x4,
    DXVAHD_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x8,
}}
ENUM!{enum DXVAHD_FEATURE_CAPS {
    DXVAHD_FEATURE_CAPS_ALPHA_FILL = 0x1,
    DXVAHD_FEATURE_CAPS_CONSTRICTION = 0x2,
    DXVAHD_FEATURE_CAPS_LUMA_KEY = 0x4,
    DXVAHD_FEATURE_CAPS_ALPHA_PALETTE = 0x8,
}}
ENUM!{enum DXVAHD_FILTER_CAPS {
    DXVAHD_FILTER_CAPS_BRIGHTNESS = 0x1,
    DXVAHD_FILTER_CAPS_CONTRAST = 0x2,
    DXVAHD_FILTER_CAPS_HUE = 0x4,
    DXVAHD_FILTER_CAPS_SATURATION = 0x8,
    DXVAHD_FILTER_CAPS_NOISE_REDUCTION = 0x10,
    DXVAHD_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20,
    DXVAHD_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40,
}}
ENUM!{enum DXVAHD_INPUT_FORMAT_CAPS {
    DXVAHD_INPUT_FORMAT_CAPS_RGB_INTERLACED = 0x1,
    DXVAHD_INPUT_FORMAT_CAPS_RGB_PROCAMP = 0x2,
    DXVAHD_INPUT_FORMAT_CAPS_RGB_LUMA_KEY = 0x4,
    DXVAHD_INPUT_FORMAT_CAPS_PALETTE_INTERLACED = 0x8,
}}
ENUM!{enum DXVAHD_PROCESSOR_CAPS {
    DXVAHD_PROCESSOR_CAPS_DEINTERLACE_BLEND = 0x1,
    DXVAHD_PROCESSOR_CAPS_DEINTERLACE_BOB = 0x2,
    DXVAHD_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = 0x4,
    DXVAHD_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = 0x8,
    DXVAHD_PROCESSOR_CAPS_INVERSE_TELECINE = 0x10,
    DXVAHD_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = 0x20,
}}
ENUM!{enum DXVAHD_ITELECINE_CAPS {
    DXVAHD_ITELECINE_CAPS_32 = 0x1,
    DXVAHD_ITELECINE_CAPS_22 = 0x2,
    DXVAHD_ITELECINE_CAPS_2224 = 0x4,
    DXVAHD_ITELECINE_CAPS_2332 = 0x8,
    DXVAHD_ITELECINE_CAPS_32322 = 0x10,
    DXVAHD_ITELECINE_CAPS_55 = 0x20,
    DXVAHD_ITELECINE_CAPS_64 = 0x40,
    DXVAHD_ITELECINE_CAPS_87 = 0x80,
    DXVAHD_ITELECINE_CAPS_222222222223 = 0x100,
    DXVAHD_ITELECINE_CAPS_OTHER = 0x80000000,
}}
ENUM!{enum DXVAHD_FILTER {
    DXVAHD_FILTER_BRIGHTNESS = 0,
    DXVAHD_FILTER_CONTRAST = 1,
    DXVAHD_FILTER_HUE = 2,
    DXVAHD_FILTER_SATURATION = 3,
    DXVAHD_FILTER_NOISE_REDUCTION = 4,
    DXVAHD_FILTER_EDGE_ENHANCEMENT = 5,
    DXVAHD_FILTER_ANAMORPHIC_SCALING = 6,
}}
ENUM!{enum DXVAHD_BLT_STATE {
    DXVAHD_BLT_STATE_TARGET_RECT = 0,
    DXVAHD_BLT_STATE_BACKGROUND_COLOR = 1,
    DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE = 2,
    DXVAHD_BLT_STATE_ALPHA_FILL = 3,
    DXVAHD_BLT_STATE_CONSTRICTION = 4,
    DXVAHD_BLT_STATE_PRIVATE = 1000,
}}
ENUM!{enum DXVAHD_ALPHA_FILL_MODE {
    DXVAHD_ALPHA_FILL_MODE_OPAQUE = 0,
    DXVAHD_ALPHA_FILL_MODE_BACKGROUND = 1,
    DXVAHD_ALPHA_FILL_MODE_DESTINATION = 2,
    DXVAHD_ALPHA_FILL_MODE_SOURCE_STREAM = 3,
}}
ENUM!{enum DXVAHD_STREAM_STATE {
    DXVAHD_STREAM_STATE_D3DFORMAT = 0,
    DXVAHD_STREAM_STATE_FRAME_FORMAT = 1,
    DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE = 2,
    DXVAHD_STREAM_STATE_OUTPUT_RATE = 3,
    DXVAHD_STREAM_STATE_SOURCE_RECT = 4,
    DXVAHD_STREAM_STATE_DESTINATION_RECT = 5,
    DXVAHD_STREAM_STATE_ALPHA = 6,
    DXVAHD_STREAM_STATE_PALETTE = 7,
    DXVAHD_STREAM_STATE_LUMA_KEY = 8,
    DXVAHD_STREAM_STATE_ASPECT_RATIO = 9,
    DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS = 100,
    DXVAHD_STREAM_STATE_FILTER_CONTRAST = 101,
    DXVAHD_STREAM_STATE_FILTER_HUE = 102,
    DXVAHD_STREAM_STATE_FILTER_SATURATION = 103,
    DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION = 104,
    DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT = 105,
    DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING = 106,
    DXVAHD_STREAM_STATE_PRIVATE = 1000,
}}
ENUM!{enum DXVAHD_OUTPUT_RATE {
    DXVAHD_OUTPUT_RATE_NORMAL = 0,
    DXVAHD_OUTPUT_RATE_HALF = 1,
    DXVAHD_OUTPUT_RATE_CUSTOM = 2,
}}
STRUCT!{struct DXVAHD_RATIONAL {
    Numerator: UINT,
    Denominator: UINT,
}}
STRUCT!{struct DXVAHD_COLOR_RGBA {
    R: FLOAT,
    G: FLOAT,
    B: FLOAT,
    A: FLOAT,
}}
STRUCT!{struct DXVAHD_COLOR_YCbCrA {
    Y: FLOAT,
    Cb: FLOAT,
    Cr: FLOAT,
    A: FLOAT,
}}
UNION!{union DXVAHD_COLOR {
    [u32; 4],
    RGB RGB_mut: DXVAHD_COLOR_RGBA,
    YCbCr YCbCr_mut: DXVAHD_COLOR_YCbCrA,
}}
STRUCT!{struct DXVAHD_CONTENT_DESC {
    InputFrameFormat: DXVAHD_FRAME_FORMAT,
    InputFrameRate: DXVAHD_RATIONAL,
    InputWidth: UINT,
    InputHeight: UINT,
    OutputFrameRate: DXVAHD_RATIONAL,
    OutputWidth: UINT,
    OutputHeight: UINT,
}}
STRUCT!{struct DXVAHD_VPDEVCAPS {
    DeviceType: DXVAHD_DEVICE_TYPE,
    DeviceCaps: UINT,
    FeatureCaps: UINT,
    FilterCaps: UINT,
    InputFormatCaps: UINT,
    InputPool: D3DPOOL,
    OutputFormatCount: UINT,
    InputFormatCount: UINT,
    VideoProcessorCount: UINT,
    MaxInputStreams: UINT,
    MaxStreamStates: UINT,
}}
STRUCT!{struct DXVAHD_VPCAPS {
    VPGuid: GUID,
    PastFrames: UINT,
    FutureFrames: UINT,
    ProcessorCaps: UINT,
    ITelecineCaps: UINT,
    CustomRateCount: UINT,
}}
STRUCT!{struct DXVAHD_CUSTOM_RATE_DATA {
    CustomRate: DXVAHD_RATIONAL,
    OutputFrames: UINT,
    InputInterlaced: BOOL,
    InputFramesOrFields: UINT,
}}
STRUCT!{struct DXVAHD_FILTER_RANGE_DATA {
    Minimum: INT,
    Maximum: INT,
    Default: INT,
    Multiplier: FLOAT,
}}
STRUCT!{struct DXVAHD_BLT_STATE_TARGET_RECT_DATA {
    Enable: BOOL,
    TargetRect: RECT,
}}
STRUCT!{struct DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA {
    YCbCr: BOOL,
    BackgroundColor: DXVAHD_COLOR,
}}
STRUCT!{struct DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA {
    Value: UINT,
}}
BITFIELD!{DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA Value: UINT [
    Usage set_Usage[0..1],
    RGB_Range set_RGB_Range[1..2],
    YCbCr_Matrix set_YCbCr_Matrix[2..3],
    YCbCr_xvYCC set_YCbCr_xvYCC[3..4],
    Reserved set_Reserved[4..32],
]}
STRUCT!{struct DXVAHD_BLT_STATE_ALPHA_FILL_DATA {
    Mode: DXVAHD_ALPHA_FILL_MODE,
    StreamNumber: UINT,
}}
STRUCT!{struct DXVAHD_BLT_STATE_CONSTRICTION_DATA {
    Enable: BOOL,
    Size: SIZE,
}}
STRUCT!{struct DXVAHD_BLT_STATE_PRIVATE_DATA {
    Guid: GUID,
    DataSize: UINT,
    pData: *mut c_void,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_D3DFORMAT_DATA {
    Format: D3DFORMAT,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA {
    FrameFormat: DXVAHD_FRAME_FORMAT,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA {
    Value: UINT,
}}
BITFIELD!{DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA Value: UINT [
    Type set_Type[0..1],
    RGB_Range set_RGB_Range[1..2],
    YCbCr_Matrix set_YCbCr_Matrix[2..3],
    YCbCr_xvYCC set_YCbCr_xvYCC[3..4],
    Reserved set_Reserved[4..32],
]}
STRUCT!{struct DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA {
    RepeatFrame: BOOL,
    OutputRate: DXVAHD_OUTPUT_RATE,
    CustomRate: DXVAHD_RATIONAL,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_SOURCE_RECT_DATA {
    Enable: BOOL,
    SourceRect: RECT,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA {
    Enable: BOOL,
    DestinationRect: RECT,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_ALPHA_DATA {
    Enable: BOOL,
    Alpha: FLOAT,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_PALETTE_DATA {
    Count: UINT,
    pEntries: *mut D3DCOLOR,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_LUMA_KEY_DATA {
    Enable: BOOL,
    Lower: FLOAT,
    Upper: FLOAT,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA {
    Enable: BOOL,
    SourceAspectRatio: DXVAHD_RATIONAL,
    DestinationAspectRatio: DXVAHD_RATIONAL,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_FILTER_DATA {
    Enable: BOOL,
    Level: INT,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_PRIVATE_DATA {
    Guid: GUID,
    DataSize: UINT,
    pData: *mut c_void,
}}
STRUCT!{struct DXVAHD_STREAM_DATA {
    Enable: BOOL,
    OutputIndex: UINT,
    InputFrameOrField: UINT,
    PastFrames: UINT,
    FutureFrames: UINT,
    ppPastSurfaces: *mut *mut IDirect3DSurface9,
    pInputSurface: *mut IDirect3DSurface9,
    ppFutureSurfaces: *mut *mut IDirect3DSurface9,
}}
STRUCT!{struct DXVAHD_STREAM_STATE_PRIVATE_IVTC_DATA {
    Enable: BOOL,
    ITelecineFlags: UINT,
    Frames: UINT,
    InputField: UINT,
}}
RIDL!{#[uuid(0x95f12dfd, 0xd77e, 0x49be, 0x81, 0x5f, 0x57, 0xd5, 0x79, 0x63, 0x4d, 0x6d)]
interface IDXVAHD_Device(IDXVAHD_DeviceVtbl): IUnknown(IUnknownVtbl) {
    fn CreateVideoSurface(
        Width: UINT,
        Height: UINT,
        Format: D3DFORMAT,
        Pool: D3DPOOL,
        Usage: DWORD,
        Type: DXVAHD_SURFACE_TYPE,
        NumSurfaces: UINT,
        ppSurfaces: *mut *mut IDirect3DSurface9,
        pSharedHandle: *mut HANDLE,
    ) -> HRESULT,
    fn GetVideoProcessorDeviceCaps(
        pCaps: *mut DXVAHD_VPDEVCAPS,
    ) -> HRESULT,
    fn GetVideoProcessorOutputFormats(
        Count: UINT,
        pFormats: *mut D3DFORMAT,
    ) -> HRESULT,
    fn GetVideoProcessorInputFormats(
        Count: UINT,
        pFormats: *mut D3DFORMAT,
    ) -> HRESULT,
    fn GetVideoProcessorCaps(
        Count: UINT,
        pCaps: *mut DXVAHD_VPCAPS,
    ) -> HRESULT,
    fn GetVideoProcessorCustomRates(
        pVPGuid: *const GUID,
        Count: UINT,
        pRates: *mut DXVAHD_CUSTOM_RATE_DATA,
    ) -> HRESULT,
    fn GetVideoProcessorFilterRange(
        Filter: DXVAHD_FILTER,
        pRange: *mut DXVAHD_FILTER_RANGE_DATA,
    ) -> HRESULT,
    fn CreateVideoProcessor(
        pVPGuid: *const GUID,
        ppVideoProcessor: *mut *mut IDXVAHD_VideoProcessor,
    ) -> HRESULT,
}}
RIDL!{#[uuid(0x95f4edf4, 0x6e03, 0x4cd7, 0xbe, 0x1b, 0x30, 0x75, 0xd6, 0x65, 0xaa, 0x52)]
interface IDXVAHD_VideoProcessor(IDXVAHD_VideoProcessorVtbl): IUnknown(IUnknownVtbl) {
    fn SetVideoProcessBltState(
        State: DXVAHD_BLT_STATE,
        DataSize: UINT,
        pData: *const c_void,
    ) -> HRESULT,
    fn GetVideoProcessBltState(
        State: DXVAHD_BLT_STATE,
        DataSize: UINT,
        pData: *mut c_void,
    ) -> HRESULT,
    fn SetVideoProcessStreamState(
        StreamNumber: UINT,
        State: DXVAHD_STREAM_STATE,
        DataSize: UINT,
        pData: *const c_void,
    ) -> HRESULT,
    fn GetVideoProcessStreamState(
        StreamNumber: UINT,
        State: DXVAHD_STREAM_STATE,
        DataSize: UINT,
        pData: *mut c_void,
    ) -> HRESULT,
    fn VideoProcessBltHD(
        pOutputSurface: *mut IDirect3DSurface9,
        OutputFrame: UINT,
        StreamCount: UINT,
        pStreams: *const DXVAHD_STREAM_DATA,
    ) -> HRESULT,
}}
FN!{stdcall PDXVAHDSW_CreateDevice(
    pD3DDevice: *mut IDirect3DDevice9Ex,
    phDevice: *mut HANDLE,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_ProposeVideoPrivateFormat(
    hDevice: HANDLE,
    pFormat: *mut D3DFORMAT,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessorDeviceCaps(
    hDevice: HANDLE,
    pContentDesc: *const DXVAHD_CONTENT_DESC,
    Usage: DXVAHD_DEVICE_USAGE,
    pCaps: *mut DXVAHD_VPDEVCAPS,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessorOutputFormats(
    hDevice: HANDLE,
    pContentDesc: *const DXVAHD_CONTENT_DESC,
    Usage: DXVAHD_DEVICE_USAGE,
    Count: UINT,
    pFormats: *mut D3DFORMAT,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessorInputFormats(
    hDevice: HANDLE,
    pContentDesc: *const DXVAHD_CONTENT_DESC,
    Usage: DXVAHD_DEVICE_USAGE,
    Count: UINT,
    pFormats: *mut D3DFORMAT,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessorCaps(
    hDevice: HANDLE,
    pContentDesc: *const DXVAHD_CONTENT_DESC,
    Usage: DXVAHD_DEVICE_USAGE,
    Count: UINT,
    pCaps: *mut DXVAHD_VPCAPS,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessorCustomRates(
    hDevice: HANDLE,
    pVPGuid: *const GUID,
    Count: UINT,
    pRates: *mut DXVAHD_CUSTOM_RATE_DATA,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessorFilterRange(
    hDevice: HANDLE,
    Filter: DXVAHD_FILTER,
    pRange: *mut DXVAHD_FILTER_RANGE_DATA,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_DestroyDevice(
    hDevice: HANDLE,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_CreateVideoProcessor(
    hDevice: HANDLE,
    pVPGuid: *const GUID,
    phVideoProcessor: *mut HANDLE,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_SetVideoProcessBltState(
    hVideoProcessor: HANDLE,
    State: DXVAHD_BLT_STATE,
    DataSize: UINT,
    pData: *const c_void,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessBltStatePrivate(
    hVideoProcessor: HANDLE,
    pData: *mut DXVAHD_BLT_STATE_PRIVATE_DATA,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_SetVideoProcessStreamState(
    hVideoProcessor: HANDLE,
    StreamNumber: UINT,
    State: DXVAHD_STREAM_STATE,
    DataSize: UINT,
    pData: *const c_void,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_GetVideoProcessStreamStatePrivate(
    hVideoProcessor: HANDLE,
    StreamNumber: UINT,
    pData: *mut DXVAHD_STREAM_STATE_PRIVATE_DATA,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_VideoProcessBltHD(
    hVideoProcessor: HANDLE,
    pOutputSurface: *mut IDirect3DSurface9,
    OutputFrame: UINT,
    StreamCount: UINT,
    pStreams: *const DXVAHD_STREAM_DATA,
) -> HRESULT}
FN!{stdcall PDXVAHDSW_DestroyVideoProcessor(
    hVideoProcessor: HANDLE,
) -> HRESULT}
STRUCT!{struct DXVAHDSW_CALLBACKS {
    CreateDevice: PDXVAHDSW_CreateDevice,
    ProposeVideoPrivateFormat: PDXVAHDSW_ProposeVideoPrivateFormat,
    GetVideoProcessorDeviceCaps: PDXVAHDSW_GetVideoProcessorDeviceCaps,
    GetVideoProcessorOutputFormats: PDXVAHDSW_GetVideoProcessorOutputFormats,
    GetVideoProcessorInputFormats: PDXVAHDSW_GetVideoProcessorInputFormats,
    GetVideoProcessorCaps: PDXVAHDSW_GetVideoProcessorCaps,
    GetVideoProcessorCustomRates: PDXVAHDSW_GetVideoProcessorCustomRates,
    GetVideoProcessorFilterRange: PDXVAHDSW_GetVideoProcessorFilterRange,
    DestroyDevice: PDXVAHDSW_DestroyDevice,
    CreateVideoProcessor: PDXVAHDSW_CreateVideoProcessor,
    SetVideoProcessBltState: PDXVAHDSW_SetVideoProcessBltState,
    GetVideoProcessBltStatePrivate: PDXVAHDSW_GetVideoProcessBltStatePrivate,
    SetVideoProcessStreamState: PDXVAHDSW_SetVideoProcessStreamState,
    GetVideoProcessStreamStatePrivate: PDXVAHDSW_GetVideoProcessStreamStatePrivate,
    VideoProcessBltHD: PDXVAHDSW_VideoProcessBltHD,
    DestroyVideoProcessor: PDXVAHDSW_DestroyVideoProcessor,
}}
FN!{stdcall PDXVAHDSW_Plugin(
    Size: UINT,
    pCallbacks: *mut c_void,
) -> HRESULT}
DEFINE_GUID!{DXVAHDControlGuid,
    0xa0386e75, 0xf70c, 0x464c, 0xa9, 0xce, 0x33, 0xc4, 0x4e, 0x09, 0x16, 0x23}
DEFINE_GUID!{DXVAHDETWGUID_CREATEVIDEOPROCESSOR,
    0x681e3d1e, 0x5674, 0x4fb3, 0xa5, 0x03, 0x2f, 0x20, 0x55, 0xe9, 0x1f, 0x60}
DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSBLTSTATE,
    0x76c94b5a, 0x193f, 0x4692, 0x94, 0x84, 0xa4, 0xd9, 0x99, 0xda, 0x81, 0xa8}
DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSSTREAMSTATE,
    0x262c0b02, 0x209d, 0x47ed, 0x94, 0xd8, 0x82, 0xae, 0x02, 0xb8, 0x4a, 0xa7}
DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSBLTHD,
    0xbef3d435, 0x78c7, 0x4de3, 0x97, 0x07, 0xcd, 0x1b, 0x08, 0x3b, 0x16, 0x0a}
DEFINE_GUID!{DXVAHDETWGUID_VIDEOPROCESSBLTHD_STREAM,
    0x27ae473e, 0xa5fc, 0x4be5, 0xb4, 0xe3, 0xf2, 0x49, 0x94, 0xd3, 0xc4, 0x95}
DEFINE_GUID!{DXVAHDETWGUID_DESTROYVIDEOPROCESSOR,
    0xf943f0a0, 0x3f16, 0x43e0, 0x80, 0x93, 0x10, 0x5a, 0x98, 0x6a, 0xa5, 0xf1}
STRUCT!{struct DXVAHDETW_CREATEVIDEOPROCESSOR {
    pObject: ULONGLONG,
    pD3D9Ex: ULONGLONG,
    VPGuid: GUID,
}}
STRUCT!{struct DXVAHDETW_VIDEOPROCESSBLTSTATE {
    pObject: ULONGLONG,
    State: DXVAHD_BLT_STATE,
    DataSize: UINT,
    SetState: BOOL,
}}
STRUCT!{struct DXVAHDETW_VIDEOPROCESSSTREAMSTATE {
    pObject: ULONGLONG,
    StreamNumber: UINT,
    State: DXVAHD_STREAM_STATE,
    DataSize: UINT,
    SetState: BOOL,
}}
STRUCT!{struct DXVAHDETW_VIDEOPROCESSBLTHD {
    pObject: ULONGLONG,
    pOutputSurface: ULONGLONG,
    TargetRect: RECT,
    OutputFormat: D3DFORMAT,
    ColorSpace: UINT,
    OutputFrame: UINT,
    StreamCount: UINT,
    Enter: BOOL,
}}
STRUCT!{struct DXVAHDETW_VIDEOPROCESSBLTHD_STREAM {
    pObject: ULONGLONG,
    pInputSurface: ULONGLONG,
    SourceRect: RECT,
    DestinationRect: RECT,
    InputFormat: D3DFORMAT,
    FrameFormat: DXVAHD_FRAME_FORMAT,
    ColorSpace: UINT,
    StreamNumber: UINT,
    OutputIndex: UINT,
    InputFrameOrField: UINT,
    PastFrames: UINT,
    FutureFrames: UINT,
}}
STRUCT!{struct DXVAHDETW_DESTROYVIDEOPROCESSOR {
    pObject: ULONGLONG,
}}
extern "system" {
    pub fn DXVAHD_CreateDevice(
        pD3DDevice: *mut IDirect3DDevice9Ex,
        pContentDesc: *const DXVAHD_CONTENT_DESC,
        Usage: DXVAHD_DEVICE_USAGE,
        pPlugin: PDXVAHDSW_Plugin,
        ppDevice: *mut *mut IDXVAHD_Device,
    ) -> HRESULT;
}
FN!{stdcall PDXVAHD_CreateDevice(
    pD3DDevice: *mut IDirect3DDevice9Ex,
    pContentDesc: *const DXVAHD_CONTENT_DESC,
    Usage: DXVAHD_DEVICE_USAGE,
    pPlugin: PDXVAHDSW_Plugin,
    ppDevice: *mut *mut IDXVAHD_Device,
) -> HRESULT}