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 cpp_quote
("#ifndef REFERENCE_TIME_DEFINED")
90 cpp_quote
("#define REFERENCE_TIME_DEFINED")
91 typedef LONGLONG REFERENCE_TIME
;
96 DXVA2_PictureParametersBufferType
,
97 DXVA2_MacroBlockControlBufferType
,
98 DXVA2_ResidualDifferenceBufferType
,
99 DXVA2_DeblockingControlBufferType
,
100 DXVA2_InverseQuantizationMatrixBufferType
,
101 DXVA2_SliceControlBufferType
,
102 DXVA2_BitStreamDateBufferType
,
103 DXVA2_MotionVectorBuffer
,
104 DXVA2_FilmGrainBuffer
109 DXVA2_VideoDecoderRenderTarget
,
110 DXVA2_VideoProcessorRenderTarget
,
111 DXVA2_VideoSoftwareRenderTarget
114 typedef struct _DXVA2_ExtendedFormat
120 UINT SampleFormat
:8;
121 UINT VideoChromaSubsampling
:4;
122 UINT NominalRange
:3;
123 UINT VideoTransferMatrix
:3;
124 UINT VideoLighting
:4;
125 UINT VideoPrimaries
:5;
126 UINT VideoTransferFunction
:5;
130 } DXVA2_ExtendedFormat
;
132 typedef struct _DXVA2_Frequency
138 typedef struct _DXVA2_ConfigPictureDecode
140 GUID guidConfigBitstreamEncryption
;
141 GUID guidConfigMBcontrolEncryption
;
142 GUID guidConfigResidDiffEncryption
;
143 UINT ConfigBitstreamRaw
;
144 UINT ConfigMBcontrolRasterOrder
;
145 UINT ConfigResidDiffHost
;
146 UINT ConfigSpatialResid8
;
147 UINT ConfigResid8Subtraction
;
148 UINT ConfigSpatialHost8or9Clipping
;
149 UINT ConfigSpatialResidInterleaved
;
150 UINT ConfigIntraResidUnsigned
;
151 UINT ConfigResidDiffAccelerator
;
152 UINT ConfigHostInverseScan
;
153 UINT ConfigSpecificIDCT
;
154 UINT Config4GroupedCoefs
;
155 UINT ConfigMinRenderTargetBuffCount
;
156 USHORT ConfigDecoderSpecific
;
157 } DXVA2_ConfigPictureDecode
;
159 typedef struct _DXVA2_VideoDesc
163 DXVA2_ExtendedFormat SampleFormat
;
165 DXVA2_Frequency InputSampleFreq
;
166 DXVA2_Frequency OutputFrameFreq
;
167 UINT UABProtectionLevel
;
171 typedef struct _DXVA2_DecodeBufferDesc
173 DWORD CompressedBufferType
;
184 } DXVA2_DecodeBufferDesc
;
186 typedef struct _DXVA2_DecodeExtensionData
189 PVOID pPrivateInputData
;
190 UINT PrivateInputDataSize
;
191 PVOID pPrivateOutputData
;
192 UINT PrivateOutputDataSize
;
193 } DXVA2_DecodeExtensionData
;
195 typedef struct _DXVA2_DecodeExecuteParams
198 DXVA2_DecodeBufferDesc
* pCompressedBuffers
;
199 DXVA2_DecodeExtensionData
* pExtensionData
;
200 } DXVA2_DecodeExecuteParams
;
202 typedef struct _DXVA2_VideoProcessorCaps
206 UINT NumForwardRefSamples
;
207 UINT NumBackwardRefSamples
;
209 UINT DeinterlaceTechnology
;
210 UINT ProcAmpControlCaps
;
211 UINT VideoProcessorOperations
;
212 UINT NoiseFilterTechnology
;
213 UINT DetailFilterTechnology
;
214 } DXVA2_VideoProcessorCaps
;
216 typedef struct _DXVA2_Fixed32
229 typedef struct _DXVA2_ValueRange
231 DXVA2_Fixed32 MinValue
;
232 DXVA2_Fixed32 MaxValue
;
233 DXVA2_Fixed32
DefaultValue;
234 DXVA2_Fixed32 StepSize
;
237 typedef struct _DXVA2_AYUVSample8
245 typedef struct _DXVA2_AYUVSample16
251 } DXVA2_AYUVSample16
;
253 typedef struct _DXVA2_ProcAmpValues
255 DXVA2_Fixed32 Brightness
;
256 DXVA2_Fixed32 Contrast
;
258 DXVA2_Fixed32 Saturation
;
259 } DXVA2_ProcAmpValues
;
261 typedef struct _DXVA2_FilterValues
264 DXVA2_Fixed32 Threshold
;
265 DXVA2_Fixed32 Radius
;
266 } DXVA2_FilterValues
;
268 typedef struct _DXVA2_VideoProcessBltParams
270 REFERENCE_TIME TargetFrame
;
272 SIZE ConstrictionSize
;
274 DXVA2_AYUVSample16 BackgroundColor
;
275 DXVA2_ExtendedFormat DestFormat
;
276 DXVA2_ProcAmpValues ProcAmpValues
;
278 DXVA2_FilterValues NoiseFilterLuma
;
279 DXVA2_FilterValues NoiseFilterChroma
;
280 DXVA2_FilterValues DetailFilterLuma
;
281 DXVA2_FilterValues DetailFilterChroma
;
283 } DXVA2_VideoProcessBltParams
;
285 typedef struct _DXVA2_VideoSample
287 REFERENCE_TIME Start
;
289 DXVA2_ExtendedFormat SampleFormat
;
290 IDirect3DSurface9
* SrcSurface
;
293 DXVA2_AYUVSample8 Pal
[16];
294 DXVA2_Fixed32 PlanarAlpha
;
300 DXVA2_SurfaceType_DecoderRenderTarget
,
301 DXVA2_SurfaceType_ProcessorRenderTarget
,
302 DXVA2_SurfaceType_D3DRenderTargetTexture
,
305 interface IDirectXVideoDecoder
;
306 interface IDirectXVideoProcessor
;
308 /*****************************************************************************
309 * IDirect3DDeviceManager9 interface
313 uuid(a0cade0f
-06d5
-4cf4
-a1c7
-f3cdd725aa75
),
316 interface IDirect3DDeviceManager9
: IUnknown
319 [in] IDirect3DDevice9
* pDevice
,
320 [in] UINT resetToken
);
322 HRESULT OpenDeviceHandle
(
323 [out] HANDLE* phDevice
);
325 HRESULT CloseDeviceHandle
(
326 [in] HANDLE hDevice
);
329 [in] HANDLE hDevice
);
333 [out] IDirect3DDevice9
** ppDevice
,
336 HRESULT UnlockDevice
(
338 [in] BOOL fSaveState
);
340 HRESULT GetVideoService
(
343 [out] void** ppService
);
346 /*****************************************************************************
347 * IDirectXVideoAccelerationService interface
351 uuid(fc51a550
-d5e7
-11d9
-af55
-00054e43ff02
),
354 interface IDirectXVideoAccelerationService
: IUnknown
356 HRESULT CreateSurface
(
359 [in] UINT backBuffers
,
360 [in] D3DFORMAT format
,
364 [out] IDirect3DSurface9
**ppSurface
,
365 [in, out] HANDLE *pSharedHandle
);
368 /*****************************************************************************
369 * IDirectXVideoDecoderService interface
373 uuid(fc51a551
-d5e7
-11d9
-af55
-00054e43ff02
),
376 interface IDirectXVideoDecoderService
: IDirectXVideoAccelerationService
378 HRESULT GetDecoderDeviceGuids
(
380 [out] GUID
**pGuids
);
382 HRESULT GetDecoderRenderTargets
(
385 [out] D3DFORMAT
**pFormats
);
387 HRESULT GetDecoderConfigurations
(
389 [in] const DXVA2_VideoDesc
*pVideoDesc
,
390 [in] IUnknown
*pReserved
,
392 [out] DXVA2_ConfigPictureDecode
**ppConfigs
);
394 HRESULT CreateVideoDecoder
(
396 [in] const DXVA2_VideoDesc
*pVideoDesc
,
397 [in] DXVA2_ConfigPictureDecode
*pConfig
,
398 [in] IDirect3DSurface9
**ppDecoderRenderTargets
,
399 [in] UINT NumSurfaces
,
400 [out] IDirectXVideoDecoder
**ppDecode
);
403 /*****************************************************************************
404 * IDirectXVideoDecoder interface
408 uuid(f2b0810a
-fd00
-43c9
-918c
-df94e2d8ef7d
),
411 interface IDirectXVideoDecoder
: IUnknown
413 HRESULT GetVideoDecoderService
(
414 [out] IDirectXVideoDecoderService
** ppService
);
416 HRESULT GetCreationParameters
(
417 [out] GUID
* pDeviceGuid
,
418 [out] DXVA2_VideoDesc
* pVideoDesc
,
419 [out] DXVA2_ConfigPictureDecode
* pConfig
,
420 [out] IDirect3DSurface9
*** pDecoderRenderTargets
,
421 [out] UINT
* pNumSurfaces
);
424 [in] UINT BufferType
,
425 [out] void** ppBuffer
,
426 [out] UINT
* pBufferSize
);
428 HRESULT ReleaseBuffer
(
429 [in] UINT BufferType
);
432 [in] IDirect3DSurface9
* pRenderTarget
,
433 [in] void* pvPVPData
);
436 [out] HANDLE* pHandleComplete
);
439 [in] const DXVA2_DecodeExecuteParams
* pExecuteParams
);
442 /*****************************************************************************
443 * IDirectXVideoProcessorService interface
447 uuid(fc51a552
-d5e7
-11d9
-af55
-00054e43ff02
),
450 interface IDirectXVideoProcessorService
: IDirectXVideoAccelerationService
452 HRESULT RegisterVideoProcessorSoftwareDevice
(
453 [in] void* pCallbacks
);
455 HRESULT GetVideoProcessorDeviceGuids
(
456 [in] const DXVA2_VideoDesc
* pVideoDesc
,
458 [out] GUID
** pGuids
);
460 HRESULT GetVideoProcessorRenderTargets
(
461 [in] REFGUID VideoProcDeviceGuid
,
462 [in] const DXVA2_VideoDesc
* pVideoDesc
,
464 [out] D3DFORMAT
** pFormats
);
466 HRESULT GetVideoProcessorSubStreamFormats
(
467 [in] REFGUID VideoProcDeviceGuid
,
468 [in] const DXVA2_VideoDesc
* pVideoDesc
,
469 [in] D3DFORMAT RenderTargetFormat
,
471 [out] D3DFORMAT
** pFormats
);
473 HRESULT GetVideoProcessorCaps
(
474 [in] REFGUID VideoProcDeviceGuid
,
475 [in] const DXVA2_VideoDesc
* pVideoDesc
,
476 [in] D3DFORMAT RenderTargetFormat
,
477 [out] DXVA2_VideoProcessorCaps
* pCaps
);
479 HRESULT GetProcAmpRange
(
480 [in] REFGUID VideoProcDeviceGuid
,
481 [in] const DXVA2_VideoDesc
* pVideoDesc
,
482 [in] D3DFORMAT RenderTargetFormat
,
483 [in] UINT ProcAmpCap
,
484 [out] DXVA2_ValueRange
* pRange
);
486 HRESULT GetFilterPropertyRange
(
487 [in] REFGUID VideoProcDeviceGuid
,
488 [in] const DXVA2_VideoDesc
* pVideoDesc
,
489 [in] D3DFORMAT renderTargetFormat
,
490 [in] UINT FilterSetting
,
491 [out] DXVA2_ValueRange
* pRange
);
493 HRESULT CreateVideoProcessor
(
494 [in] REFGUID VideoProcDeviceGuid
,
495 [in] const DXVA2_VideoDesc
* pVideoDesc
,
496 [in] D3DFORMAT RenderTargetFormat
,
497 [in] UINT MaxNumSubStreams
,
498 [out] IDirectXVideoProcessor
** ppVidProcess
);
501 /*****************************************************************************
502 * IDirectXVideoProcessor interface
506 uuid(8c3a39f0
-916e-4690-804f
-4c8001355d25
),
509 interface IDirectXVideoProcessor
: IUnknown
511 HRESULT GetVideoProcessorService
(
512 [out] IDirectXVideoProcessorService
** ppService
);
514 HRESULT GetCreationParameters
(
515 [out] GUID
* pDeviceGuid
,
516 [out] DXVA2_VideoDesc
* pVideoDesc
,
517 [out] D3DFORMAT
* pRenderTargetFormat
,
518 [out] UINT
* pMaxNumSubStreams
);
520 HRESULT GetVideoProcessorCaps
(
521 [out] DXVA2_VideoProcessorCaps
* pCaps
);
523 HRESULT GetProcAmpRange
(
524 [in] UINT ProcAmpCap
,
525 [out] DXVA2_ValueRange
* pRange
);
527 HRESULT GetFilterPropertyRange
(
528 [in] UINT FilterSetting
,
529 [out] DXVA2_ValueRange
* pRange
);
531 HRESULT VideoProcessBlt
(
532 [in] IDirect3DSurface9
* pRenderTarget
,
533 [in] const DXVA2_VideoProcessBltParams
* pBltParams
,
534 [in] const DXVA2_VideoSample
* pSamples
,
535 [in] UINT NumSamples
,
536 [out] HANDLE* pHandleCompleteIDirect3DDeviceManager9
);
539 /*****************************************************************************
540 * IDirectXVideoMemoryConfiguration interface
544 uuid(b7f916dd
-db3b
-49c1
-84d7
-e45ef99ec726
),
547 interface IDirectXVideoMemoryConfiguration
: IUnknown
549 HRESULT GetAvailableSurfaceTypeByIndex
(
550 [in] DWORD wTypeIndex
,
551 [out] DXVA2_SurfaceType
*pdwType
);
553 HRESULT SetSurfaceType
(
554 [in] DXVA2_SurfaceType dwType
);