[vlc-devel] [PATCH 3.0 04/17] contrib: replace d3d9/d3d11 idl generator with wine-idl

Steve Lhomme robux4 at ycbcr.xyz
Fri Mar 27 16:57:06 CET 2020


From: Thomas Guillem <thomas at gllm.fr>

(cherry picked from commit d357b49f2ea02361c32b202dae6e0fc7079d791d)
---
 contrib/src/d3d11/SHA512SUMS                  |    6 -
 contrib/src/d3d11/dxgi12.patch                |  109 --
 contrib/src/d3d11/dxgi1_3.idl                 |  242 ----
 contrib/src/d3d11/dxgi1_4.idl                 |  109 --
 contrib/src/d3d11/dxgi1_5.idl                 |   67 --
 contrib/src/d3d11/dxgi1_6.idl                 |   72 --
 contrib/src/d3d11/rules.mak                   |  121 --
 contrib/src/d3d9/SHA512SUMS                   |    3 -
 contrib/src/d3d9/dxva2api.patch               |  379 ------
 contrib/src/d3d9/rules.mak                    |   58 -
 contrib/src/ffmpeg/rules.mak                  |    2 +-
 contrib/src/wine-headers/SHA512SUMS           |    1 +
 contrib/src/{d3d9 => wine-headers}/d3d9.patch |    4 +-
 .../src/{d3d9 => wine-headers}/d3d9caps.patch |    4 +-
 .../{d3d11 => wine-headers}/dxgidebug.patch   |    5 +-
 contrib/src/wine-headers/dxva2api.patch       | 1018 +++++++++++++++++
 .../processor_format.patch                    |   13 +-
 contrib/src/wine-headers/rules.mak            |   57 +
 modules/hw/d3d11/d3d11_deinterlace.c          |   10 -
 19 files changed, 1087 insertions(+), 1193 deletions(-)
 delete mode 100644 contrib/src/d3d11/SHA512SUMS
 delete mode 100644 contrib/src/d3d11/dxgi12.patch
 delete mode 100644 contrib/src/d3d11/dxgi1_3.idl
 delete mode 100644 contrib/src/d3d11/dxgi1_4.idl
 delete mode 100644 contrib/src/d3d11/dxgi1_5.idl
 delete mode 100644 contrib/src/d3d11/dxgi1_6.idl
 delete mode 100644 contrib/src/d3d11/rules.mak
 delete mode 100644 contrib/src/d3d9/SHA512SUMS
 delete mode 100644 contrib/src/d3d9/dxva2api.patch
 delete mode 100644 contrib/src/d3d9/rules.mak
 create mode 100644 contrib/src/wine-headers/SHA512SUMS
 rename contrib/src/{d3d9 => wine-headers}/d3d9.patch (94%)
 rename contrib/src/{d3d9 => wine-headers}/d3d9caps.patch (70%)
 rename contrib/src/{d3d11 => wine-headers}/dxgidebug.patch (95%)
 create mode 100644 contrib/src/wine-headers/dxva2api.patch
 rename contrib/src/{d3d11 => wine-headers}/processor_format.patch (54%)
 create mode 100644 contrib/src/wine-headers/rules.mak

