1 ##########################################################################
3 # Copyright 2012 VMware, Inc.
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 ##########################################################################/
29 REFERENCE_TIME = Alias("REFERENCE_TIME", LONGLONG)
31 DXVA2_ProcAmp = Flags(UINT, [
33 "DXVA2_ProcAmp_Brightness",
34 "DXVA2_ProcAmp_Contrast",
36 "DXVA2_ProcAmp_Saturation",
39 HRESULT = FakeEnum(HRESULT, [
40 "DXVA2_E_NOT_INITIALIZED",
41 "DXVA2_E_NEW_VIDEO_DEVICE",
42 "DXVA2_E_VIDEO_DEVICE_LOCKED",
43 "DXVA2_E_NOT_AVAILABLE",
46 DXVA2_SampleFormat = Enum("DXVA2_SampleFormat", [
47 "DXVA2_SampleFormatMask",
48 "DXVA2_SampleUnknown",
49 "DXVA2_SampleProgressiveFrame",
50 "DXVA2_SampleFieldInterleavedEvenFirst",
51 "DXVA2_SampleFieldInterleavedOddFirst",
52 "DXVA2_SampleFieldSingleEven",
53 "DXVA2_SampleFieldSingleOdd",
54 "DXVA2_SampleSubStream",
57 DXVA2_VideoChromaSubSampling = Enum("DXVA2_VideoChromaSubSampling", [
58 "DXVA2_VideoChromaSubsamplingMask",
59 "DXVA2_VideoChromaSubsampling_Unknown",
60 "DXVA2_VideoChromaSubsampling_ProgressiveChroma",
61 "DXVA2_VideoChromaSubsampling_Horizontally_Cosited",
62 "DXVA2_VideoChromaSubsampling_Vertically_Cosited",
63 "DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes",
64 "DXVA2_VideoChromaSubsampling_MPEG2",
65 "DXVA2_VideoChromaSubsampling_MPEG1",
66 "DXVA2_VideoChromaSubsampling_DV_PAL",
67 "DXVA2_VideoChromaSubsampling_Cosited",
70 DXVA2_NominalRange = Enum("DXVA2_NominalRange", [
71 "DXVA2_NominalRangeMask",
72 "DXVA2_NominalRange_Unknown",
73 "DXVA2_NominalRange_Normal",
74 "DXVA2_NominalRange_Wide",
75 "DXVA2_NominalRange_0_255",
76 "DXVA2_NominalRange_16_235",
77 "DXVA2_NominalRange_48_208",
80 DXVA2_VideoLighting = Enum("DXVA2_VideoLighting", [
81 "DXVA2_VideoLightingMask",
82 "DXVA2_VideoLighting_Unknown",
83 "DXVA2_VideoLighting_bright",
84 "DXVA2_VideoLighting_office",
85 "DXVA2_VideoLighting_dim",
86 "DXVA2_VideoLighting_dark",
89 DXVA2_VideoPrimaries = Enum("DXVA2_VideoPrimaries", [
90 "DXVA2_VideoPrimariesMask",
91 "DXVA2_VideoPrimaries_Unknown",
92 "DXVA2_VideoPrimaries_reserved",
93 "DXVA2_VideoPrimaries_BT709",
94 "DXVA2_VideoPrimaries_BT470_2_SysM",
95 "DXVA2_VideoPrimaries_BT470_2_SysBG",
96 "DXVA2_VideoPrimaries_SMPTE170M",
97 "DXVA2_VideoPrimaries_SMPTE240M",
98 "DXVA2_VideoPrimaries_EBU3213",
99 "DXVA2_VideoPrimaries_SMPTE_C",
102 DXVA2_VideoTransferFunction = Enum("DXVA2_VideoTransferFunction", [
103 "DXVA2_VideoTransFuncMask",
104 "DXVA2_VideoTransFunc_Unknown",
105 "DXVA2_VideoTransFunc_10",
106 "DXVA2_VideoTransFunc_18",
107 "DXVA2_VideoTransFunc_20",
108 "DXVA2_VideoTransFunc_22",
109 "DXVA2_VideoTransFunc_709",
110 "DXVA2_VideoTransFunc_240M",
111 "DXVA2_VideoTransFunc_sRGB",
112 "DXVA2_VideoTransFunc_28",
115 DXVA2_SurfaceType = FakeEnum(DWORD, [
116 "DXVA2_SurfaceType_DecoderRenderTarget",
117 "DXVA2_SurfaceType_ProcessorRenderTarget",
118 "DXVA2_SurfaceType_D3DRenderTargetTexture",
121 DXVA2_VideoTransferMatrix = Enum("DXVA2_VideoTransferMatrix", [
122 "DXVA2_VideoTransferMatrixMask",
123 "DXVA2_VideoTransferMatrix_Unknown",
124 "DXVA2_VideoTransferMatrix_BT709",
125 "DXVA2_VideoTransferMatrix_BT601",
126 "DXVA2_VideoTransferMatrix_SMPTE240M",
129 DXVA2_AYUVSample16 = Struct("DXVA2_AYUVSample16", [
136 DXVA2_AYUVSample8 = Struct("DXVA2_AYUVSample8", [
143 DXVA2_ConfigPictureDecode = Struct("DXVA2_ConfigPictureDecode", [
144 (GUID, "guidConfigBitstreamEncryption"),
145 (GUID, "guidConfigMBcontrolEncryption"),
146 (GUID, "guidConfigResidDiffEncryption"),
147 (UINT, "ConfigBitstreamRaw"),
148 (UINT, "ConfigMBcontrolRasterOrder"),
149 (UINT, "ConfigResidDiffHost"),
150 (UINT, "ConfigSpatialResid8"),
151 (UINT, "ConfigResid8Subtraction"),
152 (UINT, "ConfigSpatialHost8or9Clipping"),
153 (UINT, "ConfigSpatialResidInterleaved"),
154 (UINT, "ConfigIntraResidUnsigned"),
155 (UINT, "ConfigResidDiffAccelerator"),
156 (UINT, "ConfigHostInverseScan"),
157 (UINT, "ConfigSpecificIDCT"),
158 (UINT, "Config4GroupedCoefs"),
159 (USHORT, "ConfigMinRenderTargetBuffCount"),
160 (USHORT, "ConfigDecoderSpecific"),
163 DXVA2_DecodeBufferDesc = Struct("DXVA2_DecodeBufferDesc", [
164 (DWORD, "CompressedBufferType"),
165 (UINT, "BufferIndex"),
166 (UINT, "DataOffset"),
168 (UINT, "FirstMBaddress"),
169 (UINT, "NumMBsInBuffer"),
173 (UINT, "ReservedBits"),
174 (PVOID, "pvPVPState"),
177 DXVA2_DecodeExtensionData = Struct("DXVA2_DecodeExtensionData", [
179 (PVOID, "pPrivateInputData"),
180 (UINT, "PrivateInputDataSize"),
181 (PVOID, "pPrivateOutputData"),
182 (UINT, "PrivateOutputDataSize"),
185 DXVA2_DecodeExecuteParams = Struct("DXVA2_DecodeExecuteParams", [
186 (UINT, "NumCompBuffers"),
187 (Array(DXVA2_DecodeBufferDesc, "{self}.NumCompBuffers"), "pCompressedBuffers"),
188 (Pointer(DXVA2_DecodeExtensionData), "pExtensionData"),
191 DXVA2_ExtendedFormat = Struct("DXVA2_ExtendedFormat", [
195 DXVA2_Fixed32 = Struct("DXVA2_Fixed32", [
196 (USHORT, "Fraction"),
200 DXVA2_FilterValues = Struct("DXVA2_FilterValues", [
201 (DXVA2_Fixed32, "Level"),
202 (DXVA2_Fixed32, "Threshold"),
203 (DXVA2_Fixed32, "Radius"),
206 DXVA2_Frequency = Struct("DXVA2_Frequency", [
208 (UINT, "Denominator"),
211 DXVA2_ProcAmpValues = Struct("DXVA2_ProcAmpValues", [
212 (DXVA2_Fixed32, "Brightness"),
213 (DXVA2_Fixed32, "Contrast"),
214 (DXVA2_Fixed32, "Hue"),
215 (DXVA2_Fixed32, "Saturation"),
218 DXVA2_ValueRange = Struct("DXVA2_ValueRange", [
219 (DXVA2_Fixed32, "MinValue"),
220 (DXVA2_Fixed32, "MaxValue"),
221 (DXVA2_Fixed32, "DefaultValue"),
222 (DXVA2_Fixed32, "StepSize"),
225 DXVA2_VideoDesc = Struct("DXVA2_VideoDesc", [
226 (UINT, "SampleWidth"),
227 (UINT, "SampleHeight"),
228 (DXVA2_ExtendedFormat, "SampleFormat"),
229 (D3DFORMAT, "Format"),
230 (DXVA2_Frequency, "InputSampleFreq"),
231 (DXVA2_Frequency, "OutputFrameFreq"),
232 (UINT, "UABProtectionLevel"),
236 DXVA2_VideoProcessBltParams = Struct("DXVA2_VideoProcessBltParams", [
237 (REFERENCE_TIME, "TargetFrame"),
238 (RECT, "TargetRect"),
239 (SIZE, "ConstrictionSize"),
240 (UINT, "StreamingFlags"),
241 (DXVA2_AYUVSample16, "BackgroundColor"),
242 (DXVA2_ExtendedFormat, "DestFormat"),
243 (DXVA2_ProcAmpValues, "ProcAmpValues"),
244 (DXVA2_Fixed32, "Alpha"),
245 (DXVA2_FilterValues, "NoiseFilterLuma"),
246 (DXVA2_FilterValues, "NoiseFilterChroma"),
247 (DXVA2_FilterValues, "DetailFilterLuma"),
248 (DXVA2_FilterValues, "DetailFilterChroma"),
252 DXVA2_VideoProcessorCaps = Struct("DXVA2_VideoProcessorCaps", [
253 (UINT, "DeviceCaps"),
254 (D3DPOOL, "InputPool"),
255 (UINT, "NumForwardRefSamples"),
256 (UINT, "NumBackwardRefSamples"),
258 (UINT, "DeinterlaceTechnology"),
259 (UINT, "ProcAmpControlCaps"),
260 (UINT, "VideoProcessorOperations"),
261 (UINT, "NoiseFilterTechnology"),
262 (UINT, "DetailFilterTechnology"),
266 # See also DXVADDI_PVP_KEY128
267 DXVA2_PVP_KEY128 = Struct('DXVA2_PVP_KEY128', [
268 (Array(BYTE, 16), 'Data'),
271 # See also DXVADDI_PVP_SETKEY
272 DXVA2_PVP_SETKEY = Struct('DXVA2_PVP_SETKEY', [
273 (DXVA2_PVP_KEY128, 'ContentKey'),
276 DXVA2_DECODEBUFFERDESC = Struct("DXVA2_DECODEBUFFERDESC", [
277 (ObjPointer(IDirect3DSurface9), "pRenderTarget"),
278 (DWORD, "CompressedBufferType"),
279 (DWORD, "BufferIndex"),
280 (DWORD, "DataOffset"),
282 (DWORD, "FirstMBaddress"),
283 (DWORD, "NumMBsInBuffer"),
287 (DWORD, "ReservedBits"),
288 (PVOID, "pCipherCounter"),
291 DXVA2_DECODEEXECUTE = Struct("DXVA2_DECODEEXECUTE", [
292 (UINT, "NumCompBuffers"),
293 (Array(DXVA2_DECODEBUFFERDESC, "{self}.NumCompBuffers"), "pCompressedBuffers"),
296 DXVA2_VIDEOSAMPLE = Struct("DXVA2_VIDEOSAMPLE", [
297 (REFERENCE_TIME, "Start"),
298 (REFERENCE_TIME, "End"),
299 (DXVA2_ExtendedFormat, "SampleFormat"),
300 (DWORD, "SampleFlags"),
301 (ObjPointer(IDirect3DSurface9), "SrcSurface"),
304 #(Array(DXVA2_AYUVSample8, 16), "Pal"),
305 (DXVA2_Fixed32, "PlanarAlpha"),
308 DXVA2_VIDEOPROCESSBLT = Struct("DXVA2_VIDEOPROCESSBLT", [
309 (REFERENCE_TIME, "TargetFrame"),
310 (RECT, "TargetRect"),
311 (SIZE, "ConstrictionSize"),
312 (DWORD, "StreamingFlags"),
313 (DXVA2_AYUVSample16, "BackgroundColor"),
314 (DXVA2_ExtendedFormat, "DestFormat"),
315 (DWORD, "DestFlags"),
316 (DXVA2_ProcAmpValues, "ProcAmpValues"),
317 (DXVA2_Fixed32, "Alpha"),
318 (DXVA2_FilterValues, "NoiseFilterLuma"),
319 (DXVA2_FilterValues, "NoiseFilterChroma"),
320 (DXVA2_FilterValues, "DetailFilterLuma"),
321 (DXVA2_FilterValues, "DetailFilterChroma"),
322 (Array(DXVA2_VIDEOSAMPLE, "{self}.NumSrcSurfaces"), "pSrcSurfaces"),
323 (UINT, "NumSrcSurfaces"),
326 DXVA2_EXTENSIONEXECUTE = Opaque('DXVA2_EXTENSIONEXECUTE')
327 DXVA2_DECODEBUFFERINFO = Opaque('DXVA2_DECODEBUFFERINFO')
330 IDirect3DDecodeDevice9 = Interface("IDirect3DDecodeDevice9", IUnknown)
331 IDirect3DDecodeDevice9.methods += [
332 StdMethod(HRESULT, "DecodeBeginFrame", [(Pointer(DXVA2_PVP_SETKEY), "pPVPSetKey")]),
333 StdMethod(HRESULT, "DecodeEndFrame", [(Pointer(HANDLE), "pHandleComplete")]),
334 StdMethod(HRESULT, "DecodeSetRenderTarget", [(ObjPointer(IDirect3DSurface9), "pRenderTarget")]),
335 StdMethod(HRESULT, "DecodeExecute", [(Pointer(DXVA2_DECODEEXECUTE), "pExecuteParams")]),
338 IDirect3DVideoProcessDevice9 = Interface("IDirect3DVideoProcessDevice9", IUnknown)
339 IDirect3DVideoProcessDevice9.methods += [
340 StdMethod(HRESULT, "VideoProcessBeginFrame", []),
341 StdMethod(HRESULT, "VideoProcessEndFrame", [(Pointer(HANDLE), "pHandleComplete")]),
342 StdMethod(HRESULT, "VideoProcessSetRenderTarget", [(ObjPointer(IDirect3DSurface9), "pRenderTarget")]),
343 StdMethod(HRESULT, "VideoProcessBlt", [(Pointer(DXVA2_VIDEOPROCESSBLT), "pData")]),
346 IDirect3DDXVAExtensionDevice9 = Interface("IDirect3DDXVAExtensionDevice9", IUnknown)
347 IDirect3DDXVAExtensionDevice9.methods += [
348 StdMethod(HRESULT, "ExtensionExecute", [(OpaquePointer(DXVA2_EXTENSIONEXECUTE), "pData")]),
351 IDirect3DDxva2Container9 = Interface("IDirect3DDxva2Container9", IUnknown)
352 IDirect3DDxva2Container9.methods += [
353 StdMethod(HRESULT, "CreateSurface", [(UINT, "Width"), (UINT, "Height"), (UINT, "BackBuffers"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (DWORD, "Usage"), (DXVA2_SurfaceType, "DxvaType"), Out(Array(ObjPointer(IDirect3DSurface9), "1 + BackBuffers"), "ppSurface"), (Pointer(HANDLE), "pSharedHandle")]),
354 StdMethod(HRESULT, "VidToSysBlt", [(ObjPointer(IDirect3DSurface9), "pSourceSurface"), (Pointer(RECT), "pSourceRect"), (ObjPointer(IDirect3DSurface9), "pDestSurface"), (Pointer(RECT), "pDestRect")]),
355 StdMethod(HRESULT, "GetDecodeGuidCount", [Out(Pointer(UINT), "pCount")], sideeffects=False),
356 StdMethod(HRESULT, "GetDecodeGuids", [(UINT, "Count"), Out(Array(GUID, "Count"), "pGuids")], sideeffects=False),
357 StdMethod(HRESULT, "GetDecodeRenderTargetFormatCount", [(REFGUID, "Guid"), Out(Pointer(UINT), "pCount")], sideeffects=False),
358 StdMethod(HRESULT, "GetDecodeRenderTargets", [(REFGUID, "Guid"), (UINT, "Count"), Out(Array(D3DFORMAT, "Count"), "pFormats")], sideeffects=False),
359 StdMethod(HRESULT, "GetDecodeCompressedBufferCount", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), Out(Pointer(UINT), "pCount")], sideeffects=False),
360 StdMethod(HRESULT, "GetDecodeCompressedBuffers", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (UINT, "Count"), Out(OpaquePointer(DXVA2_DECODEBUFFERINFO), "pBufferInfo")], sideeffects=False),
361 StdMethod(HRESULT, "GetDecodeConfigurationCount", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), Out(Pointer(UINT), "pCount")], sideeffects=False),
362 StdMethod(HRESULT, "GetDecodeConfigurations", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (UINT, "Count"), Out(Array(DXVA2_ConfigPictureDecode, "Count"), "pConfigs")], sideeffects=False),
363 StdMethod(HRESULT, "CreateDecodeDevice", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (Pointer(Const(DXVA2_ConfigPictureDecode)), "pConfig"), (Array(ObjPointer(IDirect3DSurface9), "NumSurfaces"), "ppDecoderRenderTargets"), (UINT, "NumSurfaces"), Out(Pointer(ObjPointer(IDirect3DDecodeDevice9)), "ppDecode")]),
364 StdMethod(HRESULT, "GetVideoProcessorDeviceGuidCount", [(Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), Out(Pointer(UINT), "pCount")], sideeffects=False),
365 StdMethod(HRESULT, "GetVideoProcessorDeviceGuids", [(Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (UINT, "Count"), Out(Pointer(GUID), "pGuids")], sideeffects=False),
366 StdMethod(HRESULT, "GetVideoProcessorCaps", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (D3DFORMAT, "Format"), Out(Pointer(DXVA2_VideoProcessorCaps), "pCaps")], sideeffects=False),
367 StdMethod(HRESULT, "GetProcAmpRange", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (D3DFORMAT, "Format"), (UINT, "ProcAmpCap"), Out(Pointer(DXVA2_ValueRange), "pRange")]),
368 StdMethod(HRESULT, "GetFilterPropertyRange", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (D3DFORMAT, "Format"), (UINT, "FilterSetting"), Out(Pointer(DXVA2_ValueRange), "pRange")], sideeffects=False),
369 StdMethod(HRESULT, "GetVideoProcessorRenderTargetCount", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), Out(Pointer(UINT), "pCount")], sideeffects=False),
370 StdMethod(HRESULT, "GetVideoProcessorRenderTargets", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (UINT, "Count"), Out(Array(D3DFORMAT, "Count"), "pFormats")], sideeffects=False),
371 StdMethod(HRESULT, "GetVideoProcessorSubStreamFormatCount", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (D3DFORMAT, "Format"), Out(Pointer(UINT), "pCount")], sideeffects=False),
372 StdMethod(HRESULT, "GetVideoProcessorSubStreamFormats", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (D3DFORMAT, "Format"), (UINT, "Count"), Out(Array(D3DFORMAT, "Count"), "pFormats")], sideeffects=False),
373 StdMethod(HRESULT, "CreateVideoProcessDevice", [(REFGUID, "Guid"), (Pointer(Const(DXVA2_VideoDesc)), "pVideoDesc"), (D3DFORMAT, "Format"), (UINT, "MaxSubStreams"), Out(Pointer(ObjPointer(IDirect3DVideoProcessDevice9)), "ppVideoProcessDevice")]),
374 StdMethod(HRESULT, "GetExtensionGuidCount", [(DWORD, "Extension"), Out(Pointer(UINT), "pCount")], sideeffects=False),
375 StdMethod(HRESULT, "GetExtensionGuids", [(DWORD, "Extension"), (UINT, "Count"), Out(Array(GUID, "Count"), "pGuids")], sideeffects=False),
376 StdMethod(HRESULT, "GetExtensionCaps", [(REFGUID, "Guid"), (UINT, "arg2"), (OpaquePointer(Void), "arg3"), (UINT, "arg4"), (OpaquePointer(Void), "arg5"), (UINT, "arg6")], sideeffects=False),
377 StdMethod(HRESULT, "CreateExtensionDevice", [(REFGUID, "Guid"), (OpaquePointer(Void), "arg2"), (UINT, "arg3"), Out(Pointer(ObjPointer(IDirect3DDXVAExtensionDevice9)), "ppExtension")]),
381 IDirect3DDxva2Container9,