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