diff --git a/contrib/src/d3d11/SHA512SUMS b/contrib/src/d3d11/SHA512SUMS
deleted file mode 100644
index 96c760804c..0000000000
--- a/contrib/src/d3d11/SHA512SUMS
+++ /dev/null
@@ -1,6 +0,0 @@
-0d97a004acd9d99d685aef6ae3c41b9951b41170d197173838ad2dbad4db309debcc2dd6ab2cfaa849ab9ca9841ae80232739b113b3e72c35ec8a481066acff5  d3d11.idl
-04b208ddf9c91f923d262ae68a5fb0588a3ef1a39ea450eaac9031e021bd5efdc7b30e3fb3e589b07bc88e41f8861caeb56934a2fa6cbf2efb7404f5f3453b70  dxgidebug.idl
-1bee79fcaf5db6e53510f49fb40009fe6291ffafe47e1aea46ae0068afd001b405b0d970a55af63e475fbb18108e1ca0f91d86a18b6598b922c454ed082e8941  dxgi1_2.idl
-3f24632a71c96498f3432ed55ebdbe0a90e00c86ff88e4a41d1d04fdda14532aeff7799401803a03c6f69b3a07930d3f190211accef4ca199a21b3671acdcc45  dxgitype.h
-bba687b7cd4fd321f99d70a8137b1aa01851d8fd72a007cf5f8e5bce55fe06e15c27fe82de6493291b7c9932ceb43642234ed07d9a6bcb6140229cdbeb4a49bd  dxgiformat.h
-40eec2c5a96aeafb18ed9936c6ca9fc05303a08572efe6a3483e316b8af4e392eba863af86cdbb1342ac3ccb039be1b962688b05610e07f426bab6474073bfa3  dxgi.idl
diff --git a/contrib/src/d3d11/dxgi12.patch b/contrib/src/d3d11/dxgi12.patch
deleted file mode 100644
index 5dde007217..0000000000
--- a/contrib/src/d3d11/dxgi12.patch
+++ /dev/null
@@ -1,109 +0,0 @@
---- tarballs/dxgi1_2.idl.orig	2016-03-02 16:01:30.243405100 +0100
-+++ tarballs/dxgi1_2.idl	2016-03-02 16:19:58.006959300 +0100
-@@ -232,3 +232,106 @@ interface IDXGIAdapter2 : IDXGIAdapter1
- {
-     HRESULT GetDesc2([out] DXGI_ADAPTER_DESC2 *pDesc);
- }
-+
-+typedef struct DXGI_OUTDUPL_DESC {
-+    DXGI_MODE_DESC ModeDesc;
-+    DXGI_MODE_ROTATION Rotation;
-+    BOOL DesktopImageInSystemMemory;
-+} DXGI_OUTDUPL_DESC;
-+
-+typedef struct DXGI_OUTDUPL_POINTER_POSITION {
-+    POINT Position;
-+    BOOL Visible;
-+} DXGI_OUTDUPL_POINTER_POSITION;
-+
-+typedef struct DXGI_OUTDUPL_FRAME_INFO {
-+    LARGE_INTEGER LastPresentTime;
-+    LARGE_INTEGER LastMouseUpdateTime;
-+    UINT AccumulatedFrames;
-+    BOOL RectsCoalesced;
-+    BOOL ProtectedContentMaskedOut;
-+    DXGI_OUTDUPL_POINTER_POSITION PointerPosition;
-+    UINT TotalMetadataBufferSize;
-+    UINT PointerShapeBufferSize;
-+} DXGI_OUTDUPL_FRAME_INFO;
-+
-+typedef struct DXGI_OUTDUPL_MOVE_RECT {
-+    POINT SourcePoint;
-+    RECT  DestinationRect;
-+} DXGI_OUTDUPL_MOVE_RECT;
-+
-+typedef struct DXGI_OUTDUPL_POINTER_SHAPE_INFO {
-+    UINT Type;
-+    UINT Width;
-+    UINT Height;
-+    UINT Pitch;
-+    POINT HotSpot;
-+} DXGI_OUTDUPL_POINTER_SHAPE_INFO;
-+[
-+    object,
-+    uuid(191cfac3-a341-470d-b26e-a864f428319c),
-+    local,
-+    pointer_default(unique)
-+]
-+interface IDXGIOutputDuplication :
-+    IDXGIObject
-+{
-+    void GetDesc(
-+            [out] DXGI_OUTDUPL_DESC* pDesc);
-+    HRESULT AcquireNextFrame(
-+            [in] UINT TimeoutInMilliseconds,
-+            [out] DXGI_OUTDUPL_FRAME_INFO* pFrameInfo,
-+            [out] IDXGIResource** ppDesktopResource);
-+    HRESULT GetFrameDirtyRects(
-+            [in] UINT DirtyRectsBufferSize,
-+            [out] RECT* pDirtyRectsBuffer,
-+            [out] UINT* pDirtyRectsBufferSizeRequired);
-+    HRESULT GetFrameMoveRects(
-+            [in] UINT MoveRectsBufferSize,
-+            [out] DXGI_OUTDUPL_MOVE_RECT* pMoveRectBuffer,
-+            [out] UINT* pMoveRectsBufferSizeRequired);
-+    HRESULT GetFramePointerShape(
-+            [in] UINT PointerShapeBufferSize,
-+            [out] void* pPointerShapeBuffer,
-+            [out] UINT* pPointerShapeBufferSizeRequired,
-+            [out] DXGI_OUTDUPL_POINTER_SHAPE_INFO* pPointerShapeInfo);
-+    HRESULT MapDesktopSurface(
-+            [out] DXGI_MAPPED_RECT* pLockedRect);
-+    HRESULT UnMapDesktopSurface();
-+    HRESULT ReleaseFrame();
-+};
-+
-+typedef struct DXGI_MODE_DESC1
-+{
-+    UINT Width;
-+    UINT Height;
-+    DXGI_RATIONAL RefreshRate;
-+    DXGI_FORMAT Format;
-+    DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
-+    DXGI_MODE_SCALING Scaling;
-+    BOOL Stereo;
-+} DXGI_MODE_DESC1;
-+
-+[
-+    object,
-+    uuid(00cddea8-939b-4b83-a340-a685226666cc),
-+    local,
-+    pointer_default(unique)
-+]
-+interface IDXGIOutput1 : IDXGIOutput
-+{
-+    HRESULT GetDisplayModeList1(
-+            [in] DXGI_FORMAT EnumFormat,
-+            [in] UINT Flags,
-+            [in, out] UINT * pNumModes,
-+            [out] DXGI_MODE_DESC1 *pDesc);
-+    HRESULT FindClosestMatchingMode1(
-+            [in] const DXGI_MODE_DESC1 *pModeToMatch,
-+            [out] DXGI_MODE_DESC1 *pClosestMatch,
-+            [in] IUnknown * pConcernedDevice);
-+    HRESULT GetDisplaySurfaceData1(
-+            [in] IDXGIResource *pDestination);
-+    HRESULT DuplicateOutput(
-+            [in] IUnknown    *pDevice,
-+            [out] IDXGIOutputDuplication **ppOutputDuplication);
-+};
diff --git a/contrib/src/d3d11/dxgi1_3.idl b/contrib/src/d3d11/dxgi1_3.idl
deleted file mode 100644
index da4b5fbc82..0000000000
--- a/contrib/src/d3d11/dxgi1_3.idl
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright 2015 Martell Malone
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-import "dxgi1_2.idl";
-
-cpp_quote("#define DXGI_CREATE_FACTORY_DEBUG   0x1")
-
-typedef struct DXGI_DECODE_SWAP_CHAIN_DESC
-{
-    UINT Flags;
-} DXGI_DECODE_SWAP_CHAIN_DESC;
-
-typedef enum DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS
-{
-    DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1,
-    DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709         = 0x2,
-    DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC         = 0x4,
-} DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS;
-
-[
-    object,
-    local,
-    uuid(2633066b-4514-4c7a-8fd8-12ea98059d18)
-]
-interface IDXGIDecodeSwapChain : IUnknown
-{
-    HRESULT PresentBuffer(
-        UINT buffer,
-        UINT sync,
-        UINT flags
-    );
-
-    HRESULT SetSourceRect(
-        const RECT* rect
-    );
-
-    HRESULT SetTargetRect(
-        const RECT* rect
-    );
-
-    HRESULT SetDestSize(
-        UINT width,
-        UINT height
-    );
-
-    HRESULT GetSourceRect(
-        [out] RECT* rect
-    );
-
-    HRESULT GetTargetRect(
-        [out] RECT* rect
-    );
-
-    HRESULT GetDestSize(
-        [out] UINT* width,
-        [out] UINT* height
-    );
-
-    HRESULT SetColorSpace(
-        DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS colorSpace
-    );
-
-    DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS GetColorSpace();
-}
-
-[
-    object,
-    local,
-    uuid(41e7d1f2-a591-4f7b-a2e5-fa9c843e1c12)
-]
-interface IDXGIFactoryMedia :IUnknown
-{
-    HRESULT CreateSwapChainForCompositionSurfaceHandle(
-        [in] IUnknown* device,
-        [in] HANDLE surface,
-        [in] const DXGI_SWAP_CHAIN_DESC1* desc,
-        [in] IDXGIOutput* output,
-        [out] IDXGISwapChain1** swapchain
-    );
-
-    HRESULT CreateDecodeSwapChainForCompositionSurfaceHandle(
-        [in] IUnknown* device,
-        [in] HANDLE surface,
-        [in] DXGI_DECODE_SWAP_CHAIN_DESC* desc,
-        [in] IDXGIResource* buffer,
-        [in] IDXGIOutput* output,
-        [out] IDXGIDecodeSwapChain** swapchain
-    );
-}
-
-typedef enum DXGI_FRAME_PRESENTATION_MODE
-{
-    DXGI_FRAME_PRESENTATION_MODE_COMPOSED = 0,
-    DXGI_FRAME_PRESENTATION_MODE_OVERLAY = 1,
-    DXGI_FRAME_PRESENTATION_MODE_NONE = 2,
-} DXGI_FRAME_PRESENTATION_MODE;
-
-typedef struct DXGI_FRAME_STATISTICS_MEDIA
-{
-    UINT PresentCount;
-    UINT PresentRefreshCount;
-    UINT SyncRefreshCount;
-    LARGE_INTEGER SyncQPCTime;
-    LARGE_INTEGER SyncGPUTime;
-    DXGI_FRAME_PRESENTATION_MODE CompositionMode;
-    UINT ApprovedPresentDuration;
-} DXGI_FRAME_STATISTICS_MEDIA;
-
-[
-    object,
-    local,
-    uuid(dd95b90b-f05f-4f6a-bd65-25bfb264bd84)
-]
-interface IDXGISwapChainMedia : IUnknown
-{
-    HRESULT GetFrameStatisticsMedia(
-        [out] DXGI_FRAME_STATISTICS_MEDIA* pStats
-    );
-
-    HRESULT SetPresentDuration(
-        UINT duration
-    );
-
-    HRESULT CheckPresentDurationSupport(
-        UINT duration,
-        [out] UINT* smallerduration,
-        [out] UINT* largerduration
-    );
-};
-
-typedef enum DXGI_OVERLAY_SUPPORT_FLAG
-{
-    DXGI_OVERLAY_SUPPORT_FLAG_DIRECT   = 0x1,
-    DXGI_OVERLAY_SUPPORT_FLAG_SCALING  = 0x2
-} DXGI_OVERLAY_SUPPORT_FLAG;
-
-[
-    object,
-    local,
-    uuid(6007896c-3244-4afd-bf18-a6d3beda5023)
-]
-interface IDXGIDevice3 : IDXGIDevice2
-{
-    void Trim();
-}
-
-[
-    object,
-    local,
-    uuid(595e39d1-2724-4663-99b1-da969de28364)
-]
-interface IDXGIOutput2 : IDXGIOutput1
-{
-    BOOL SupportsOverlays();
-}
-
-[
-    object,
-    local,
-    uuid(8a6bb301-7e7e-41F4-a8e0-5b32f7f99b18)
-]
-interface IDXGIOutput3 : IDXGIOutput2
-{
-    HRESULT CheckOverlaySupport(
-        [in] DXGI_FORMAT format,
-        [out, in] IUnknown* device,
-        [out] UINT* flags
-    );
-}
-
-[local] HRESULT __stdcall CreateDXGIFactory2(UINT Flags, REFIID riid, void **factory);
-
-typedef struct DXGI_MATRIX_3X2_F
-{
-    float _11;
-    float _12;
-    float _21;
-    float _22;
-    float _31;
-    float _32;
-} DXGI_MATRIX_3X2_F;
-
-[
-    object,
-    local,
-    uuid(a8be2ac4-199f-4946-b331-79599fb98de7)
-]
-interface IDXGISwapChain2 : IDXGISwapChain1
-{
-    HRESULT SetSourceSize(
-        UINT width,
-        UINT height
-    );
-
-    HRESULT GetSourceSize(
-        [out] UINT* width,
-        [out] UINT* height
-    );
-
-    HRESULT SetMaximumFrameLatency(
-        UINT max_latency
-    );
-
-    HRESULT GetMaximumFrameLatency(
-        [out] UINT* max_latency
-    );
-
-    HANDLE  GetFrameLatencyWaitableObject();
-
-    HRESULT SetMatrixTransform(
-        const DXGI_MATRIX_3X2_F* matrix
-    );
-
-    HRESULT GetMatrixTransform(
-        [out] DXGI_MATRIX_3X2_F* matrix
-    );
-}
-
-[
-    object,
-    local,
-    uuid(25483823-cd46-4c7d-86ca-47aa95b837bd)
-]
-interface IDXGIFactory3 : IDXGIFactory2
-{
-    UINT GetCreationFlags();
-}
diff --git a/contrib/src/d3d11/dxgi1_4.idl b/contrib/src/d3d11/dxgi1_4.idl
deleted file mode 100644
index 9467f3f6b9..0000000000
--- a/contrib/src/d3d11/dxgi1_4.idl
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2016 Steve Lhomme
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-import "dxgi1_3.idl";
-
-typedef enum DXGI_COLOR_SPACE_TYPE {
-    DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709         = 0,
-    DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709         = 1,
-    DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709       = 2,
-    DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020      = 3,
-    DXGI_COLOR_SPACE_RESERVED                       = 4,
-    DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601  = 5,
-    DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601     = 6,
-    DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601       = 7,
-    DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709     = 8,
-    DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709       = 9,
-    DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020    = 10,
-    DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020      = 11,
-    DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020      = 12,
-    DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020  = 13,
-    DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020    = 14,
-    DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15,
-    DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16,
-    DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020        = 17,
-    DXGI_COLOR_SPACE_CUSTOM                         = 0xFFFFFFFF,
-} DXGI_COLOR_SPACE_TYPE;
-
-[
-    object,
-    local,
-    uuid(94d99bdb-f1f8-4ab0-b236-7da0170edab1)
-]
-interface IDXGISwapChain3 : IDXGISwapChain2
-{
-    UINT GetCurrentBackBufferIndex();
-
-    HRESULT CheckColorSpaceSupport(
-        [in] DXGI_COLOR_SPACE_TYPE ColorSpace,
-        [out] UINT* pColorSpaceSupport
-    );
-
-    HRESULT SetColorSpace1(
-        [in] DXGI_COLOR_SPACE_TYPE ColorSpace
-    );
-
-    HRESULT ResizeBuffers1(
-        [in] UINT BufferCount,
-        [in] UINT Width,
-        [in] UINT Height,
-        [in] DXGI_FORMAT Format,
-        [in] UINT SwapChainFlags,
-        [in] const UINT* pCreationNodeMask,
-        [in] IUnknown* const* ppPresentQueue
-    );
-};
-
-typedef enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG
-{
-    DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT         = 0x01,
-    DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x02,
-} DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG;
-
-[
-    object,
-    local,
-    uuid(1bc6ea02-ef36-464f-bf0c-21ca39e5168a)
-]
-interface IDXGIFactory4 : IDXGIFactory3
-{
-    HRESULT EnumAdapterByLuid(
-        [in]  LUID     AdapterLuid,
-        [in]  REFIID   riid,
-        [out] void     **ppvAdapter
-    );
-    HRESULT EnumWarpAdapter(
-        [in]  REFIID   riid,
-        [out] void     **ppvAdapter
-    );
-}
-
-[
-    object,
-    local,
-    uuid(dc7dca35-2196-414d-9F53-617884032a60)
-]
-interface IDXGIOutput4 : IDXGIOutput3
-{
-    HRESULT CheckOverlayColorSpaceSupport(
-        [in]  DXGI_FORMAT           Format,
-        [in]  DXGI_COLOR_SPACE_TYPE ColorSpace,
-        [in]  IUnknown              *pConcernedDevice,
-        [out] UINT                  *pFlags
-    );
-}
diff --git a/contrib/src/d3d11/dxgi1_5.idl b/contrib/src/d3d11/dxgi1_5.idl
deleted file mode 100644
index 47196e166e..0000000000
--- a/contrib/src/d3d11/dxgi1_5.idl
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2017 Steve Lhomme
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-import "dxgi1_4.idl";
-
-typedef enum DXGI_HDR_METADATA_TYPE
-{
-    DXGI_HDR_METADATA_TYPE_NONE    = 0x00,
-    DXGI_HDR_METADATA_TYPE_HDR10   = 0x01,
-} DXGI_HDR_METADATA_TYPE;
-
-typedef struct DXGI_HDR_METADATA_HDR10
-{
-    UINT16 RedPrimary[2];
-    UINT16 GreenPrimary[2];
-    UINT16 BluePrimary[2];
-    UINT16 WhitePoint[2];
-    UINT   MaxMasteringLuminance;
-    UINT   MinMasteringLuminance;
-    UINT16 MaxContentLightLevel;
-    UINT16 MaxFrameAverageLightLevel;
-} DXGI_HDR_METADATA_HDR10;
-
-[
-    object,
-    local,
-    uuid(3d585d5a-bd4a-489e-b1f4-3dbcb6452ffb)
-]
-interface IDXGISwapChain4 : IDXGISwapChain3
-{
-    HRESULT SetHDRMetaData(
-        [in] DXGI_HDR_METADATA_TYPE Type,
-        [in] UINT Size,
-        [in] void* pMetaData
-    );
-};
-
-[
-    object,
-    local,
-    uuid(80A07424-AB52-42EB-833C-0C42FD282D98)
-]
-interface IDXGIOutput5 : IDXGIOutput4
-{
-    HRESULT DuplicateOutput1(
-        [in]        IUnknown               *pDevice,
-                    UINT                   Flags,
-        [in]        UINT                   SupportedFormatsCount,
-        [in]  const DXGI_FORMAT            *pSupportedFormats,
-        [out]       IDXGIOutputDuplication **ppOutputDuplication
-    );
-}
diff --git a/contrib/src/d3d11/dxgi1_6.idl b/contrib/src/d3d11/dxgi1_6.idl
deleted file mode 100644
index 5db720305e..0000000000
--- a/contrib/src/d3d11/dxgi1_6.idl
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2017 Steve Lhomme
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-import "dxgi1_4.idl";
-
-cpp_quote("/* HACK as widl segfaults with too many imports */")
-cpp_quote("#include <dxgi1_5.h>")
-cpp_quote("#ifndef __dxgi1_5_h__")
-
-[
-    object,
-    local,
-    uuid(80A07424-AB52-42EB-833C-0C42FD282D98)
-]
-interface IDXGIOutput5 : IDXGIOutput4
-{
-    HRESULT DuplicateOutput1(
-        [in]        IUnknown               *pDevice,
-                    UINT                   Flags,
-        [in]        UINT                   SupportedFormatsCount,
-        [in]  const DXGI_FORMAT            *pSupportedFormats,
-        [out]       IDXGIOutputDuplication **ppOutputDuplication
-    );
-}
-
-cpp_quote("#endif /* __dxgi1_5_h__ */")
-
-typedef struct DXGI_OUTPUT_DESC1
-{
-    WCHAR                 DeviceName[32];
-    RECT                  DesktopCoordinates;
-    BOOL                  AttachedToDesktop;
-    DXGI_MODE_ROTATION    Rotation;
-    HMONITOR              Monitor;
-    UINT                  BitsPerColor;
-    DXGI_COLOR_SPACE_TYPE ColorSpace;
-    FLOAT                 RedPrimary[2];
-    FLOAT                 GreenPrimary[2];
-    FLOAT                 BluePrimary[2];
-    FLOAT                 WhitePoint[2];
-    FLOAT                 MinLuminance;
-    FLOAT                 MaxLuminance;
-    FLOAT                 MaxFullFrameLuminance;
-    BOOL                  InternalOutput;
-} DXGI_OUTPUT_DESC1;
-
-[
-    object,
-    local,
-    uuid(068346e8-aaec-4b84-add7-137f513f77a1)
-]
-interface IDXGIOutput6 : IDXGIOutput5
-{
-    HRESULT GetDesc1(
-        [out] DXGI_OUTPUT_DESC1 *pDesc
-    );
-}
diff --git a/contrib/src/d3d11/rules.mak b/contrib/src/d3d11/rules.mak
deleted file mode 100644
index d2c1d9760e..0000000000
--- a/contrib/src/d3d11/rules.mak
+++ /dev/null
@@ -1,121 +0,0 @@
-# generate Direct3D11 temporary include
-
-ifdef HAVE_CROSS_COMPILE
-IDL_INCLUDES = -I/usr/include/wine/windows/ -I/usr/include/wine/wine/windows/
-else
-#ugly way to get the default location of standard idl files
-IDL_INCLUDES = -I/`echo $(MSYSTEM) | tr A-Z a-z`/$(BUILD)/include
-endif
-
-D3D11_COMMIT_ID := a0cd5afeb60be3be0860e9a203314c10485bb9b8
-DXGI12_COMMIT_ID := 790a6544347b53c314b9c6f1ea757a2d5504c67e
-DXGITYPE_COMMIT_ID := f4aba520d014ecfe3563e33860de001caf2804e2
-D3D11_IDL_URL := http://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(D3D11_COMMIT_ID)/tree/mingw-w64-headers/direct-x/include/d3d11.idl?format=raw
-DXGI12_IDL_URL := http://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(DXGI12_COMMIT_ID)/tree/mingw-w64-headers/direct-x/include/dxgi1_2.idl?format=raw
-DXGITYPE_H_URL := http://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(DXGITYPE_COMMIT_ID)/tree/mingw-w64-headers/direct-x/include/dxgitype.h?format=raw
-DXGIFORMAT_H_URL := http://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(DXGITYPE_COMMIT_ID)/tree/mingw-w64-headers/direct-x/include/dxgiformat.h?format=raw
-DXGI_IDL_URL := http://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(DXGITYPE_COMMIT_ID)/tree/mingw-w64-headers/direct-x/include/dxgi.idl?format=raw
-DST_D3D11_H = $(PREFIX)/include/d3d11.h
-DST_DXGIDEBUG_H = $(PREFIX)/include/dxgidebug.h
-DST_DXGITYPE_H = $(PREFIX)/include/dxgitype.h
-DST_DXGIFORMAT_H = $(PREFIX)/include/dxgiformat.h
-DST_DXGI_IDL = $(PREFIX)/include/dxgi.idl
-DST_DXGI12_H = $(PREFIX)/include/dxgi1_2.h
-DST_DXGI13_H = $(PREFIX)/include/dxgi1_3.h
-DST_DXGI14_H = $(PREFIX)/include/dxgi1_4.h
-DST_DXGI15_H = $(PREFIX)/include/dxgi1_5.h
-DST_DXGI16_H = $(PREFIX)/include/dxgi1_6.h
-
-
-ifdef HAVE_WIN32
-PKGS += d3d11
-endif
-
-$(TARBALLS)/d3d11.idl:
-	$(call download_pkg,$(D3D11_IDL_URL),d3d11)
-
-$(TARBALLS)/dxgidebug.idl:
-	(cd $(TARBALLS) && patch -fp1) < $(SRC)/d3d11/dxgidebug.patch
-
-$(TARBALLS)/dxgi1_2.idl:
-	$(call download_pkg,$(DXGI12_IDL_URL),d3d11)
-
-$(TARBALLS)/dxgitype.h:
-	$(call download_pkg,$(DXGITYPE_H_URL),d3d11)
-
-$(TARBALLS)/dxgiformat.h:
-	$(call download_pkg,$(DXGIFORMAT_H_URL),d3d11)
-
-$(TARBALLS)/dxgi.idl:
-	$(call download_pkg,$(DXGI_IDL_URL),d3d11)
-
-.sum-d3d11: $(TARBALLS)/d3d11.idl $(TARBALLS)/dxgidebug.idl $(TARBALLS)/dxgi1_2.idl $(TARBALLS)/dxgitype.h $(TARBALLS)/dxgiformat.h $(TARBALLS)/dxgi.idl
-
-d3d11: .sum-d3d11
-	mkdir -p $@
-	cp $(TARBALLS)/d3d11.idl $@ && cd $@ && patch -fp1 < ../$(SRC)/d3d11/processor_format.patch
-
-dxgi12: .sum-d3d11
-	mkdir -p $@
-	cp $(TARBALLS)/dxgi1_2.idl $@ && cd $@ && patch -fp1 < ../$(SRC)/d3d11/dxgi12.patch
-
-$(DST_D3D11_H): d3d11
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -I$(PREFIX)/include $(IDL_INCLUDES) -h -o $@ $</d3d11.idl
-
-$(DST_DXGIDEBUG_H): $(TARBALLS)/dxgidebug.idl
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -I$(PREFIX)/include $(IDL_INCLUDES) -h -o $@ $<
-
-$(DST_DXGITYPE_H): $(TARBALLS)/dxgitype.h
-	mkdir -p -- "$(PREFIX)/include/"
-	cp $(TARBALLS)/dxgitype.h $@
-
-$(DST_DXGIFORMAT_H): $(TARBALLS)/dxgiformat.h
-	mkdir -p -- "$(PREFIX)/include/"
-	cp $(TARBALLS)/dxgiformat.h $@
-
-$(DST_DXGI_IDL): $(TARBALLS)/dxgi.idl
-	mkdir -p -- "$(PREFIX)/include/"
-	cp $(TARBALLS)/dxgi.idl $@
-
-$(DST_DXGI12_H): dxgi12
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -I$(PREFIX)/include $(IDL_INCLUDES) -h -o $@ $</dxgi1_2.idl
-
-$(DST_DXGI13_H): $(SRC)/d3d11/dxgi1_3.idl $(DST_DXGI12_H)
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -Idxgi12 -I$(PREFIX)/include $(IDL_INCLUDES) -h -o $@ $<
-
-$(DST_DXGI14_H): $(SRC)/d3d11/dxgi1_4.idl $(DST_DXGI13_H)
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -Idxgi12 -I$(PREFIX)/include $(IDL_INCLUDES) -h -o $@ $<
-
-$(DST_DXGI15_H): $(SRC)/d3d11/dxgi1_5.idl $(DST_DXGI14_H)
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -Idxgi12 -I$(PREFIX)/include $(IDL_INCLUDES) -h -o $@ $<
-
-$(DST_DXGI16_H): $(SRC)/d3d11/dxgi1_6.idl $(DST_DXGI15_H)
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -Idxgi12 -I$(PREFIX)/include $(IDL_INCLUDES) -h -o $@ $<
-
-.dxgitype: $(DST_DXGITYPE_H) $(DST_DXGIFORMAT_H) $(DST_DXGI_IDL)
-	touch $@
-
-.dxgi12: .dxgitype $(DST_DXGI12_H)
-	touch $@
-
-.dxgi13: .dxgi12 $(DST_DXGI13_H)
-	touch $@
-
-.dxgi14: .dxgi13 $(DST_DXGI14_H)
-	touch $@
-
-.dxgi15: .dxgi14 $(DST_DXGI15_H)
-	touch $@
-
-.dxgi16: .dxgi15 $(DST_DXGI16_H)
-	touch $@
-
-.d3d11: $(DST_D3D11_H) $(DST_DXGIDEBUG_H) .dxgi16
-	touch $@
diff --git a/contrib/src/d3d9/SHA512SUMS b/contrib/src/d3d9/SHA512SUMS
deleted file mode 100644
index cf4fe86865..0000000000
--- a/contrib/src/d3d9/SHA512SUMS
+++ /dev/null
@@ -1,3 +0,0 @@
-81ee35501f7657dee19bc24f94af15a34a61b84fd0855a4ff91ab95b0e16ec163594e64accde1acdd289a07b8cd9c0cd640cbcbc87b11bebd92e4db841da80aa  d3d9caps.h
-42cfe1b2234065e4ce712f806370d0acbdf9bb4e4dd74859f21fd7e7428eabca9b5607c03aba57d3994d0946722d1837a454891a2e7f8242d353f29bb6a80d55  d3d9.h
-dda26118ad53e99cd8533b773fa2a38f7a184af8b68c797d0efa3256abc80f0d3c304b12601933eff79ed6c67f6f2fce40e31eadfb7ccf27ca2a297f465c113b  dxva2api.idl
diff --git a/contrib/src/d3d9/dxva2api.patch b/contrib/src/d3d9/dxva2api.patch
deleted file mode 100644
index 9654e1f8ae..0000000000
--- a/contrib/src/d3d9/dxva2api.patch
+++ /dev/null
@@ -1,379 +0,0 @@
---- 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) */")
diff --git a/contrib/src/d3d9/rules.mak b/contrib/src/d3d9/rules.mak
deleted file mode 100644
index b3b3b61aea..0000000000
--- a/contrib/src/d3d9/rules.mak
+++ /dev/null
@@ -1,58 +0,0 @@
-# generate Direct3D9 temporary include
-
-ifdef HAVE_CROSS_COMPILE
-IDL_INC_PATH = -I/usr/include/wine/windows/ -I/usr/include/wine/wine/windows/
-else
-#ugly way to get the default location of standard idl files
-IDL_INC_PATH = -I/`echo $(MSYSTEM) | tr A-Z a-z`/$(BUILD)/include
-endif
-
-D3D9CAPS_COMMIT_ID := 477108e5706e73421634436c21cb76e1795b3609
-DXVA2API_COMMIT_ID := 67bb96f54d720ca9e5aaa5da7d385348e0bfac31
-D3D9CAPS_H_URL := http://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(D3D9CAPS_COMMIT_ID)/tree/mingw-w64-headers/direct-x/include/d3d9caps.h?format=raw
-D3D9_H_URL := http://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(D3D9CAPS_COMMIT_ID)/tree/mingw-w64-headers/direct-x/include/d3d9.h?format=raw
-DXVA2API_IDL_URL := https://sourceforge.net/p/mingw-w64/mingw-w64/ci/$(DXVA2API_COMMIT_ID)/tree/mingw-w64-headers/include/dxva2api.idl?format=raw
-DST_D3D9CAPS_H = $(PREFIX)/include/d3d9caps.h
-DST_D3D9_H = $(PREFIX)/include/d3d9.h
-DST_DXVA2API_H = $(PREFIX)/include/dxva2api.h
-
-
-ifdef HAVE_WIN32
-ifndef HAVE_VISUALSTUDIO
-PKGS += d3d9
-endif
-endif
-
-$(TARBALLS)/d3d9caps.h:
-	$(call download_pkg,$(D3D9CAPS_H_URL),d3d9)
-
-$(TARBALLS)/d3d9.h:
-	$(call download_pkg,$(D3D9_H_URL),d3d9)
-
-$(TARBALLS)/dxva2api.idl:
-	$(call download_pkg,$(DXVA2API_IDL_URL),d3d9)
-
-.sum-d3d9: $(TARBALLS)/d3d9caps.h $(TARBALLS)/d3d9.h $(TARBALLS)/dxva2api.idl
-
-$(DST_D3D9CAPS_H): $(TARBALLS)/d3d9caps.h .sum-d3d9
-	mkdir -p -- "$(PREFIX)/include/"
-	cd $(TARBALLS) && patch -fp1 < $(SRC)/d3d9/d3d9caps.patch -o $@
-
-$(DST_D3D9_H): $(TARBALLS)/d3d9.h .sum-d3d9
-	mkdir -p -- "$(PREFIX)/include/"
-	cd $(TARBALLS) && patch -fp1 < $(SRC)/d3d9/d3d9.patch -o $@
-
-dxva2api/dxva2api.idl: .sum-d3d9
-	mkdir -p dxva2api
-	cp $(TARBALLS)/dxva2api.idl $@
-	patch -fp1 < $(SRC)/d3d9/dxva2api.patch
-
-$(DST_DXVA2API_H): dxva2api/dxva2api.idl
-	mkdir -p -- "$(PREFIX)/include/"
-	$(WIDL) -DBOOL=WINBOOL -D_D3D9_H_ -D__C89_NAMELESS $(IDL_INCLUDES) -h -o $@ $<
-
-.d3d9caps: $(DST_D3D9CAPS_H)
-	touch $@
-
-.d3d9: $(DST_D3D9_H) $(DST_D3D9CAPS_H) $(DST_DXVA2API_H)
-	touch $@
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 82fcc9955f..4ba202dfcd 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -175,7 +175,7 @@ endif
 # Windows
 ifdef HAVE_WIN32
 ifndef HAVE_VISUALSTUDIO
