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
;
297 DXVA2_SurfaceType_DecoderRenderTarget
,
298 DXVA2_SurfaceType_ProcessorRenderTarget
,
299 DXVA2_SurfaceType_D3DRenderTargetTexture
,
302 interface IDirectXVideoDecoder
;
303 interface IDirectXVideoProcessor
;
305 /*****************************************************************************
306 * IDirect3DDeviceManager9 interface
310 uuid(a0cade0f
-06d5
-4cf4
-a1c7
-f3cdd725aa75
),
313 interface IDirect3DDeviceManager9
: IUnknown
316 [in] IDirect3DDevice9
* pDevice
,
317 [in] UINT resetToken
);
319 HRESULT OpenDeviceHandle
(
320 [out] HANDLE* phDevice
);
322 HRESULT CloseDeviceHandle
(
323 [in] HANDLE hDevice
);
326 [in] HANDLE hDevice
);
330 [out] IDirect3DDevice9
** ppDevice
,
333 HRESULT UnlockDevice
(
335 [in] BOOL fSaveState
);
337 HRESULT GetVideoService
(
340 [out] void** ppService
);
343 /*****************************************************************************
344 * IDirectXVideoAccelerationService interface
348 uuid(fc51a550
-d5e7
-11d9
-af55
-00054e43ff02
),
351 interface IDirectXVideoAccelerationService
: IUnknown
353 HRESULT CreateSurface
(
356 [in] UINT backBuffers
,
357 [in] D3DFORMAT format
,
361 [out] IDirect3DSurface9
**ppSurface
,
362 [in, out] HANDLE *pSharedHandle
);
365 /*****************************************************************************
366 * IDirectXVideoDecoderService interface
370 uuid(fc51a551
-d5e7
-11d9
-af55
-00054e43ff02
),
373 interface IDirectXVideoDecoderService
: IDirectXVideoAccelerationService
375 HRESULT GetDecoderDeviceGuids
(
377 [out] GUID
**pGuids
);
379 HRESULT GetDecoderRenderTargets
(
382 [out] D3DFORMAT
**pFormats
);
384 HRESULT GetDecoderConfigurations
(
386 [in] const DXVA2_VideoDesc
*pVideoDesc
,
387 [in] IUnknown
*pReserved
,
389 [out] DXVA2_ConfigPictureDecode
**ppConfigs
);
391 HRESULT CreateVideoDecoder
(
393 [in] const DXVA2_VideoDesc
*pVideoDesc
,
394 [in] DXVA2_ConfigPictureDecode
*pConfig
,
395 [in] IDirect3DSurface9
**ppDecoderRenderTargets
,
396 [in] UINT NumSurfaces
,
397 [out] IDirectXVideoDecoder
**ppDecode
);
400 /*****************************************************************************
401 * IDirectXVideoDecoder interface
405 uuid(f2b0810a
-fd00
-43c9
-918c
-df94e2d8ef7d
),
408 interface IDirectXVideoDecoder
: IUnknown
410 HRESULT GetVideoDecoderService
(
411 [out] IDirectXVideoDecoderService
** ppService
);
413 HRESULT GetCreationParameters
(
414 [out] GUID
* pDeviceGuid
,
415 [out] DXVA2_VideoDesc
* pVideoDesc
,
416 [out] DXVA2_ConfigPictureDecode
* pConfig
,
417 [out] IDirect3DSurface9
*** pDecoderRenderTargets
,
418 [out] UINT
* pNumSurfaces
);
421 [in] UINT BufferType
,
422 [out] void** ppBuffer
,
423 [out] UINT
* pBufferSize
);
425 HRESULT ReleaseBuffer
(
426 [in] UINT BufferType
);
429 [in] IDirect3DSurface9
* pRenderTarget
,
430 [in] void* pvPVPData
);
433 [out] HANDLE* pHandleComplete
);
436 [in] const DXVA2_DecodeExecuteParams
* pExecuteParams
);
439 /*****************************************************************************
440 * IDirectXVideoProcessorService interface
444 uuid(fc51a552
-d5e7
-11d9
-af55
-00054e43ff02
),
447 interface IDirectXVideoProcessorService
: IDirectXVideoAccelerationService
449 HRESULT RegisterVideoProcessorSoftwareDevice
(
450 [in] void* pCallbacks
);
452 HRESULT GetVideoProcessorDeviceGuids
(
453 [in] const DXVA2_VideoDesc
* pVideoDesc
,
455 [out] GUID
** pGuids
);
457 HRESULT GetVideoProcessorRenderTargets
(
458 [in] REFGUID VideoProcDeviceGuid
,
459 [in] const DXVA2_VideoDesc
* pVideoDesc
,
461 [out] D3DFORMAT
** pFormats
);
463 HRESULT GetVideoProcessorSubStreamFormats
(
464 [in] REFGUID VideoProcDeviceGuid
,
465 [in] const DXVA2_VideoDesc
* pVideoDesc
,
466 [in] D3DFORMAT RenderTargetFormat
,
468 [out] D3DFORMAT
** pFormats
);
470 HRESULT GetVideoProcessorCaps
(
471 [in] REFGUID VideoProcDeviceGuid
,
472 [in] const DXVA2_VideoDesc
* pVideoDesc
,
473 [in] D3DFORMAT RenderTargetFormat
,
474 [out] DXVA2_VideoProcessorCaps
* pCaps
);
476 HRESULT GetProcAmpRange
(
477 [in] REFGUID VideoProcDeviceGuid
,
478 [in] const DXVA2_VideoDesc
* pVideoDesc
,
479 [in] D3DFORMAT RenderTargetFormat
,
480 [in] UINT ProcAmpCap
,
481 [out] DXVA2_ValueRange
* pRange
);
483 HRESULT GetFilterPropertyRange
(
484 [in] REFGUID VideoProcDeviceGuid
,
485 [in] const DXVA2_VideoDesc
* pVideoDesc
,
486 [in] D3DFORMAT renderTargetFormat
,
487 [in] UINT FilterSetting
,
488 [out] DXVA2_ValueRange
* pRange
);
490 HRESULT CreateVideoProcessor
(
491 [in] REFGUID VideoProcDeviceGuid
,
492 [in] const DXVA2_VideoDesc
* pVideoDesc
,
493 [in] D3DFORMAT RenderTargetFormat
,
494 [in] UINT MaxNumSubStreams
,
495 [out] IDirectXVideoProcessor
** ppVidProcess
);
498 /*****************************************************************************
499 * IDirectXVideoProcessor interface
503 uuid(8c3a39f0
-916e-4690-804f
-4c8001355d25
),
506 interface IDirectXVideoProcessor
: IUnknown
508 HRESULT GetVideoProcessorService
(
509 [out] IDirectXVideoProcessorService
** ppService
);
511 HRESULT GetCreationParameters
(
512 [out] GUID
* pDeviceGuid
,
513 [out] DXVA2_VideoDesc
* pVideoDesc
,
514 [out] D3DFORMAT
* pRenderTargetFormat
,
515 [out] UINT
* pMaxNumSubStreams
);
517 HRESULT GetVideoProcessorCaps
(
518 [out] DXVA2_VideoProcessorCaps
* pCaps
);
520 HRESULT GetProcAmpRange
(
521 [in] UINT ProcAmpCap
,
522 [out] DXVA2_ValueRange
* pRange
);
524 HRESULT GetFilterPropertyRange
(
525 [in] UINT FilterSetting
,
526 [out] DXVA2_ValueRange
* pRange
);
528 HRESULT VideoProcessBlt
(
529 [in] IDirect3DSurface9
* pRenderTarget
,
530 [in] const DXVA2_VideoProcessBltParams
* pBltParams
,
531 [in] const DXVA2_VideoSample
* pSamples
,
532 [in] UINT NumSamples
,
533 [out] HANDLE* pHandleCompleteIDirect3DDeviceManager9
);
536 /*****************************************************************************
537 * IDirectXVideoMemoryConfiguration interface
541 uuid(b7f916dd
-db3b
-49c1
-84d7
-e45ef99ec726
),
544 interface IDirectXVideoMemoryConfiguration
: IUnknown
546 HRESULT GetAvailableSurfaceTypeByIndex
(
547 [in] DWORD wTypeIndex
,
548 [out] DXVA2_SurfaceType
*pdwType
);
550 HRESULT SetSurfaceType
(
551 [in] DXVA2_SurfaceType dwType
);