--- a/dxva2api/dxva2api.idl	2017-06-13 14:45:14.598269100 +0200
+++ b/dxva2api/dxva2api.idl	2017-06-26 10:08:58.732675300 +0200
@@ -6,6 +6,8 @@
 
 import "unknwn.idl";
 
+cpp_quote("#include <winapifamily.h>")
+
 /* Fake widl types */
 cpp_quote("#if 0")
 typedef DWORD IDirect3DDevice9;
@@ -14,12 +16,15 @@ typedef DWORD D3DFORMAT;
 typedef DWORD D3DPOOL;
 cpp_quote("#endif")
 
+cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")
+
 interface IDirectXVideoDecoderService;
+interface IDirectXVideoProcessorService;
 
-cpp_quote("#ifndef __REFERENCE_TIME_DEFINED")
-cpp_quote("#define __REFERENCE_TIME_DEFINED")
-cpp_quote("typedef LONGLONG REFERENCE_TIME;")
-cpp_quote("#endif /*__REFERENCE_TIME_DEFINED*/")
+#ifndef __REFERENCE_TIME_DEFINED
+#define __REFERENCE_TIME_DEFINED
+typedef LONGLONG REFERENCE_TIME;
+#endif /*__REFERENCE_TIME_DEFINED*/
 
 cpp_quote("#define DXVA2_ProcAmp_None 0x0000")
 cpp_quote("#define DXVA2_ProcAmp_Brightness 0x0001")