-DEPS_ffmpeg += d3d11
+DEPS_ffmpeg += wine-headers
 ifndef HAVE_MINGW_W64
 DEPS_ffmpeg += directx
 endif
diff --git a/contrib/src/wine-headers/SHA512SUMS b/contrib/src/wine-headers/SHA512SUMS
new file mode 100644
index 0000000000..bb2b5ddec9
--- /dev/null
+++ b/contrib/src/wine-headers/SHA512SUMS
@@ -0,0 +1 @@
+261420efdf14595715cff5bb6a61223b0f2090b89dc05dca8c053a8a81abc3018715d41db50769a0f0488c658efc0742ac0f577b578e69eace70be4e463131dd  wine-4.5.tar.xz
diff --git a/contrib/src/d3d9/d3d9.patch b/contrib/src/wine-headers/d3d9.patch
similarity index 94%
rename from contrib/src/d3d9/d3d9.patch
rename to contrib/src/wine-headers/d3d9.patch
index f062424eac..55ae38ed8a 100644
--- a/contrib/src/d3d9/d3d9.patch
+++ b/contrib/src/wine-headers/d3d9.patch
@@ -1,5 +1,5 @@
---- include/d3d9.h	2016-04-17 11:41:20.676521300 +0300
-+++ include/d3d9.h.new	2016-04-17 12:12:13.637219200 +0300
+--- a/include/d3d9.h	2016-04-17 11:41:20.676521300 +0300
++++ b/include/d3d9.h	2016-04-17 12:12:13.637219200 +0300
 @@ -2185,6 +2185,42 @@ __CRT_UUID_DECL(IDirect3DDevice9Ex,
  #define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c)                     (p)->GetDisplayModeEx(a,b,c)
  #endif
diff --git a/contrib/src/d3d9/d3d9caps.patch b/contrib/src/wine-headers/d3d9caps.patch
similarity index 70%
rename from contrib/src/d3d9/d3d9caps.patch
rename to contrib/src/wine-headers/d3d9caps.patch
index b32aabb6f9..e38673b087 100644
--- a/contrib/src/d3d9/d3d9caps.patch
+++ b/contrib/src/wine-headers/d3d9caps.patch
@@ -1,5 +1,5 @@
---- include/d3d9caps.h	2016-04-17 11:41:20.681535900 +0300
-+++ include/d3d9caps.h.old	2016-04-17 11:49:14.065736000 +0300
+--- a/include/d3d9caps.h	2016-04-17 11:41:20.681535900 +0300
++++ b/include/d3d9caps.h	2016-04-17 11:49:14.065736000 +0300
 @@ -399,6 +399,14 @@ typedef struct _D3DCAPS9 {
  
  } D3DCAPS9;
diff --git a/contrib/src/d3d11/dxgidebug.patch b/contrib/src/wine-headers/dxgidebug.patch
similarity index 95%
rename from contrib/src/d3d11/dxgidebug.patch
rename to contrib/src/wine-headers/dxgidebug.patch
index ba95166eb5..5ee47922cc 100644
--- a/contrib/src/d3d11/dxgidebug.patch
+++ b/contrib/src/wine-headers/dxgidebug.patch
@@ -1,6 +1,6 @@
-diff --git a/dxgidebug.idl b/dxgidebug.idl
+diff --git a/include/dxgidebug.idl b/include/dxgidebug.idl
 --- /dev/null
-+++ b/dxgidebug.idl
++++ b/include/dxgidebug.idl
 @@ -0,0 +1,44 @@
 +/*
 + * Copyright 2015 Steve Lhomme
@@ -48,4 +48,3 @@ diff --git a/dxgidebug.idl b/dxgidebug.idl
 +
 --
 1.9.5.msysgit.0
-
diff --git a/contrib/src/wine-headers/dxva2api.patch b/contrib/src/wine-headers/dxva2api.patch
new file mode 100644
index 0000000000..44ebeb4c28
--- /dev/null
+++ b/contrib/src/wine-headers/dxva2api.patch
@@ -0,0 +1,1018 @@
+diff --git a/include/dxva2api.idl b/include/dxva2api.idl
+index 88c586fa08..23650269d1 100644
+--- a/include/dxva2api.idl
++++ b/include/dxva2api.idl
+@@ -18,296 +18,454 @@
+ 
+ import "unknwn.idl";
+ 
++cpp_quote("#include <winapifamily.h>")
++
++/* Fake widl types */
+ cpp_quote("#if 0")
+ typedef DWORD IDirect3DDevice9;
+ typedef DWORD IDirect3DSurface9;
+-
+ typedef DWORD D3DFORMAT;
+ typedef DWORD D3DPOOL;
+ cpp_quote("#endif")
+ 
+-/* MPEG2 */
+-cpp_quote("DEFINE_GUID(DXVA2_ModeMPEG2_MoComp, 0xe6a9f44b, 0x61b0,0x4563, 0x9e,0xa4,0x63,0xd2,0xa3,0xc6,0xfe,0x66);")
+-cpp_quote("#define DXVA2_ModeMPEG2_MOCOMP      DXVA2_ModeMPEG2_MoComp")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeMPEG2_IDCT,   0xbf22ad00, 0x03ea,0x4690, 0x80,0x77,0x47,0x33,0x46,0x20,0x9b,0x7e);")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeMPEG2_VLD,    0xee27417f, 0x5e28,0x4e65, 0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9);")
+-
+-/* H264 */
+-cpp_quote("DEFINE_GUID(DXVA2_ModeH264_A,       0x1b81be64, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeH264_MoComp_NoFGT DXVA2_ModeH264_A")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeH264_B,       0x1b81be65, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeH264_MoComp_FGT   DXVA2_ModeH264_B")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeH264_C,       0x1b81be66, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeH264_IDCT_NoFGT   DXVA2_ModeH264_C")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeH264_D,       0x1b81be67, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeH264_IDCT_FGT     DXVA2_ModeH264_D")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeH264_E,       0x1b81be68, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeH264_VLD_NoFGT    DXVA2_ModeH264_E")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeH264_F,       0x1b81be69, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeH264_VLD_FGT      DXVA2_ModeH264_F")
++cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")
+ 
+-/* WMV8 */
+-cpp_quote("DEFINE_GUID(DXVA2_ModeWMV8_A,       0x1b81be80, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeWMV8_PostProc     DXVA2_ModeWMV8_A")
++interface IDirectXVideoDecoderService;
++interface IDirectXVideoProcessorService;
+ 
+-cpp_quote("DEFINE_GUID(DXVA2_ModeWMV8_B,       0x1b81be81, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeWMV8_MoComp       DXVA2_ModeWMV8_B")
+-
+-/* WMV9 */
+-cpp_quote("DEFINE_GUID(DXVA2_ModeWMV9_A,       0x1b81be90, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeWMV9_PostProc     DXVA2_ModeWMV9_A")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeWMV9_B,       0x1b81be91, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeWMV9_MoComp       DXVA2_ModeWMV9_B")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeWMV9_C,       0x1b81be94, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeWMV9_IDCT         DXVA2_ModeWMV9_C")
+-
+-/* VC1 */
+-cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_A,        0x1b81beA0, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeVC1_PostProc      DXVA2_ModeVC1_A")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_B,        0x1b81beA1, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeVC1_MoComp        DXVA2_ModeVC1_B")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_C,        0x1b81beA2, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeVC1_IDCT          DXVA2_ModeVC1_C")
+-
+-cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_D,        0x1b81beA3, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-cpp_quote("#define DXVA2_ModeVC1_VLD           DXVA2_ModeVC1_D")
+-
+-/* Encryption */
+-cpp_quote("DEFINE_GUID(DXVA_NoEncrypt,         0x1b81bed0, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
+-
+-cpp_quote("#ifndef REFERENCE_TIME_DEFINED")
+-cpp_quote("#define REFERENCE_TIME_DEFINED")
++#ifndef __REFERENCE_TIME_DEFINED
++#define __REFERENCE_TIME_DEFINED
+ typedef LONGLONG REFERENCE_TIME;
+-cpp_quote("#endif")
+-
+-enum
+-{
+-    DXVA2_PictureParametersBufferType,
+-    DXVA2_MacroBlockControlBufferType,
+-    DXVA2_ResidualDifferenceBufferType,
+-    DXVA2_DeblockingControlBufferType,
+-    DXVA2_InverseQuantizationMatrixBufferType,
+-    DXVA2_SliceControlBufferType,
+-    DXVA2_BitStreamDateBufferType,
+-    DXVA2_MotionVectorBuffer,
+-    DXVA2_FilmGrainBuffer
+-};
+-
+-enum
+-{
+-    DXVA2_VideoDecoderRenderTarget,
+-    DXVA2_VideoProcessorRenderTarget,
+-    DXVA2_VideoSoftwareRenderTarget
+-};
+-
+-typedef struct _DXVA2_ExtendedFormat
+-{
+-    union
+-    {
+-        struct
+-        {
+-            UINT SampleFormat           :8;
+-            UINT VideoChromaSubsampling :4;
+-            UINT NominalRange           :3;
+-            UINT VideoTransferMatrix    :3;
+-            UINT VideoLighting          :4;
+-            UINT VideoPrimaries         :5;
+-            UINT VideoTransferFunction  :5;
+-        };
+-        UINT value;
+-    };
+-} DXVA2_ExtendedFormat;
++#endif /*__REFERENCE_TIME_DEFINED*/
++
++cpp_quote("#define DXVA2_ProcAmp_None 0x0000")
++cpp_quote("#define DXVA2_ProcAmp_Brightness 0x0001")
++cpp_quote("#define DXVA2_ProcAmp_Contrast 0x0002")
++cpp_quote("#define DXVA2_ProcAmp_Hue 0x0004")
++cpp_quote("#define DXVA2_ProcAmp_Saturation 0x0008")
++cpp_quote("")
++cpp_quote("#define DXVA2_E_NOT_INITIALIZED     MAKE_HRESULT(1, 4, 4096)")
++cpp_quote("#define DXVA2_E_NEW_VIDEO_DEVICE    MAKE_HRESULT(1, 4, 4097)")
++cpp_quote("#define DXVA2_E_VIDEO_DEVICE_LOCKED MAKE_HRESULT(1, 4, 4098)")
++cpp_quote("#define DXVA2_E_NOT_AVAILABLE       MAKE_HRESULT(1, 4, 4099)")
++cpp_quote("")
++cpp_quote("DEFINE_GUID(DXVA2_ModeMPEG2_MoComp, 0xe6a9f44b, 0x61b0,0x4563, 0x9e,0xa4,0x63,0xd2,0xa3,0xc6,0xfe,0x66);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeMPEG2_IDCT, 0xbf22ad00, 0x03ea,0x4690, 0x80,0x77,0x47,0x33,0x46,0x20,0x9b,0x7e);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28,0x4e65, 0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeH264_A, 0x1b81be64, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeH264_B, 0x1b81be65, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeH264_C, 0x1b81be66, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeH264_D, 0x1b81be67, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeWMV8_A, 0x1b81be80, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeWMV8_B, 0x1b81be81, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeWMV9_A, 0x1b81be90, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeWMV9_B, 0x1b81be91, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeWMV9_C, 0x1b81be94, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_A, 0x1b81beA0, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_B, 0x1b81beA1, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_C, 0x1b81beA2, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("DEFINE_GUID(DXVA2_ModeVC1_D, 0x1b81beA3, 0xa0c7,0x11d3, 0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);")
++cpp_quote("")
++cpp_quote("typedef enum _DXVA2_SampleFormat {")
++cpp_quote("  DXVA2_SampleFormatMask                  = 0x00FF,")
++cpp_quote("  DXVA2_SampleUnknown                     = 0,")
++cpp_quote("  DXVA2_SampleProgressiveFrame            = 2,")
++cpp_quote("  DXVA2_SampleFieldInterleavedEvenFirst   = 3,")
++cpp_quote("  DXVA2_SampleFieldInterleavedOddFirst    = 4,")
++cpp_quote("  DXVA2_SampleFieldSingleEven             = 5,")
++cpp_quote("  DXVA2_SampleFieldSingleOdd              = 6,")
++cpp_quote("  DXVA2_SampleSubStream                   = 7 ")
++cpp_quote("} DXVA2_SampleFormat;")
++cpp_quote("")
++cpp_quote("typedef enum _DXVA2_VideoChromaSubSampling {")
++cpp_quote("  DXVA2_VideoChromaSubsamplingMask                              = 0x0F,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_Unknown                          = 0,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_ProgressiveChroma                = 0x8,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_Horizontally_Cosited             = 0x4,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_Vertically_Cosited               = 0x2,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes   = 0x1,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_MPEG2                            = ")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Horizontally_Cosited |")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_MPEG1                            = ")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_DV_PAL                           = ")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Horizontally_Cosited | ")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Vertically_Cosited,")
++cpp_quote("  DXVA2_VideoChromaSubsampling_Cosited                          = ")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Horizontally_Cosited | ")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Vertically_Cosited | ")
++cpp_quote("              DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes ")
++cpp_quote("} DXVA2_VideoChromaSubSampling;")
++cpp_quote("")
++cpp_quote("typedef enum _DXVA2_NominalRange {")
++cpp_quote("  DXVA2_NominalRangeMask       = 0x07,")
++cpp_quote("  DXVA2_NominalRange_Unknown   = 0,")
++cpp_quote("  DXVA2_NominalRange_Normal    = 1,")
++cpp_quote("  DXVA2_NominalRange_Wide      = 2,")
++cpp_quote("  DXVA2_NominalRange_0_255     = 1,")
++cpp_quote("  DXVA2_NominalRange_16_235    = 2,")
++cpp_quote("  DXVA2_NominalRange_48_208    = 3 ")
++cpp_quote("} DXVA2_NominalRange;")
++cpp_quote("")
++cpp_quote("typedef enum _DXVA2_VideoLighting {")
++cpp_quote("  DXVA2_VideoLightingMask       = 0x0F,")
++cpp_quote("  DXVA2_VideoLighting_Unknown   = 0,")
++cpp_quote("  DXVA2_VideoLighting_bright    = 1,")
++cpp_quote("  DXVA2_VideoLighting_office    = 2,")
++cpp_quote("  DXVA2_VideoLighting_dim       = 3,")
++cpp_quote("  DXVA2_VideoLighting_dark      = 4 ")
++cpp_quote("} DXVA2_VideoLighting;")
++cpp_quote("")
++cpp_quote("typedef enum _DXVA2_VideoPrimaries {")
++cpp_quote("  DXVA2_VideoPrimariesMask             = 0x001f,")
++cpp_quote("  DXVA2_VideoPrimaries_Unknown         = 0,")
++cpp_quote("  DXVA2_VideoPrimaries_reserved        = 1,")
++cpp_quote("  DXVA2_VideoPrimaries_BT709           = 2,")
++cpp_quote("  DXVA2_VideoPrimaries_BT470_2_SysM    = 3,")
++cpp_quote("  DXVA2_VideoPrimaries_BT470_2_SysBG   = 4,")
++cpp_quote("  DXVA2_VideoPrimaries_SMPTE170M       = 5,")
++cpp_quote("  DXVA2_VideoPrimaries_SMPTE240M       = 6,")
++cpp_quote("  DXVA2_VideoPrimaries_EBU3213         = 7,")
++cpp_quote("  DXVA2_VideoPrimaries_SMPTE_C         = 8 ")
++cpp_quote("} DXVA2_VideoPrimaries;")
++cpp_quote("")
++cpp_quote("typedef enum _DXVA2_VideoTransferFunction {")
++cpp_quote("  DXVA2_VideoTransFuncMask       = 0x001f,")
++cpp_quote("  DXVA2_VideoTransFunc_Unknown   = 0,")
++cpp_quote("  DXVA2_VideoTransFunc_10        = 1,")
++cpp_quote("  DXVA2_VideoTransFunc_18        = 2,")
++cpp_quote("  DXVA2_VideoTransFunc_20        = 3,")
++cpp_quote("  DXVA2_VideoTransFunc_22        = 4,")
++cpp_quote("  DXVA2_VideoTransFunc_709       = 5,")
++cpp_quote("  DXVA2_VideoTransFunc_240M      = 6,")
++cpp_quote("  DXVA2_VideoTransFunc_sRGB      = 7,")
++cpp_quote("  DXVA2_VideoTransFunc_28        = 8 ")
++cpp_quote("} DXVA2_VideoTransferFunction;")
++cpp_quote("")
++cpp_quote("typedef enum  {")
++cpp_quote("  DXVA2_SurfaceType_DecoderRenderTarget      = 0,")
++cpp_quote("  DXVA2_SurfaceType_ProcessorRenderTarget    = 1,")
++cpp_quote("  DXVA2_SurfaceType_D3DRenderTargetTexture   = 2 ")
++cpp_quote("} DXVA2_SurfaceType;")
++cpp_quote("")
++cpp_quote("typedef enum _DXVA2_VideoTransferMatrix {")
++cpp_quote("  DXVA2_VideoTransferMatrixMask         = 0x07,")
++cpp_quote("  DXVA2_VideoTransferMatrix_Unknown     = 0,")
++cpp_quote("  DXVA2_VideoTransferMatrix_BT709       = 1,")
++cpp_quote("  DXVA2_VideoTransferMatrix_BT601       = 2,")
++cpp_quote("  DXVA2_VideoTransferMatrix_SMPTE240M   = 3 ")
++cpp_quote("} DXVA2_VideoTransferMatrix;")
++cpp_quote("")
++typedef struct _DXVA2_AYUVSample16 {
++  USHORT Cr;
++  USHORT Cb;
++  USHORT Y;
++  USHORT Alpha;
++} DXVA2_AYUVSample16;
+ 
+-typedef struct _DXVA2_Frequency
+-{
+-    UINT Numerator;
+-    UINT Denominator;
+-} DXVA2_Frequency;
++typedef struct _DXVA2_AYUVSample8 {
++  UCHAR Cr;
++  UCHAR Cb;
++  UCHAR Y;
++  UCHAR Alpha;
++} DXVA2_AYUVSample8;
+ 
+-typedef struct _DXVA2_ConfigPictureDecode
+-{
+-    GUID guidConfigBitstreamEncryption;
+-    GUID guidConfigMBcontrolEncryption;
+-    GUID guidConfigResidDiffEncryption;
+-    UINT ConfigBitstreamRaw;
+-    UINT ConfigMBcontrolRasterOrder;
+-    UINT ConfigResidDiffHost;
+-    UINT ConfigSpatialResid8;
+-    UINT ConfigResid8Subtraction;
+-    UINT ConfigSpatialHost8or9Clipping;
+-    UINT ConfigSpatialResidInterleaved;
+-    UINT ConfigIntraResidUnsigned;
+-    UINT ConfigResidDiffAccelerator;
+-    UINT ConfigHostInverseScan;
+-    UINT ConfigSpecificIDCT;
+-    UINT Config4GroupedCoefs;
+-    UINT ConfigMinRenderTargetBuffCount;
+-    USHORT ConfigDecoderSpecific;
++typedef struct _DXVA2_ConfigPictureDecode {
++  GUID   guidConfigBitstreamEncryption;
++  GUID   guidConfigMBcontrolEncryption;
++  GUID   guidConfigResidDiffEncryption;
++  UINT   ConfigBitstreamRaw;
++  UINT   ConfigMBcontrolRasterOrder;
++  UINT   ConfigResidDiffHost;
++  UINT   ConfigSpatialResid8;
++  UINT   ConfigResid8Subtraction;
++  UINT   ConfigSpatialHost8or9Clipping;
++  UINT   ConfigSpatialResidInterleaved;
++  UINT   ConfigIntraResidUnsigned;
++  UINT   ConfigResidDiffAccelerator;
++  UINT   ConfigHostInverseScan;
++  UINT   ConfigSpecificIDCT;
++  UINT   Config4GroupedCoefs;
++  USHORT ConfigMinRenderTargetBuffCount;
++  USHORT ConfigDecoderSpecific;
+ } DXVA2_ConfigPictureDecode;
+ 
+-typedef struct _DXVA2_VideoDesc
+-{
+-    UINT SampleWidth;
+-    UINT SampleHeight;
+-    DXVA2_ExtendedFormat SampleFormat;
+-    D3DFORMAT Format;
+-    DXVA2_Frequency InputSampleFreq;
+-    DXVA2_Frequency OutputFrameFreq;
+-    UINT UABProtectionLevel;
+-    UINT Reserved;
+-} DXVA2_VideoDesc;
+-
+-typedef struct _DXVA2_DecodeBufferDesc
+-{
+-    DWORD CompressedBufferType;
+-    UINT BufferIndex;
+-    UINT DataOffset;
+-    UINT DataSize;
+-    UINT FirstMBaddress;
+-    UINT NumMBsInBuffer;
+-    UINT Width;
+-    UINT Height;
+-    UINT Stride;
+-    UINT ReservedBits;
+-    PVOID pvPVPState;
++typedef struct _DXVA2_DecodeBufferDesc {
++  DWORD CompressedBufferType;
++  UINT  BufferIndex;
++  UINT  DataOffset;
++  UINT  DataSize;
++  UINT  FirstMBaddress;
++  UINT  NumMBsInBuffer;
++  UINT  Width;
++  UINT  Height;
++  UINT  Stride;
++  UINT  ReservedBits;
++  PVOID pvPVPState;
+ } DXVA2_DecodeBufferDesc;
+ 
+-typedef struct _DXVA2_DecodeExtensionData
+-{
+-    UINT Function;
+-    PVOID pPrivateInputData;
+-    UINT PrivateInputDataSize;
+-    PVOID pPrivateOutputData;
+-    UINT PrivateOutputDataSize;
++typedef struct _DXVA2_DecodeExtensionData {
++  UINT  Function;
++  PVOID pPrivateInputData;
++  UINT  PrivateInputDataSize;
++  PVOID pPrivateOutputData;
++  UINT  PrivateOutputDataSize;
+ } DXVA2_DecodeExtensionData;
+ 
+-typedef struct _DXVA2_DecodeExecuteParams
+-{
+-    UINT NumCompBuffers;
+-    DXVA2_DecodeBufferDesc* pCompressedBuffers;
+-    DXVA2_DecodeExtensionData* pExtensionData;
++typedef struct _DXVA2_DecodeExecuteParams {
++  UINT                      NumCompBuffers;
++  DXVA2_DecodeBufferDesc    *pCompressedBuffers;
++  DXVA2_DecodeExtensionData *pExtensionData;
+ } DXVA2_DecodeExecuteParams;
+ 
+-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;
+-
+-typedef struct _DXVA2_Fixed32
+-{
+-    union
+-    {
+-        struct
+-        {
+-            USHORT Fraction;
+-            SHORT Value;
+-        };
+-        LONG ll;
++typedef struct _DXVA2_ExtendedFormat {
++  union {
++    struct {
++      UINT SampleFormat            :8;
++      UINT VideoChromaSubsampling  :4;
++      UINT NominalRange            :3;
++      UINT VideoTransferMatrix     :3;
++      UINT VideoLighting           :4;
++      UINT VideoPrimaries          :5;
++      UINT VideoTransferFunction   :5;
+     };
+-} DXVA2_Fixed32;
++    UINT   value;
++  };
++} DXVA2_ExtendedFormat;
+ 
+-typedef struct _DXVA2_ValueRange
+-{
+-    DXVA2_Fixed32 MinValue;
+-    DXVA2_Fixed32 MaxValue;
+-    DXVA2_Fixed32 DefaultValue;
+-    DXVA2_Fixed32 StepSize;
+-} DXVA2_ValueRange;
++typedef struct _DXVA2_Fixed32 {
++  __C89_NAMELESS union {
++    __C89_NAMELESS struct {
++      USHORT Fraction;
++      SHORT  Value;
++    } DUMMYSTRUCTNAME;
++    LONG   ll;
++  } DUMMYUNIONNAME;
++} DXVA2_Fixed32;
+ 
+-typedef struct _DXVA2_AYUVSample8
+-{
+-    UCHAR Cr;
+-    UCHAR Cb;
+-    UCHAR Y;
+-    UCHAR Alpha;
+-} DXVA2_AYUVSample8;
++typedef struct _DXVA2_FilterValues {
++  DXVA2_Fixed32 Level;
++  DXVA2_Fixed32 Threshold;
++  DXVA2_Fixed32 Radius;
++} DXVA2_FilterValues;
+ 
+-typedef struct _DXVA2_AYUVSample16
+-{
+-    USHORT Cr;
+-    USHORT Cb;
+-    USHORT Y;
+-    USHORT Alpha;
+-} DXVA2_AYUVSample16;
++typedef struct _DXVA2_Frequency {
++  UINT Numerator;
++  UINT Denominator;
++} DXVA2_Frequency;
+ 
+-typedef struct _DXVA2_ProcAmpValues
+-{
+-    DXVA2_Fixed32 Brightness;
+-    DXVA2_Fixed32 Contrast;
+-    DXVA2_Fixed32 Hue;
+-    DXVA2_Fixed32 Saturation;
++typedef struct _DXVA2_ProcAmpValues {
++  DXVA2_Fixed32 Brightness;
++  DXVA2_Fixed32 Contrast;
++  DXVA2_Fixed32 Hue;
++  DXVA2_Fixed32 Saturation;
+ } DXVA2_ProcAmpValues;
+ 
+-typedef struct _DXVA2_FilterValues
+-{
+-    DXVA2_Fixed32 Level;
+-    DXVA2_Fixed32 Threshold;
+-    DXVA2_Fixed32 Radius;
+-} DXVA2_FilterValues;
++typedef struct _DXVA2_ValueRange {
++  DXVA2_Fixed32 MinValue;
++  DXVA2_Fixed32 MaxValue;
++  DXVA2_Fixed32 DefaultValue;
++  DXVA2_Fixed32 StepSize;
++} DXVA2_ValueRange;
+ 
+-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;
++typedef struct _DXVA2_VideoDesc {
++  UINT                 SampleWidth;
++  UINT                 SampleHeight;
++  DXVA2_ExtendedFormat SampleFormat;
++  D3DFORMAT            Format;
++  DXVA2_Frequency      InputSampleFreq;
++  DXVA2_Frequency      OutputFrameFreq;
++  UINT                 UABProtectionLevel;
++  UINT                 Reserved;
++} DXVA2_VideoDesc;
+ 
+-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;
++cpp_quote("/* DeviceCaps")
++cpp_quote("DXVA2_VPDev_EmulatedDXVA1")
++cpp_quote("DXVA2_VPDev_HardwareDevice")
++cpp_quote("DXVA2_VPDev_SoftwareDevice")
++cpp_quote("*/")
++cpp_quote("/* DeinterlaceTechnology")
++cpp_quote("DXVA2_DeinterlaceTech_Unknown")
++cpp_quote("DXVA2_DeinterlaceTech_BOBLineReplicate")
++cpp_quote("DXVA2_DeinterlaceTech_BOBVerticalStretch")
++cpp_quote("DXVA2_DeinterlaceTech_BOBVerticalStretch4Tap")
++cpp_quote("DXVA2_DeinterlaceTech_MedianFiltering")
++cpp_quote("DXVA2_DeinterlaceTech_EdgeFiltering")
++cpp_quote("DXVA2_DeinterlaceTech_FieldAdaptive")
++cpp_quote("DXVA2_DeinterlaceTech_PixelAdaptive")
++cpp_quote("DXVA2_DeinterlaceTech_MotionVectorSteered")
++cpp_quote("DXVA2_DeinterlaceTech_InverseTelecine")
++cpp_quote("*/")
++cpp_quote("")
++cpp_quote("/* VideoProcessorOperations")
++cpp_quote("DXVA2_VideoProcess_YUV2RGB")
++cpp_quote("DXVA2_VideoProcess_StretchX")
++cpp_quote("DXVA2_VideoProcess_StretchY")
++cpp_quote("DXVA2_VideoProcess_AlphaBlend")
++cpp_quote("DXVA2_VideoProcess_SubRects")
++cpp_quote("DXVA2_VideoProcess_SubStreams")
++cpp_quote("DXVA2_VideoProcess_SubStreamsExtended")
++cpp_quote("DXVA2_VideoProcess_YUV2RGBExtended")
++cpp_quote("DXVA2_VideoProcess_AlphaBlendExtended")
++cpp_quote("DXVA2_VideoProcess_Constriction")
++cpp_quote("DXVA2_VideoProcess_NoiseFilter")
++cpp_quote("DXVA2_VideoProcess_DetailFilter")
++cpp_quote("DXVA2_VideoProcess_PlanarAlpha")
++cpp_quote("DXVA2_VideoProcess_LinearScaling")
++cpp_quote("DXVA2_VideoProcess_GammaCompensated")
++cpp_quote("DXVA2_VideoProcess_MaintainsOriginalFieldData")
++cpp_quote("*/")
++cpp_quote("")
++cpp_quote("/*NoiseFilterTechnology")
++cpp_quote("DXVA2_NoiseFilterTech_Unsupported")
++cpp_quote("DXVA2_NoiseFilterTech_Unknown")
++cpp_quote("DXVA2_NoiseFilterTech_Median")
++cpp_quote("DXVA2_NoiseFilterTech_Temporal")
++cpp_quote("DXVA2_NoiseFilterTech_BlockNoise")
++cpp_quote("DXVA2_NoiseFilterTech_MosquitoNoise")
++cpp_quote("*/")
++cpp_quote("")
++cpp_quote("/* DetailFilterTechnology")
++cpp_quote("DXVA2_DetailFilterTech_Unsupported")
++cpp_quote("DXVA2_DetailFilterTech_Unknown")
++cpp_quote("DXVA2_DetailFilterTech_Edge")
++cpp_quote("DXVA2_DetailFilterTech_Sharpening")
++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;
+ 
+-typedef enum
++#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_SurfaceType_DecoderRenderTarget,
+-    DXVA2_SurfaceType_ProcessorRenderTarget,
+-    DXVA2_SurfaceType_D3DRenderTargetTexture,
+-} DXVA2_SurfaceType;
++  DXVA2_SampleData_RFF             = 1,
++  DXVA2_SampleData_TFF             = 2,
++  DXVA2_SampleData_RFF_TFF_Present = 4,
++  DXVA2_SampleData_Mask            = 0xFFFF
++};
+ 
+-interface IDirectXVideoDecoder;
+-interface IDirectXVideoProcessor;
++#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")
++cpp_quote("#define DXVA2_VideoProcessorRenderTarget 1")
++cpp_quote("#define DXVA2_VideoSoftwareRenderTarget 2")
++cpp_quote("")
++cpp_quote("/* CompressedBufferType */")
++cpp_quote("#define DXVA2_PictureParametersBufferType 0")
++cpp_quote("#define DXVA2_MacroBlockControlBufferType 1")
++cpp_quote("#define DXVA2_ResidualDifferenceBufferType 2")
++cpp_quote("#define DXVA2_DeblockingControlBufferType 3")
++cpp_quote("#define DXVA2_InverseQuantizationMatrixBufferType 4")
++cpp_quote("#define DXVA2_SliceControlBufferType 5")
++cpp_quote("#define DXVA2_BitStreamDateBufferType 6")
++cpp_quote("#define DXVA2_MotionVectorBuffer 7")
++cpp_quote("#define DXVA2_FilmGrainBuffer 8")
++cpp_quote("")
++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 DXVA2_Fixed32 DXVA2_Fixed32TransparentAlpha (void) {")
++cpp_quote("  DXVA2_Fixed32 f32;")
++cpp_quote("  f32.ll = 0;")
++cpp_quote("  return f32;")
++cpp_quote("}")
++cpp_quote("")
++cpp_quote("__forceinline float DXVA2FixedToFloat (const DXVA2_Fixed32 f32) {")
++cpp_quote("  return (float)f32.Value + (float)f32.Fraction / (1 << 16);")
++cpp_quote("}")
++cpp_quote("")
++cpp_quote("__forceinline DXVA2_Fixed32 DXVA2FloatToFixed (const float f) {")
++cpp_quote("  DXVA2_Fixed32 f32;")
++cpp_quote("  f32.Value    = ((ULONG) (f * (1 << 16))) >> 16;")
++cpp_quote("  f32.Fraction = ((ULONG) (f * (1 << 16))) & 0xFFFF;")
++cpp_quote("  return f32;")
++cpp_quote("}")
++
++cpp_quote("#ifdef _D3D9_H_")
++
++cpp_quote("HRESULT WINAPI DXVA2CreateDirect3DDeviceManager9(UINT *pResetToken,IDirect3DDeviceManager9 **ppDXVAManager);")
++cpp_quote("HRESULT WINAPI DXVA2CreateVideoService(IDirect3DDevice9 *pDD,REFIID riid,void **ppService);")
+ 
+-/*****************************************************************************
+- * IDirect3DDeviceManager9 interface
+- */
+ [
+     object,
+     uuid(a0cade0f-06d5-4cf4-a1c7-f3cdd725aa75),
+@@ -315,37 +473,35 @@ interface IDirectXVideoProcessor;
+ ]
+ interface IDirect3DDeviceManager9 : IUnknown
+ {
+-    HRESULT ResetDevice(
+-        [in] IDirect3DDevice9* pDevice,
+-        [in] UINT resetToken);
+-
+-    HRESULT OpenDeviceHandle(
+-        [out] HANDLE* phDevice);
+-
+-    HRESULT CloseDeviceHandle(
+-        [in] HANDLE hDevice);
+-
+-    HRESULT TestDevice(
+-        [in] HANDLE hDevice);
+-
+-    HRESULT LockDevice(
+-        [in] HANDLE hDevice,
+-        [out] IDirect3DDevice9** ppDevice,
+-        [in] BOOL fBlock);
+-
+-    HRESULT UnlockDevice(
+-        [in] HANDLE hDevice,
+-        [in] BOOL fSaveState);
++    HRESULT ResetDevice([in] IDirect3DDevice9 *pDevice, [in] UINT resetToken);
++    HRESULT OpenDeviceHandle([out] HANDLE *phDevice);
++    HRESULT CloseDeviceHandle([in] HANDLE hDevice);
++    HRESULT TestDevice([in] HANDLE hDevice);
++    HRESULT LockDevice([in] HANDLE hDevice, [out] IDirect3DDevice9 **ppDevice, [in] BOOL fBlock);
++    HRESULT UnlockDevice([in] HANDLE hDevice, [in] BOOL fSaveState);
++    HRESULT GetVideoService([in] HANDLE hDevice, [in] REFIID riid, [out] void **ppService);
++}
+ 
+-    HRESULT GetVideoService(
+-        [in] HANDLE hDevice,
+-        [in] REFIID riid,
+-        [out] void** ppService);
++[
++    object,
++    uuid(f2b0810a-fd00-43c9-918c-df94e2d8ef7d),
++    local
++]
++interface IDirectXVideoDecoder : IUnknown
++{
++    HRESULT GetVideoDecoderService([out] IDirectXVideoDecoderService **ppService);
++    HRESULT GetCreationParameters([out] GUID *pDeviceGuid, [out] DXVA2_VideoDesc *pVideoDesc,
++            [out] DXVA2_ConfigPictureDecode *pConfig,
++            [out, unique, size_is(*pNumSurfaces)] IDirect3DSurface9 ***pDecoderRenderTargets,
++            [out] UINT *pNumSurfaces);
++
++    HRESULT GetBuffer([in] UINT BufferType, [out] void **ppBuffer, [out] UINT *pBufferSize);
++    HRESULT ReleaseBuffer([in] UINT BufferType);
++    HRESULT BeginFrame([in] IDirect3DSurface9 *pRenderTarget, [in] void *pvPVPData);
++    HRESULT EndFrame([out] HANDLE *pHandleComplete);
++    HRESULT Execute([in] const DXVA2_DecodeExecuteParams *pExecuteParams);
+ }
+ 
+-/*****************************************************************************
+- * IDirectXVideoAccelerationService interface
+- */
+ [
+     object,
+     uuid(fc51a550-d5e7-11d9-af55-00054e43ff02),
+@@ -353,21 +509,11 @@ interface IDirect3DDeviceManager9 : IUnknown
+ ]
+ interface IDirectXVideoAccelerationService : IUnknown
+ {
+-    HRESULT CreateSurface(
+-        [in] UINT width,
+-        [in] UINT height,
+-        [in] UINT backBuffers,
+-        [in] D3DFORMAT format,
+-        [in] D3DPOOL pool,
+-        [in] DWORD usage,
+-        [in] DWORD dxvaType,
+-        [out] IDirect3DSurface9 **ppSurface,
+-        [in, out] HANDLE *pSharedHandle);
++    HRESULT CreateSurface([in] UINT Width, [in] UINT Height, [in] UINT BackBuffers, [in] D3DFORMAT Format,
++            [in] D3DPOOL Pool, [in] DWORD Usage, [in] DWORD DxvaType, [out, size_is(BackBuffers+1)] IDirect3DSurface9 **ppSurface,
++            [in, out] HANDLE *pSharedHandle);
+ }
+ 
+-/*****************************************************************************
+- * IDirectXVideoDecoderService interface
+- */
+ [
+     object,
+     uuid(fc51a551-d5e7-11d9-af55-00054e43ff02),
+@@ -375,73 +521,48 @@ interface IDirectXVideoAccelerationService : IUnknown
+ ]
+ interface IDirectXVideoDecoderService : IDirectXVideoAccelerationService
+ {
+-    HRESULT GetDecoderDeviceGuids(
+-        [out] UINT *count,
+-        [out] GUID **pGuids);
+-
+-    HRESULT GetDecoderRenderTargets(
+-        [in] REFGUID guid,
+-        [out] UINT *pCount,
+-        [out] D3DFORMAT **pFormats);
+-
+-    HRESULT GetDecoderConfigurations(
+-        [in] REFGUID guid,
+-        [in] const DXVA2_VideoDesc *pVideoDesc,
+-        [in] IUnknown *pReserved,
+-        [out] UINT *pCount,
+-        [out] DXVA2_ConfigPictureDecode **ppConfigs);
+-
+-    HRESULT CreateVideoDecoder(
+-        [in] REFGUID guid,
+-        [in] const DXVA2_VideoDesc *pVideoDesc,
+-        [in] DXVA2_ConfigPictureDecode *pConfig,
+-        [in] IDirect3DSurface9 **ppDecoderRenderTargets,
+-        [in] UINT NumSurfaces,
+-        [out] IDirectXVideoDecoder **ppDecode);
++    HRESULT GetDecoderDeviceGuids([out] UINT *pCount, [out, unique, size_is(*pCount)] GUID **pGuids);
++
++    HRESULT GetDecoderRenderTargets([in] REFGUID Guid, [out] UINT *pCount, [out, unique, size_is(*pCount)] D3DFORMAT **pFormats);
++
++    HRESULT GetDecoderConfigurations([in] REFGUID Guid, [in] const DXVA2_VideoDesc *pVideoDesc, [in] void *pReserved,
++            [out] UINT *pCount, [out, unique, size_is(*pCount)] DXVA2_ConfigPictureDecode **ppConfigs);
++
++    HRESULT CreateVideoDecoder([in] REFGUID Guid, [in] const DXVA2_VideoDesc *pVideoDesc,
++            [in] const DXVA2_ConfigPictureDecode *pConfig,
++            [in, size_is(NumRenderTargets)] IDirect3DSurface9 **ppDecoderRenderTargets,
++            [in] UINT NumRenderTargets, [out] IDirectXVideoDecoder **ppDecode);
+ }
+ 
+-/*****************************************************************************
+- * IDirectXVideoDecoder interface
+- */
+ [
+     object,
+-    uuid(f2b0810a-fd00-43c9-918c-df94e2d8ef7d),
++    uuid(8c3a39f0-916e-4690-804f-4c8001355d25),
+     local
+ ]
+-interface IDirectXVideoDecoder : IUnknown
++interface IDirectXVideoProcessor : IUnknown
+ {
+-    HRESULT GetVideoDecoderService(
+-        [out] IDirectXVideoDecoderService** ppService);
++    HRESULT GetVideoProcessorService([out] IDirectXVideoProcessorService** ppService);
+ 
+     HRESULT GetCreationParameters(
+         [out] GUID* pDeviceGuid,
+         [out] DXVA2_VideoDesc* pVideoDesc,
+-        [out] DXVA2_ConfigPictureDecode* pConfig,
+-        [out] IDirect3DSurface9*** pDecoderRenderTargets,
+-        [out] UINT* pNumSurfaces);
+-
+-    HRESULT GetBuffer(
+-        [in] UINT BufferType,
+-        [out] void** ppBuffer,
+-        [out] UINT* pBufferSize);
+-
+-    HRESULT ReleaseBuffer(
+-        [in] UINT BufferType);
+-
+-    HRESULT BeginFrame(
++        [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] void* pvPVPData);
+-
+-    HRESULT EndFrame(
++        [in] const DXVA2_VideoProcessBltParams* pBltParams,
++        [in] const DXVA2_VideoSample* pSamples,
++        [in] UINT NumSamples,
+         [out] HANDLE* pHandleComplete);
++};
+ 
+-    HRESULT Execute(
+-        [in] const DXVA2_DecodeExecuteParams* pExecuteParams);
+-}
+-
+-/*****************************************************************************
+- * IDirectXVideoProcessorService interface
+- */
+ [
+     object,
+     uuid(fc51a552-d5e7-11d9-af55-00054e43ff02),
+@@ -449,47 +570,40 @@ interface IDirectXVideoDecoder : IUnknown
+ ]
+ interface IDirectXVideoProcessorService : IDirectXVideoAccelerationService
+ {
+-    HRESULT RegisterVideoProcessorSoftwareDevice(
+-        [in] void* pCallbacks);
++    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] D3DFORMAT RenderTargetFormat,
+         [in] UINT FilterSetting,
+         [out] DXVA2_ValueRange* pRange);
+-
+     HRESULT CreateVideoProcessor(
+         [in] REFGUID VideoProcDeviceGuid,
+         [in] const DXVA2_VideoDesc* pVideoDesc,
+@@ -498,58 +612,6 @@ interface IDirectXVideoProcessorService : IDirectXVideoAccelerationService
+         [out] IDirectXVideoProcessor** ppVidProcess);
+ }
+ 
+-/*****************************************************************************
+- * IDirectXVideoProcessor interface
+- */
+-[
+-    object,
+-    uuid(8c3a39f0-916e-4690-804f-4c8001355d25),
+-    local
+-]
+-interface IDirectXVideoProcessor : IUnknown
+-{
+-    HRESULT GetVideoProcessorService(
+-        [out] IDirectXVideoProcessorService** ppService);
++cpp_quote("#endif /* _D3D9_H_ */")
+ 
+-    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* pHandleCompleteIDirect3DDeviceManager9);
+-}
+-
+-/*****************************************************************************
+- * IDirectXVideoMemoryConfiguration interface
+- */
+-[
+-    object,
+-    uuid(b7f916dd-db3b-49c1-84d7-e45ef99ec726),
+-    local
+-]
+-interface IDirectXVideoMemoryConfiguration : IUnknown
+-{
+-    HRESULT GetAvailableSurfaceTypeByIndex(
+-        [in] DWORD wTypeIndex,
+-        [out] DXVA2_SurfaceType *pdwType);
+-
+-    HRESULT SetSurfaceType(
+-        [in] DXVA2_SurfaceType dwType);
+-}
++cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */")
diff --git a/contrib/src/d3d11/processor_format.patch b/contrib/src/wine-headers/processor_format.patch
similarity index 54%
rename from contrib/src/d3d11/processor_format.patch
rename to contrib/src/wine-headers/processor_format.patch
index ce7bcfd010..b54f82ec0c 100644
--- a/contrib/src/d3d11/processor_format.patch
+++ b/contrib/src/wine-headers/processor_format.patch
@@ -1,6 +1,7 @@
---- a/d3d11.idl	2016-02-26 09:21:48.019575300 +0100
-+++ b/d3d11.idl	2016-02-26 10:41:58.461027900 +0100
-@@ -3199,6 +3199,18 @@ typedef enum D3D11_CREATE_DEVICE_FLAG {
+diff -Naur wine-headers/include/d3d11.idl wine-headers.new/include/d3d11.idl
+--- wine-headers/include/d3d11.idl	2019-03-29 22:25:31.000000000 +0100
++++ wine-headers.new/include/d3d11.idl	2019-04-08 18:42:21.842723245 +0200
+@@ -3793,6 +3793,12 @@
      D3D11_CREATE_DEVICE_VIDEO_SUPPORT   = 0x0800
  } D3D11_CREATE_DEVICE_FLAG;
  
@@ -9,12 +10,6 @@
 +    D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT = 0x00000001,
 +    D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT = 0x00000002,
 +} D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT;
