2 * Copyright 2014 Michael Müller for Pipelight
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 typedef DWORD IDirect3DDevice9
;
23 typedef DWORD IDirect3DSurface9
;
25 typedef DWORD D3DFORMAT
;
26 typedef DWORD D3DPOOL
;
30 cpp_quote
("DEFINE_GUID(DXVA2_ModeMPEG2_MoComp, 0xe6a9f44b, 0x61b0,0x4563, 0x9e,0xa4,0x63,0xd2,0xa3,0xc6,0xfe,0x66);")
31 cpp_quote
("#define DXVA2_ModeMPEG2_MOCOMP DXVA2_ModeMPEG2_MoComp")
33 cpp_quote
("DEFINE_GUID(DXVA2_ModeMPEG2_IDCT, 0xbf22ad00, 0x03ea,0x4690, 0x80,0x77,0x47,0x33,0x46,0x20,0x9b,0x7e);")
35 cpp_quote
("DEFINE_GUID(DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28,0x4e65, 0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9);")
38 cpp_quote
("DEFINE_GUID(DXVA2_ModeH264_A, 0x1b81be64, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
39 cpp_quote
("#define DXVA2_ModeH264_MoComp_NoFGT DXVA2_ModeH264_A")
41 cpp_quote
("DEFINE_GUID(DXVA2_ModeH264_B, 0x1b81be65, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
42 cpp_quote
("#define DXVA2_ModeH264_MoComp_FGT DXVA2_ModeH264_B")
44 cpp_quote
("DEFINE_GUID(DXVA2_ModeH264_C, 0x1b81be66, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
45 cpp_quote
("#define DXVA2_ModeH264_IDCT_NoFGT DXVA2_ModeH264_C")
47 cpp_quote
("DEFINE_GUID(DXVA2_ModeH264_D, 0x1b81be67, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
48 cpp_quote
("#define DXVA2_ModeH264_IDCT_FGT DXVA2_ModeH264_D")
50 cpp_quote
("DEFINE_GUID(DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
51 cpp_quote
("#define DXVA2_ModeH264_VLD_NoFGT DXVA2_ModeH264_E")
53 cpp_quote
("DEFINE_GUID(DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
54 cpp_quote
("#define DXVA2_ModeH264_VLD_FGT DXVA2_ModeH264_F")
57 cpp_quote
("DEFINE_GUID(DXVA2_ModeWMV8_A, 0x1b81be80, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
58 cpp_quote
("#define DXVA2_ModeWMV8_PostProc DXVA2_ModeWMV8_A")
60 cpp_quote
("DEFINE_GUID(DXVA2_ModeWMV8_B, 0x1b81be81, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
61 cpp_quote
("#define DXVA2_ModeWMV8_MoComp DXVA2_ModeWMV8_B")
64 cpp_quote
("DEFINE_GUID(DXVA2_ModeWMV9_A, 0x1b81be90, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
65 cpp_quote
("#define DXVA2_ModeWMV9_PostProc DXVA2_ModeWMV9_A")
67 cpp_quote
("DEFINE_GUID(DXVA2_ModeWMV9_B, 0x1b81be91, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
68 cpp_quote
("#define DXVA2_ModeWMV9_MoComp DXVA2_ModeWMV9_B")
70 cpp_quote
("DEFINE_GUID(DXVA2_ModeWMV9_C, 0x1b81be94, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
71 cpp_quote
("#define DXVA2_ModeWMV9_IDCT DXVA2_ModeWMV9_C")
74 cpp_quote
("DEFINE_GUID(DXVA2_ModeVC1_A, 0x1b81beA0, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
75 cpp_quote
("#define DXVA2_ModeVC1_PostProc DXVA2_ModeVC1_A")
77 cpp_quote
("DEFINE_GUID(DXVA2_ModeVC1_B, 0x1b81beA1, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
78 cpp_quote
("#define DXVA2_ModeVC1_MoComp DXVA2_ModeVC1_B")
80 cpp_quote
("DEFINE_GUID(DXVA2_ModeVC1_C, 0x1b81beA2, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
81 cpp_quote
("#define DXVA2_ModeVC1_IDCT DXVA2_ModeVC1_C")
83 cpp_quote
("DEFINE_GUID(DXVA2_ModeVC1_D, 0x1b81beA3, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
84 cpp_quote
("#define DXVA2_ModeVC1_VLD DXVA2_ModeVC1_D")
87 cpp_quote
("DEFINE_GUID(DXVA_NoEncrypt, 0x1b81bed0, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
89 typedef LONGLONG REFERENCE_TIME
;
93 DXVA2_PictureParametersBufferType
,
94 DXVA2_MacroBlockControlBufferType
,
95 DXVA2_ResidualDifferenceBufferType
,
96 DXVA2_DeblockingControlBufferType
,
97 DXVA2_InverseQuantizationMatrixBufferType
,
98 DXVA2_SliceControlBufferType
,
99 DXVA2_BitStreamDateBufferType
,
100 DXVA2_MotionVectorBuffer
,
101 DXVA2_FilmGrainBuffer
106 DXVA2_VideoDecoderRenderTarget
,
107 DXVA2_VideoProcessorRenderTarget
,
108 DXVA2_VideoSoftwareRenderTarget
111 typedef struct _DXVA2_ExtendedFormat
117 UINT SampleFormat
:8;
118 UINT VideoChromaSubsampling
:4;
119 UINT NominalRange
:3;
120 UINT VideoTransferMatrix
:3;
121 UINT VideoLighting
:4;
122 UINT VideoPrimaries
:5;
123 UINT VideoTransferFunction
:5;
127 } DXVA2_ExtendedFormat
;
129 typedef struct _DXVA2_Frequency
135 typedef struct _DXVA2_ConfigPictureDecode
137 GUID guidConfigBitstreamEncryption
;
138 GUID guidConfigMBcontrolEncryption
;
139 GUID guidConfigResidDiffEncryption
;
140 UINT ConfigBitstreamRaw
;
141 UINT ConfigMBcontrolRasterOrder
;
142 UINT ConfigResidDiffHost
;
143 UINT ConfigSpatialResid8
;
144 UINT ConfigResid8Subtraction
;
145 UINT ConfigSpatialHost8or9Clipping
;
146 UINT ConfigSpatialResidInterleaved
;
147 UINT ConfigIntraResidUnsigned
;
148 UINT ConfigResidDiffAccelerator
;
149 UINT ConfigHostInverseScan
;
150 UINT ConfigSpecificIDCT
;
151 UINT Config4GroupedCoefs
;
152 UINT ConfigMinRenderTargetBuffCount
;
153 USHORT ConfigDecoderSpecific
;
154 } DXVA2_ConfigPictureDecode
;
156 typedef struct _DXVA2_VideoDesc
160 DXVA2_ExtendedFormat SampleFormat
;
162 DXVA2_Frequency InputSampleFreq
;
163 DXVA2_Frequency OutputFrameFreq
;
164 UINT UABProtectionLevel
;
168 typedef struct _DXVA2_DecodeBufferDesc
170 DWORD CompressedBufferType
;
181 } DXVA2_DecodeBufferDesc
;
183 typedef struct _DXVA2_DecodeExtensionData
186 PVOID pPrivateInputData
;
187 UINT PrivateInputDataSize
;
188 PVOID pPrivateOutputData
;
189 UINT PrivateOutputDataSize
;
190 } DXVA2_DecodeExtensionData
;
192 typedef struct _DXVA2_DecodeExecuteParams
195 DXVA2_DecodeBufferDesc
* pCompressedBuffers
;
196 DXVA2_DecodeExtensionData
* pExtensionData
;
197 } DXVA2_DecodeExecuteParams
;
199 typedef struct _DXVA2_VideoProcessorCaps
203 UINT NumForwardRefSamples
;
204 UINT NumBackwardRefSamples
;
206 UINT DeinterlaceTechnology
;
207 UINT ProcAmpControlCaps
;
208 UINT VideoProcessorOperations
;
209 UINT NoiseFilterTechnology
;
210 UINT DetailFilterTechnology
;
211 } DXVA2_VideoProcessorCaps
;
213 typedef struct _DXVA2_Fixed32
226 typedef struct _DXVA2_ValueRange
228 DXVA2_Fixed32 MinValue
;
229 DXVA2_Fixed32 MaxValue
;
230 DXVA2_Fixed32
DefaultValue;
231 DXVA2_Fixed32 StepSize
;
234 typedef struct _DXVA2_AYUVSample8
242 typedef struct _DXVA2_AYUVSample16
248 } DXVA2_AYUVSample16
;
250 typedef struct _DXVA2_ProcAmpValues
252 DXVA2_Fixed32 Brightness
;
253 DXVA2_Fixed32 Contrast
;
255 DXVA2_Fixed32 Saturation
;
256 } DXVA2_ProcAmpValues
;
258 typedef struct _DXVA2_FilterValues
261 DXVA2_Fixed32 Threshold
;
262 DXVA2_Fixed32 Radius
;
263 } DXVA2_FilterValues
;
265 typedef struct _DXVA2_VideoProcessBltParams
267 REFERENCE_TIME TargetFrame
;
269 SIZE ConstrictionSize
;
271 DXVA2_AYUVSample16 BackgroundColor
;
272 DXVA2_ExtendedFormat DestFormat
;
273 DXVA2_ProcAmpValues ProcAmpValues
;
275 DXVA2_FilterValues NoiseFilterLuma
;
276 DXVA2_FilterValues NoiseFilterChroma
;
277 DXVA2_FilterValues DetailFilterLuma
;
278 DXVA2_FilterValues DetailFilterChroma
;
280 } DXVA2_VideoProcessBltParams
;
282 typedef struct _DXVA2_VideoSample
284 REFERENCE_TIME Start
;
286 DXVA2_ExtendedFormat SampleFormat
;
287 IDirect3DSurface9
* SrcSurface
;
290 DXVA2_AYUVSample8 Pal
[16];
291 DXVA2_Fixed32 PlanarAlpha
;
295 interface IDirectXVideoDecoder
;
296 interface IDirectXVideoProcessor
;
298 /*****************************************************************************
299 * IDirect3DDeviceManager9 interface
303 uuid(a0cade0f
-06d5
-4cf4
-a1c7
-f3cdd725aa75
),
306 interface IDirect3DDeviceManager9
: IUnknown
309 [in] IDirect3DDevice9
* pDevice
,
310 [in] UINT resetToken
);
312 HRESULT OpenDeviceHandle
(
313 [out] HANDLE* phDevice
);
315 HRESULT CloseDeviceHandle
(
316 [in] HANDLE hDevice
);
319 [in] HANDLE hDevice
);
323 [out] IDirect3DDevice9
** ppDevice
,
326 HRESULT UnlockDevice
(
328 [in] BOOL fSaveState
);
330 HRESULT GetVideoService
(
333 [out] void** ppService
);
336 /*****************************************************************************
337 * IDirectXVideoAccelerationService interface
341 uuid(fc51a550
-d5e7
-11d9
-af55
-00054e43ff02
),
344 interface IDirectXVideoAccelerationService
: IUnknown
346 HRESULT CreateSurface
(
349 [in] UINT backBuffers
,
350 [in] D3DFORMAT format
,
354 [out] IDirect3DSurface9
**ppSurface
,
355 [in, out] HANDLE *pSharedHandle
);
358 /*****************************************************************************
359 * IDirectXVideoDecoderService interface
363 uuid(fc51a551
-d5e7
-11d9
-af55
-00054e43ff02
),
366 interface IDirectXVideoDecoderService
: IDirectXVideoAccelerationService
368 HRESULT GetDecoderDeviceGuids
(
370 [out] GUID
**pGuids
);
372 HRESULT GetDecoderRenderTargets
(
375 [out] D3DFORMAT
**pFormats
);
377 HRESULT GetDecoderConfigurations
(
379 [in] const DXVA2_VideoDesc
*pVideoDesc
,
380 [in] IUnknown
*pReserved
,
382 [out] DXVA2_ConfigPictureDecode
**ppConfigs
);
384 HRESULT CreateVideoDecoder
(
386 [in] const DXVA2_VideoDesc
*pVideoDesc
,
387 [in] DXVA2_ConfigPictureDecode
*pConfig
,
388 [in] IDirect3DSurface9
**ppDecoderRenderTargets
,
389 [in] UINT NumSurfaces
,
390 [out] IDirectXVideoDecoder
**ppDecode
);
393 /*****************************************************************************
394 * IDirectXVideoDecoder interface
398 uuid(f2b0810a
-fd00
-43c9
-918c
-df94e2d8ef7d
),
401 interface IDirectXVideoDecoder
: IUnknown
403 HRESULT GetVideoDecoderService
(
404 [out] IDirectXVideoDecoderService
** ppService
);
406 HRESULT GetCreationParameters
(
407 [out] GUID
* pDeviceGuid
,
408 [out] DXVA2_VideoDesc
* pVideoDesc
,
409 [out] DXVA2_ConfigPictureDecode
* pConfig
,
410 [out] IDirect3DSurface9
*** pDecoderRenderTargets
,
411 [out] UINT
* pNumSurfaces
);
414 [in] UINT BufferType
,
415 [out] void** ppBuffer
,
416 [out] UINT
* pBufferSize
);
418 HRESULT ReleaseBuffer
(
419 [in] UINT BufferType
);
422 [in] IDirect3DSurface9
* pRenderTarget
,
423 [in] void* pvPVPData
);
426 [out] HANDLE* pHandleComplete
);
429 [in] const DXVA2_DecodeExecuteParams
* pExecuteParams
);
432 /*****************************************************************************
433 * IDirectXVideoProcessorService interface
437 uuid(fc51a551
-d5e7
-11d9
-af55
-00054e43ff02
),
440 interface IDirectXVideoProcessorService
: IDirectXVideoAccelerationService
442 HRESULT RegisterVideoProcessorSoftwareDevice
(
443 [in] void* pCallbacks
);
445 HRESULT GetVideoProcessorDeviceGuids
(
446 [in] const DXVA2_VideoDesc
* pVideoDesc
,
448 [out] GUID
** pGuids
);
450 HRESULT GetVideoProcessorRenderTargets
(
451 [in] REFGUID VideoProcDeviceGuid
,
452 [in] const DXVA2_VideoDesc
* pVideoDesc
,
454 [out] D3DFORMAT
** pFormats
);
456 HRESULT GetVideoProcessorSubStreamFormats
(
457 [in] REFGUID VideoProcDeviceGuid
,
458 [in] const DXVA2_VideoDesc
* pVideoDesc
,
459 [in] D3DFORMAT RenderTargetFormat
,
461 [out] D3DFORMAT
** pFormats
);
463 HRESULT GetVideoProcessorCaps
(
464 [in] REFGUID VideoProcDeviceGuid
,
465 [in] const DXVA2_VideoDesc
* pVideoDesc
,
466 [in] D3DFORMAT RenderTargetFormat
,
467 [out] DXVA2_VideoProcessorCaps
* pCaps
);
469 HRESULT GetProcAmpRange
(
470 [in] REFGUID VideoProcDeviceGuid
,
471 [in] const DXVA2_VideoDesc
* pVideoDesc
,
472 [in] D3DFORMAT RenderTargetFormat
,
473 [in] UINT ProcAmpCap
,
474 [out] DXVA2_ValueRange
* pRange
);
476 HRESULT GetFilterPropertyRange
(
477 [in] REFGUID VideoProcDeviceGuid
,
478 [in] const DXVA2_VideoDesc
* pVideoDesc
,
479 [in] D3DFORMAT renderTargetFormat
,
480 [in] UINT FilterSetting
,
481 [out] DXVA2_ValueRange
* pRange
);
483 HRESULT CreateVideoProcessor
(
484 [in] REFGUID VideoProcDeviceGuid
,
485 [in] const DXVA2_VideoDesc
* pVideoDesc
,
486 [in] D3DFORMAT RenderTargetFormat
,
487 [in] UINT MaxNumSubStreams
,
488 [out] IDirectXVideoProcessor
** ppVidProcess
);
491 /*****************************************************************************
492 * IDirectXVideoProcessor interface
496 uuid(8c3a39f0
-916e-4690-804f
-4c8001355d25
),
499 interface IDirectXVideoProcessor
: IUnknown
501 HRESULT GetVideoProcessorService
(
502 [out] IDirectXVideoProcessorService
** ppService
);
504 HRESULT GetCreationParameters
(
505 [out] GUID
* pDeviceGuid
,
506 [out] DXVA2_VideoDesc
* pVideoDesc
,
507 [out] D3DFORMAT
* pRenderTargetFormat
,
508 [out] UINT
* pMaxNumSubStreams
);
510 HRESULT GetVideoProcessorCaps
(
511 [out] DXVA2_VideoProcessorCaps
* pCaps
);
513 HRESULT GetProcAmpRange
(
514 [in] UINT ProcAmpCap
,
515 [out] DXVA2_ValueRange
* pRange
);
517 HRESULT GetFilterPropertyRange
(
518 [in] UINT FilterSetting
,
519 [out] DXVA2_ValueRange
* pRange
);
521 HRESULT VideoProcessBlt
(
522 [in] IDirect3DSurface9
* pRenderTarget
,
523 [in] const DXVA2_VideoProcessBltParams
* pBltParams
,
524 [in] const DXVA2_VideoSample
* pSamples
,
525 [in] UINT NumSamples
,
526 [out] HANDLE* pHandleCompleteIDirect3DDeviceManager9
);