@@ -142,19 +147,19 @@ cpp_quote("  DXVA2_VideoTransferMatrix_B
 cpp_quote("  DXVA2_VideoTransferMatrix_SMPTE240M   = 3 ")
 cpp_quote("} DXVA2_VideoTransferMatrix;")
 cpp_quote("")
-cpp_quote("typedef struct _DXVA2_AYUVSample16 {")
-cpp_quote("  USHORT Cr;")
-cpp_quote("  USHORT Cb;")
-cpp_quote("  USHORT Y;")
-cpp_quote("  USHORT Alpha;")
-cpp_quote("} DXVA2_AYUVSample16;")
-cpp_quote("")
-cpp_quote("typedef struct _DXVA2_AYUVSample8 {")
-cpp_quote("  UCHAR Cr;")
-cpp_quote("  UCHAR Cb;")
-cpp_quote("  UCHAR Y;")
-cpp_quote("  UCHAR Alpha;")
-cpp_quote("} DXVA2_AYUVSample8;")
+typedef struct _DXVA2_AYUVSample16 {
+  USHORT Cr;
+  USHORT Cb;
+  USHORT Y;
+  USHORT Alpha;
+} DXVA2_AYUVSample16;
+
+typedef struct _DXVA2_AYUVSample8 {
+  UCHAR Cr;
+  UCHAR Cb;
+  UCHAR Y;
+  UCHAR Alpha;
+} DXVA2_AYUVSample8;
 
 typedef struct _DXVA2_ConfigPictureDecode {
   GUID   guidConfigBitstreamEncryption;
@@ -219,40 +224,40 @@ typedef struct _DXVA2_ExtendedFormat {
   };
 } DXVA2_ExtendedFormat;
 
-cpp_quote("typedef struct _DXVA2_Fixed32 {")
-cpp_quote("  __C89_NAMELESS union {")
-cpp_quote("    __C89_NAMELESS struct {")
-cpp_quote("      USHORT Fraction;")
-cpp_quote("      SHORT  Value;")
-cpp_quote("    } DUMMYSTRUCTNAME;")
-cpp_quote("    LONG   ll;")
-cpp_quote("  } DUMMYUNIONNAME;")
-cpp_quote("} DXVA2_Fixed32;")
-cpp_quote("")
-cpp_quote("typedef struct _DXVA2_FilterValues {")
-cpp_quote("  DXVA2_Fixed32 Level;")
-cpp_quote("  DXVA2_Fixed32 Threshold;")
-cpp_quote("  DXVA2_Fixed32 Radius;")
-cpp_quote("} DXVA2_FilterValues;")
+typedef struct _DXVA2_Fixed32 {
+  __C89_NAMELESS union {
+    __C89_NAMELESS struct {
+      USHORT Fraction;
+      SHORT  Value;
+    } DUMMYSTRUCTNAME;
+    LONG   ll;
+  } DUMMYUNIONNAME;
+} DXVA2_Fixed32;
+
+typedef struct _DXVA2_FilterValues {
+  DXVA2_Fixed32 Level;
+  DXVA2_Fixed32 Threshold;
+  DXVA2_Fixed32 Radius;
+} DXVA2_FilterValues;
 
 typedef struct _DXVA2_Frequency {
   UINT Numerator;
   UINT Denominator;
 } DXVA2_Frequency;
 
-cpp_quote("typedef struct _DXVA2_ProcAmpValues {")
-cpp_quote("  DXVA2_Fixed32 Brightness;")
-cpp_quote("  DXVA2_Fixed32 Contrast;")
-cpp_quote("  DXVA2_Fixed32 Hue;")
-cpp_quote("  DXVA2_Fixed32 Saturation;")
-cpp_quote("} DXVA2_ProcAmpValues;")
-cpp_quote("")
-cpp_quote("typedef struct _DXVA2_ValueRange {")
-cpp_quote("  DXVA2_Fixed32 MinValue;")
-cpp_quote("  DXVA2_Fixed32 MaxValue;")
-cpp_quote("  DXVA2_Fixed32 DefaultValue;")
-cpp_quote("  DXVA2_Fixed32 StepSize;")
-cpp_quote("} DXVA2_ValueRange;")
+typedef struct _DXVA2_ProcAmpValues {
+  DXVA2_Fixed32 Brightness;
+  DXVA2_Fixed32 Contrast;
+  DXVA2_Fixed32 Hue;
+  DXVA2_Fixed32 Saturation;
+} DXVA2_ProcAmpValues;
+
+typedef struct _DXVA2_ValueRange {
+  DXVA2_Fixed32 MinValue;
+  DXVA2_Fixed32 MaxValue;
+  DXVA2_Fixed32 DefaultValue;
+  DXVA2_Fixed32 StepSize;
+} DXVA2_ValueRange;
 
 typedef struct _DXVA2_VideoDesc {
   UINT                 SampleWidth;
@@ -317,57 +322,93 @@ cpp_quote("DXVA2_DetailFilterTech_Unknow
 cpp_quote("DXVA2_DetailFilterTech_Edge")
 cpp_quote("DXVA2_DetailFilterTech_Sharpening")
 cpp_quote("*/")
-cpp_quote("typedef struct _DXVA2_VideoProcessBltParams {")
-cpp_quote("  REFERENCE_TIME       TargetFrame;")
-cpp_quote("  RECT                 TargetRect;")
-cpp_quote("  SIZE                 ConstrictionSize;")
-cpp_quote("  UINT                 StreamingFlags;")
-cpp_quote("  DXVA2_AYUVSample16   BackgroundColor;")
-cpp_quote("  DXVA2_ExtendedFormat DestFormat;")
-cpp_quote("  DXVA2_ProcAmpValues  ProcAmpValues;")
-cpp_quote("  DXVA2_Fixed32        Alpha;")
-cpp_quote("  DXVA2_FilterValues   NoiseFilterLuma;")
-cpp_quote("  DXVA2_FilterValues   NoiseFilterChroma;")
-cpp_quote("  DXVA2_FilterValues   DetailFilterLuma;")
-cpp_quote("  DXVA2_FilterValues   DetailFilterChroma;")
-cpp_quote("  DWORD                DestData;")
-cpp_quote("} DXVA2_VideoProcessBltParams;")
-cpp_quote("")
-cpp_quote("#ifdef _D3D9_H_")
-cpp_quote("typedef struct _DXVA2_VideoProcessorCaps {")
-cpp_quote("  UINT    DeviceCaps;")
-cpp_quote("  D3DPOOL InputPool;")
-cpp_quote("  UINT    NumForwardRefSamples;")
-cpp_quote("  UINT    NumBackwardRefSamples;")
-cpp_quote("  UINT    Reserved;")
-cpp_quote("  UINT    DeinterlaceTechnology;")
-cpp_quote("  UINT    ProcAmpControlCaps;")
-cpp_quote("  UINT    VideoProcessorOperations;")
-cpp_quote("  UINT    NoiseFilterTechnology;")
-cpp_quote("  UINT    DetailFilterTechnology;")
-cpp_quote("} DXVA2_VideoProcessorCaps;")
-cpp_quote("#endif")
-cpp_quote("")
-cpp_quote("/* SampleData")
-cpp_quote("DXVA2_SampleData_RFF")
-cpp_quote("DXVA2_SampleData_TFF")
-cpp_quote("DXVA2_SampleData_RFF_TFF_Present")
-cpp_quote("*/")
-cpp_quote("")
-cpp_quote("#ifdef _D3D9_H_")
-cpp_quote("typedef struct _DXVA2_VideoSample {")
-cpp_quote("  REFERENCE_TIME       Start;")
-cpp_quote("  REFERENCE_TIME       End;")
-cpp_quote("  DXVA2_ExtendedFormat SampleFormat;")
-cpp_quote("  IDirect3DSurface9*   SrcSurface;")
-cpp_quote("  RECT                 SrcRect;")
-cpp_quote("  RECT                 DstRect;")
-cpp_quote("  DXVA2_AYUVSample8    Pal[16];")
-cpp_quote("  DXVA2_Fixed32        PlanarAlpha;")
-cpp_quote("  DWORD                SampleData;")
-cpp_quote("} DXVA2_VideoSample;")
-cpp_quote("#endif")
-cpp_quote("")
+typedef struct _DXVA2_VideoProcessBltParams {
+  REFERENCE_TIME       TargetFrame;
+  RECT                 TargetRect;
+  SIZE                 ConstrictionSize;
+  UINT                 StreamingFlags;
+  DXVA2_AYUVSample16   BackgroundColor;
+  DXVA2_ExtendedFormat DestFormat;
+  DXVA2_ProcAmpValues  ProcAmpValues;
+  DXVA2_Fixed32        Alpha;
+  DXVA2_FilterValues   NoiseFilterLuma;
+  DXVA2_FilterValues   NoiseFilterChroma;
+  DXVA2_FilterValues   DetailFilterLuma;
+  DXVA2_FilterValues   DetailFilterChroma;
+  DWORD                DestData;
+} DXVA2_VideoProcessBltParams;
+
+#ifdef _D3D9_H_
+typedef struct _DXVA2_VideoProcessorCaps {
+  UINT    DeviceCaps;
+  D3DPOOL InputPool;
+  UINT    NumForwardRefSamples;
+  UINT    NumBackwardRefSamples;
+  UINT    Reserved;
+  UINT    DeinterlaceTechnology;
+  UINT    ProcAmpControlCaps;
+  UINT    VideoProcessorOperations;
+  UINT    NoiseFilterTechnology;
+  UINT    DetailFilterTechnology;
+} DXVA2_VideoProcessorCaps;
+#endif
+
+cpp_quote("/* deinterlacing capabilities */")
+cpp_quote("#define DXVA2_DeinterlaceTech_Unknown                      0x0")
+cpp_quote("#define DXVA2_DeinterlaceTech_BOBLineReplicate             0x1")
+cpp_quote("#define DXVA2_DeinterlaceTech_BOBVerticalStretch           0x2")
+cpp_quote("#define DXVA2_DeinterlaceTech_BOBVerticalStretch4Tap       0x4")
+cpp_quote("#define DXVA2_DeinterlaceTech_MedianFiltering              0x8")
+cpp_quote("#define DXVA2_DeinterlaceTech_EdgeFiltering               0x10")
+cpp_quote("#define DXVA2_DeinterlaceTech_FieldAdaptive               0x20")
+cpp_quote("#define DXVA2_DeinterlaceTech_PixelAdaptive               0x40")
+cpp_quote("#define DXVA2_DeinterlaceTech_MotionVectorSteered         0x80")
+cpp_quote("#define DXVA2_DeinterlaceTech_InverseTelecine            0x100")
+cpp_quote("#define DXVA2_DeinterlaceTech_Mask                       0x1FF")
+
+cpp_quote("/* VideoProcessor capabilities */")
+cpp_quote("#define DXVA2_VideoProcess_None                            0x0")
+cpp_quote("#define DXVA2_VideoProcess_YUV2RGB                         0x1")
+cpp_quote("#define DXVA2_VideoProcess_StretchX                        0x2")
+cpp_quote("#define DXVA2_VideoProcess_StretchY                        0x4")
+cpp_quote("#define DXVA2_VideoProcess_AlphaBlend                      0x8")
+cpp_quote("#define DXVA2_VideoProcess_SubRects                       0x10")
+cpp_quote("#define DXVA2_VideoProcess_SubStreams                     0x20")
+cpp_quote("#define DXVA2_VideoProcess_SubStreamsExtended             0x40")
+cpp_quote("#define DXVA2_VideoProcess_YUV2RGBExtended                0x80")
+cpp_quote("#define DXVA2_VideoProcess_AlphaBlendExtended            0x100")
+cpp_quote("#define DXVA2_VideoProcess_Constriction                  0x200")
+cpp_quote("#define DXVA2_VideoProcess_NoiseFilter                   0x400")
+cpp_quote("#define DXVA2_VideoProcess_DetailFilter                  0x800")
+cpp_quote("#define DXVA2_VideoProcess_PlanarAlpha                  0x1000")
+cpp_quote("#define DXVA2_VideoProcess_LinearScaling                0x2000")
+cpp_quote("#define DXVA2_VideoProcess_GammaCompensated             0x4000")
+cpp_quote("#define DXVA2_VideoProcess_MaintainsOriginalFieldData   0x8000")
+cpp_quote("#define DXVA2_VideoProcess_Mask                         0xFFFF")
+
+cpp_quote("/* SampleData */")
+enum
+{
+  DXVA2_SampleData_RFF             = 1,
+  DXVA2_SampleData_TFF             = 2,
+  DXVA2_SampleData_RFF_TFF_Present = 4,
+  DXVA2_SampleData_Mask            = 0xFFFF
+};
+
+#ifdef _D3D9_H_
+typedef struct _DXVA2_VideoSample {
+  REFERENCE_TIME       Start;
+  REFERENCE_TIME       End;
+  DXVA2_ExtendedFormat SampleFormat;
+  IDirect3DSurface9*   SrcSurface;
+  RECT                 SrcRect;
+  RECT                 DstRect;
+  DXVA2_AYUVSample8    Pal[16];
+  DXVA2_Fixed32        PlanarAlpha;
+  DWORD                SampleData;
+} DXVA2_VideoSample;
+#endif
+
 cpp_quote("/* Constants */")
 cpp_quote("")
 cpp_quote("#define DXVA2_VideoDecoderRenderTarget 0")
@@ -385,13 +426,13 @@ cpp_quote("#define DXVA2_BitStreamDateBu
 cpp_quote("#define DXVA2_MotionVectorBuffer 7")
 cpp_quote("#define DXVA2_FilmGrainBuffer 8")
 cpp_quote("")
-cpp_quote("__forceinline const DXVA2_Fixed32 DXVA2_Fixed32OpaqueAlpha (void) {")
+cpp_quote("__forceinline DXVA2_Fixed32 DXVA2_Fixed32OpaqueAlpha (void) {")
 cpp_quote("  DXVA2_Fixed32 f32;")
 cpp_quote("  f32.ll = 0 + (1 << 16);")
 cpp_quote("  return f32;")
 cpp_quote("}")
 cpp_quote("")
-cpp_quote("__forceinline const DXVA2_Fixed32 DXVA2_Fixed32TransparentAlpha (void) {")
+cpp_quote("__forceinline DXVA2_Fixed32 DXVA2_Fixed32TransparentAlpha (void) {")
 cpp_quote("  DXVA2_Fixed32 f32;")
 cpp_quote("  f32.ll = 0;")
 cpp_quote("  return f32;")
@@ -481,4 +522,84 @@ interface IDirectXVideoDecoderService :
             [in] UINT NumRenderTargets, [out] IDirectXVideoDecoder **ppDecode);
 }
 
+[
+    object,
+    uuid(8c3a39f0-916e-4690-804f-4c8001355d25),
+    local
+]
+interface IDirectXVideoProcessor : IUnknown
+{
+    HRESULT GetVideoProcessorService([out] IDirectXVideoProcessorService** ppService);
+
+    HRESULT GetCreationParameters(
+        [out] GUID* pDeviceGuid,
+        [out] DXVA2_VideoDesc* pVideoDesc,
+        [out] D3DFORMAT* pRenderTargetFormat,
+        [out] UINT* pMaxNumSubStreams);
+    HRESULT GetVideoProcessorCaps([out] DXVA2_VideoProcessorCaps* pCaps);
+    HRESULT GetProcAmpRange(
+        [in] UINT ProcAmpCap,
+        [out] DXVA2_ValueRange* pRange);
+    HRESULT GetFilterPropertyRange(
+        [in] UINT FilterSetting,
+        [out] DXVA2_ValueRange* pRange);
+    HRESULT VideoProcessBlt(
+        [in] IDirect3DSurface9* pRenderTarget,
+        [in] const DXVA2_VideoProcessBltParams* pBltParams,
+        [in] const DXVA2_VideoSample* pSamples,
+        [in] UINT NumSamples,
+        [out] HANDLE* pHandleComplete);
+};
+
+[
+    object,
+    uuid(fc51a552-d5e7-11d9-af55-00054e43ff02),
+    local
+]
+interface IDirectXVideoProcessorService : IDirectXVideoAccelerationService
+{
+    HRESULT RegisterVideoProcessorSoftwareDevice([in] void* pCallbacks);
+
+    HRESULT GetVideoProcessorDeviceGuids(
+        [in] const DXVA2_VideoDesc* pVideoDesc,
+        [out] UINT* pCount,
+        [out] GUID** pGuids);
+    HRESULT GetVideoProcessorRenderTargets(
+        [in] REFGUID VideoProcDeviceGuid,
+        [in] const DXVA2_VideoDesc* pVideoDesc,
+        [out] UINT* pCount,
+        [out] D3DFORMAT** pFormats);
+    HRESULT GetVideoProcessorSubStreamFormats(
+        [in] REFGUID VideoProcDeviceGuid,
+        [in] const DXVA2_VideoDesc* pVideoDesc,
+        [in] D3DFORMAT RenderTargetFormat,
+        [out] UINT* pCount,
+        [out] D3DFORMAT** pFormats);
+    HRESULT GetVideoProcessorCaps(
+        [in] REFGUID VideoProcDeviceGuid,
+        [in] const DXVA2_VideoDesc* pVideoDesc,
+        [in] D3DFORMAT RenderTargetFormat,
+        [out] DXVA2_VideoProcessorCaps* pCaps);
+    HRESULT GetProcAmpRange(
+        [in] REFGUID VideoProcDeviceGuid,
+        [in] const DXVA2_VideoDesc* pVideoDesc,
+        [in] D3DFORMAT RenderTargetFormat,
+        [in] UINT ProcAmpCap,
+        [out] DXVA2_ValueRange* pRange);
+    HRESULT GetFilterPropertyRange(
+        [in] REFGUID VideoProcDeviceGuid,
+        [in] const DXVA2_VideoDesc* pVideoDesc,
+        [in] D3DFORMAT RenderTargetFormat,
+        [in] UINT FilterSetting,
+        [out] DXVA2_ValueRange* pRange);
+    HRESULT CreateVideoProcessor(
+        [in] REFGUID VideoProcDeviceGuid,
+        [in] const DXVA2_VideoDesc* pVideoDesc,
+        [in] D3DFORMAT RenderTargetFormat,
+        [in] UINT MaxNumSubStreams,
+        [out] IDirectXVideoProcessor** ppVidProcess);
+}
+
 cpp_quote("#endif /* _D3D9_H_ */")
+
+cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */")