-+
-+typedef struct D3D11_FEATURE_DATA_THREADING
-+{
-+    BOOL DriverConcurrentCreates;
-+    BOOL DriverCommandLists;
-+} D3D11_FEATURE_DATA_THREADING;
 +
  const UINT D3D11_SDK_VERSION = 7;
  
diff --git a/contrib/src/wine-headers/rules.mak b/contrib/src/wine-headers/rules.mak
new file mode 100644
index 0000000000..6a2345c160
--- /dev/null
+++ b/contrib/src/wine-headers/rules.mak
@@ -0,0 +1,57 @@
+# WINE
+WINE_VERSION := 4.5
+WINE_URL := https://dl.winehq.org/wine/source/4.x/wine-$(WINE_VERSION).tar.xz
+
+ifdef HAVE_WIN32
+PKGS += wine-headers
+endif
+
+# Order is important since *_(n).idl will depends on *_(n-1).idl
+WINE_EXTRA_HEADERS =
+WINE_IDL_D3D9_HEADERS =
+WINE_IDL_HEADERS = \
+	d3d11.idl \
+	dxgicommon.idl dxgitype.idl dxgiformat.idl \
+	dxgidebug.idl \
+	dxgi1_2.idl dxgi1_3.idl dxgi1_4.idl dxgi1_5.idl dxgi1_6.idl
+
+ifndef HAVE_VISUALSTUDIO
+WINE_EXTRA_HEADERS += d3d9caps.h d3d9.h
+WINE_IDL_D3D9_HEADERS += dxva2api.idl
+endif
+
+$(TARBALLS)/wine-$(WINE_VERSION).tar.xz:
+	$(call download_pkg,$(WINE_URL),wine)
+
+.sum-wine-headers: wine-$(WINE_VERSION).tar.xz
+
+wine-headers: wine-$(WINE_VERSION).tar.xz .sum-wine-headers
+	$(UNPACK)
+	$(APPLY) $(SRC)/wine-headers/d3d9caps.patch
+	$(APPLY) $(SRC)/wine-headers/d3d9.patch
+	$(APPLY) $(SRC)/wine-headers/dxva2api.patch
+	$(APPLY) $(SRC)/wine-headers/dxgidebug.patch
+	$(APPLY) $(SRC)/wine-headers/processor_format.patch
+	$(MOVE)
+
+wine_widl = echo "GEN $(1)" && \
+	$(WIDL) -DBOOL=WINBOOL $(3) \
+	-I$(PREFIX)/include -Iwine-headers/idl-include \
+	-I`echo $(MSYSTEM) | tr A-Z a-z`/$(BUILD)/include -h \
+	-o "$(PREFIX)/include/$(1)" "wine-headers/idl-include/$(2)"
+
+.wine-headers: wine-headers
+	@mkdir -p $(PREFIX)/include
+	@mkdir -p wine-headers/idl-include
+	@cp wine-headers/include/*.idl  wine-headers/idl-include # be sure to not use .h from the wine project
+	@for header in $(WINE_IDL_HEADERS); do \
+		$(call wine_widl,"`basename $$header idl`h",$$header,); \
+	done
+	@for header in $(WINE_IDL_D3D9_HEADERS); do \
+		$(call wine_widl,"`basename $$header idl`h",$$header,-D_D3D9_H_ -D__C89_NAMELESS); \
+	done
+	@for header in $(WINE_EXTRA_HEADERS); do \
+		echo "CP  $$header"; \
+		cp "wine-headers/include/$$header" "$(PREFIX)/include"; \
+	done
+	touch $@
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 71482648b8..dd6ac8bae6 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -39,16 +39,6 @@
 #include "../../video_chroma/d3d11_fmt.h"
 #include "../../video_filter/deinterlace/common.h"
 
-#ifdef __MINGW32__
-typedef UINT D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS;
-#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND               0x1
-#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB                 0x2
-#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE            0x4
-#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION 0x8
-#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE               0x10
-#define D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION          0x20
-#endif
-
 struct filter_sys_t
 {
     d3d11_handle_t                 hd3d;
-- 
2.17.1





More information about the vlc-devel mailing list