contrib: d3d9: patch dxva2api.idl to get IDirectXVideoProcessor
[vlc.git] / contrib / src / d3d9 / dxva2api.patch
1 --- ../tarballs/dxva2api.idl    2017-04-11 14:13:48.105355400 +0200
2 +++ dxva2api/dxva2api.idl       2017-04-11 14:59:17.092294600 +0200
3 @@ -15,11 +15,12 @@
4  cpp_quote("#endif")
5  
6  interface IDirectXVideoDecoderService;
7 +interface IDirectXVideoProcessorService;
8  
9 -cpp_quote("#ifndef __REFERENCE_TIME_DEFINED")
10 -cpp_quote("#define __REFERENCE_TIME_DEFINED")
11 -cpp_quote("typedef LONGLONG REFERENCE_TIME;")
12 -cpp_quote("#endif /*__REFERENCE_TIME_DEFINED*/")
13 +#ifndef __REFERENCE_TIME_DEFINED
14 +#define __REFERENCE_TIME_DEFINED
15 +typedef LONGLONG REFERENCE_TIME;
16 +#endif /*__REFERENCE_TIME_DEFINED*/
17  
18  cpp_quote("#define DXVA2_ProcAmp_None 0x0000")
19  cpp_quote("#define DXVA2_ProcAmp_Brightness 0x0001")
20 @@ -142,19 +143,19 @@
21  cpp_quote("  DXVA2_VideoTransferMatrix_SMPTE240M   = 3 ")
22  cpp_quote("} DXVA2_VideoTransferMatrix;")
23  cpp_quote("")
24 -cpp_quote("typedef struct _DXVA2_AYUVSample16 {")
25 -cpp_quote("  USHORT Cr;")
26 -cpp_quote("  USHORT Cb;")
27 -cpp_quote("  USHORT Y;")
28 -cpp_quote("  USHORT Alpha;")
29 -cpp_quote("} DXVA2_AYUVSample16;")
30 -cpp_quote("")
31 -cpp_quote("typedef struct _DXVA2_AYUVSample8 {")
32 -cpp_quote("  UCHAR Cr;")
33 -cpp_quote("  UCHAR Cb;")
34 -cpp_quote("  UCHAR Y;")
35 -cpp_quote("  UCHAR Alpha;")
36 -cpp_quote("} DXVA2_AYUVSample8;")
37 +typedef struct _DXVA2_AYUVSample16 {
38 +  USHORT Cr;
39 +  USHORT Cb;
40 +  USHORT Y;
41 +  USHORT Alpha;
42 +} DXVA2_AYUVSample16;
43 +
44 +typedef struct _DXVA2_AYUVSample8 {
45 +  UCHAR Cr;
46 +  UCHAR Cb;
47 +  UCHAR Y;
48 +  UCHAR Alpha;
49 +} DXVA2_AYUVSample8;
50  
51  typedef struct _DXVA2_ConfigPictureDecode {
52    GUID   guidConfigBitstreamEncryption;
53 @@ -219,40 +220,40 @@
54    };
55  } DXVA2_ExtendedFormat;
56  
57 -cpp_quote("typedef struct _DXVA2_Fixed32 {")
58 -cpp_quote("  __C89_NAMELESS union {")
59 -cpp_quote("    __C89_NAMELESS struct {")
60 -cpp_quote("      USHORT Fraction;")
61 -cpp_quote("      SHORT  Value;")
62 -cpp_quote("    } DUMMYSTRUCTNAME;")
63 -cpp_quote("    LONG   ll;")
64 -cpp_quote("  } DUMMYUNIONNAME;")
65 -cpp_quote("} DXVA2_Fixed32;")
66 -cpp_quote("")
67 -cpp_quote("typedef struct _DXVA2_FilterValues {")
68 -cpp_quote("  DXVA2_Fixed32 Level;")
69 -cpp_quote("  DXVA2_Fixed32 Threshold;")
70 -cpp_quote("  DXVA2_Fixed32 Radius;")
71 -cpp_quote("} DXVA2_FilterValues;")
72 +typedef struct _DXVA2_Fixed32 {
73 +  __C89_NAMELESS union {
74 +    __C89_NAMELESS struct {
75 +      USHORT Fraction;
76 +      SHORT  Value;
77 +    } DUMMYSTRUCTNAME;
78 +    LONG   ll;
79 +  } DUMMYUNIONNAME;
80 +} DXVA2_Fixed32;
81 +
82 +typedef struct _DXVA2_FilterValues {
83 +  DXVA2_Fixed32 Level;
84 +  DXVA2_Fixed32 Threshold;
85 +  DXVA2_Fixed32 Radius;
86 +} DXVA2_FilterValues;
87  
88  typedef struct _DXVA2_Frequency {
89    UINT Numerator;
90    UINT Denominator;
91  } DXVA2_Frequency;
92  
93 -cpp_quote("typedef struct _DXVA2_ProcAmpValues {")
94 -cpp_quote("  DXVA2_Fixed32 Brightness;")
95 -cpp_quote("  DXVA2_Fixed32 Contrast;")
96 -cpp_quote("  DXVA2_Fixed32 Hue;")
97 -cpp_quote("  DXVA2_Fixed32 Saturation;")
98 -cpp_quote("} DXVA2_ProcAmpValues;")
99 -cpp_quote("")
100 -cpp_quote("typedef struct _DXVA2_ValueRange {")
101 -cpp_quote("  DXVA2_Fixed32 MinValue;")
102 -cpp_quote("  DXVA2_Fixed32 MaxValue;")
103 -cpp_quote("  DXVA2_Fixed32 DefaultValue;")
104 -cpp_quote("  DXVA2_Fixed32 StepSize;")
105 -cpp_quote("} DXVA2_ValueRange;")
106 +typedef struct _DXVA2_ProcAmpValues {
107 +  DXVA2_Fixed32 Brightness;
108 +  DXVA2_Fixed32 Contrast;
109 +  DXVA2_Fixed32 Hue;
110 +  DXVA2_Fixed32 Saturation;
111 +} DXVA2_ProcAmpValues;
112 +
113 +typedef struct _DXVA2_ValueRange {
114 +  DXVA2_Fixed32 MinValue;
115 +  DXVA2_Fixed32 MaxValue;
116 +  DXVA2_Fixed32 DefaultValue;
117 +  DXVA2_Fixed32 StepSize;
118 +} DXVA2_ValueRange;
119  
120  typedef struct _DXVA2_VideoDesc {
121    UINT                 SampleWidth;
122 @@ -317,57 +318,60 @@
123  cpp_quote("DXVA2_DetailFilterTech_Edge")
124  cpp_quote("DXVA2_DetailFilterTech_Sharpening")
125  cpp_quote("*/")
126 -cpp_quote("typedef struct _DXVA2_VideoProcessBltParams {")
127 -cpp_quote("  REFERENCE_TIME       TargetFrame;")
128 -cpp_quote("  RECT                 TargetRect;")
129 -cpp_quote("  SIZE                 ConstrictionSize;")
130 -cpp_quote("  UINT                 StreamingFlags;")
131 -cpp_quote("  DXVA2_AYUVSample16   BackgroundColor;")
132 -cpp_quote("  DXVA2_ExtendedFormat DestFormat;")
133 -cpp_quote("  DXVA2_ProcAmpValues  ProcAmpValues;")
134 -cpp_quote("  DXVA2_Fixed32        Alpha;")
135 -cpp_quote("  DXVA2_FilterValues   NoiseFilterLuma;")
136 -cpp_quote("  DXVA2_FilterValues   NoiseFilterChroma;")
137 -cpp_quote("  DXVA2_FilterValues   DetailFilterLuma;")
138 -cpp_quote("  DXVA2_FilterValues   DetailFilterChroma;")
139 -cpp_quote("  DWORD                DestData;")
140 -cpp_quote("} DXVA2_VideoProcessBltParams;")
141 -cpp_quote("")
142 -cpp_quote("#ifdef _D3D9_H_")
143 -cpp_quote("typedef struct _DXVA2_VideoProcessorCaps {")
144 -cpp_quote("  UINT    DeviceCaps;")
145 -cpp_quote("  D3DPOOL InputPool;")
146 -cpp_quote("  UINT    NumForwardRefSamples;")
147 -cpp_quote("  UINT    NumBackwardRefSamples;")
148 -cpp_quote("  UINT    Reserved;")
149 -cpp_quote("  UINT    DeinterlaceTechnology;")
150 -cpp_quote("  UINT    ProcAmpControlCaps;")
151 -cpp_quote("  UINT    VideoProcessorOperations;")
152 -cpp_quote("  UINT    NoiseFilterTechnology;")
153 -cpp_quote("  UINT    DetailFilterTechnology;")
154 -cpp_quote("} DXVA2_VideoProcessorCaps;")
155 -cpp_quote("#endif")
156 -cpp_quote("")
157 -cpp_quote("/* SampleData")
158 -cpp_quote("DXVA2_SampleData_RFF")
159 -cpp_quote("DXVA2_SampleData_TFF")
160 -cpp_quote("DXVA2_SampleData_RFF_TFF_Present")
161 -cpp_quote("*/")
162 -cpp_quote("")
163 -cpp_quote("#ifdef _D3D9_H_")
164 -cpp_quote("typedef struct _DXVA2_VideoSample {")
165 -cpp_quote("  REFERENCE_TIME       Start;")
166 -cpp_quote("  REFERENCE_TIME       End;")
167 -cpp_quote("  DXVA2_ExtendedFormat SampleFormat;")
168 -cpp_quote("  IDirect3DSurface9*   SrcSurface;")
169 -cpp_quote("  RECT                 SrcRect;")
170 -cpp_quote("  RECT                 DstRect;")
171 -cpp_quote("  DXVA2_AYUVSample8    Pal[16];")
172 -cpp_quote("  DXVA2_Fixed32        PlanarAlpha;")
173 -cpp_quote("  DWORD                SampleData;")
174 -cpp_quote("} DXVA2_VideoSample;")
175 -cpp_quote("#endif")
176 -cpp_quote("")
177 +typedef struct _DXVA2_VideoProcessBltParams {
178 +  REFERENCE_TIME       TargetFrame;
179 +  RECT                 TargetRect;
180 +  SIZE                 ConstrictionSize;
181 +  UINT                 StreamingFlags;
182 +  DXVA2_AYUVSample16   BackgroundColor;
183 +  DXVA2_ExtendedFormat DestFormat;
184 +  DXVA2_ProcAmpValues  ProcAmpValues;
185 +  DXVA2_Fixed32        Alpha;
186 +  DXVA2_FilterValues   NoiseFilterLuma;
187 +  DXVA2_FilterValues   NoiseFilterChroma;
188 +  DXVA2_FilterValues   DetailFilterLuma;
189 +  DXVA2_FilterValues   DetailFilterChroma;
190 +  DWORD                DestData;
191 +} DXVA2_VideoProcessBltParams;
192 +
193 +#ifdef _D3D9_H_
194 +typedef struct _DXVA2_VideoProcessorCaps {
195 +  UINT    DeviceCaps;
196 +  D3DPOOL InputPool;
197 +  UINT    NumForwardRefSamples;
198 +  UINT    NumBackwardRefSamples;
199 +  UINT    Reserved;
200 +  UINT    DeinterlaceTechnology;
201 +  UINT    ProcAmpControlCaps;
202 +  UINT    VideoProcessorOperations;
203 +  UINT    NoiseFilterTechnology;
204 +  UINT    DetailFilterTechnology;
205 +} DXVA2_VideoProcessorCaps;
206 +#endif
207 +
208 +cpp_quote("/* SampleData */")
209 +enum
210 +{
211 +  DXVA2_SampleData_RFF             = 1,
212 +  DXVA2_SampleData_TFF             = 2,
213 +  DXVA2_SampleData_RFF_TFF_Present = 4,
214 +  DXVA2_SampleData_Mask            = 0xFFFF
215 +};
216 +
217 +#ifdef _D3D9_H_
218 +typedef struct _DXVA2_VideoSample {
219 +  REFERENCE_TIME       Start;
220 +  REFERENCE_TIME       End;
221 +  DXVA2_ExtendedFormat SampleFormat;
222 +  IDirect3DSurface9*   SrcSurface;
223 +  RECT                 SrcRect;
224 +  RECT                 DstRect;
225 +  DXVA2_AYUVSample8    Pal[16];
226 +  DXVA2_Fixed32        PlanarAlpha;
227 +  DWORD                SampleData;
228 +} DXVA2_VideoSample;
229 +#endif
230 +
231  cpp_quote("/* Constants */")
232  cpp_quote("")
233  cpp_quote("#define DXVA2_VideoDecoderRenderTarget 0")
234 @@ -481,4 +485,82 @@
235              [in] UINT NumRenderTargets, [out] IDirectXVideoDecoder **ppDecode);
236  }
237  
238 +[
239 +    object,
240 +    uuid(8c3a39f0-916e-4690-804f-4c8001355d25),
241 +    local
242 +]
243 +interface IDirectXVideoProcessor : IUnknown
244 +{
245 +    HRESULT GetVideoProcessorService([out] IDirectXVideoProcessorService** ppService);
246 +
247 +    HRESULT GetCreationParameters(
248 +        [out] GUID* pDeviceGuid,
249 +        [out] DXVA2_VideoDesc* pVideoDesc,
250 +        [out] D3DFORMAT* pRenderTargetFormat,
251 +        [out] UINT* pMaxNumSubStreams);
252 +    HRESULT GetVideoProcessorCaps([out] DXVA2_VideoProcessorCaps* pCaps);
253 +    HRESULT GetProcAmpRange(
254 +        [in] UINT ProcAmpCap,
255 +        [out] DXVA2_ValueRange* pRange);
256 +    HRESULT GetFilterPropertyRange(
257 +        [in] UINT FilterSetting,
258 +        [out] DXVA2_ValueRange* pRange);
259 +    HRESULT VideoProcessBlt(
260 +        [in] IDirect3DSurface9* pRenderTarget,
261 +        [in] const DXVA2_VideoProcessBltParams* pBltParams,
262 +        [in] const DXVA2_VideoSample* pSamples,
263 +        [in] UINT NumSamples,
264 +        [out] HANDLE* pHandleComplete);
265 +};
266 +
267 +[
268 +    object,
269 +    uuid(fc51a552-d5e7-11d9-af55-00054e43ff02),
270 +    local
271 +]
272 +interface IDirectXVideoProcessorService : IDirectXVideoAccelerationService
273 +{
274 +    HRESULT RegisterVideoProcessorSoftwareDevice([in] void* pCallbacks);
275 +
276 +    HRESULT GetVideoProcessorDeviceGuids(
277 +        [in] const DXVA2_VideoDesc* pVideoDesc,
278 +        [out] UINT* pCount,
279 +        [out] GUID** pGuids);
280 +    HRESULT GetVideoProcessorRenderTargets(
281 +        [in] REFGUID VideoProcDeviceGuid,
282 +        [in] const DXVA2_VideoDesc* pVideoDesc,
283 +        [out] UINT* pCount,
284 +        [out] D3DFORMAT** pFormats);
285 +    HRESULT GetVideoProcessorSubStreamFormats(
286 +        [in] REFGUID VideoProcDeviceGuid,
287 +        [in] const DXVA2_VideoDesc* pVideoDesc,
288 +        [in] D3DFORMAT RenderTargetFormat,
289 +        [out] UINT* pCount,
290 +        [out] D3DFORMAT** pFormats);
291 +    HRESULT GetVideoProcessorCaps(
292 +        [in] REFGUID VideoProcDeviceGuid,
293 +        [in] const DXVA2_VideoDesc* pVideoDesc,
294 +        [in] D3DFORMAT RenderTargetFormat,
295 +        [out] DXVA2_VideoProcessorCaps* pCaps);
296 +    HRESULT GetProcAmpRange(
297 +        [in] REFGUID VideoProcDeviceGuid,
298 +        [in] const DXVA2_VideoDesc* pVideoDesc,
299 +        [in] D3DFORMAT RenderTargetFormat,
300 +        [in] UINT ProcAmpCap,
301 +        [out] DXVA2_ValueRange* pRange);
302 +    HRESULT GetFilterPropertyRange(
303 +        [in] REFGUID VideoProcDeviceGuid,
304 +        [in] const DXVA2_VideoDesc* pVideoDesc,
305 +        [in] D3DFORMAT RenderTargetFormat,
306 +        [in] UINT FilterSetting,
307 +        [out] DXVA2_ValueRange* pRange);
308 +    HRESULT CreateVideoProcessor(
309 +        [in] REFGUID VideoProcDeviceGuid,
310 +        [in] const DXVA2_VideoDesc* pVideoDesc,
311 +        [in] D3DFORMAT RenderTargetFormat,
312 +        [in] UINT MaxNumSubStreams,
313 +        [out] IDirectXVideoProcessor** ppVidProcess);
314 +}
315 +
316  cpp_quote("#endif /* _D3D9_H_ */")