[vlc-commits] contrib: d3d9: patch dxva2api.idl to get IDirectXVideoProcessor

Steve Lhomme git at videolan.org
Thu Apr 13 15:35:16 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Tue Apr 11 15:00:35 2017 +0200| [19e241e89372f2089675ff80bda7128d3766e8ea] | committer: Jean-Baptiste Kempf

contrib: d3d9: patch dxva2api.idl to get IDirectXVideoProcessor

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=19e241e89372f2089675ff80bda7128d3766e8ea
---

 contrib/src/d3d9/SHA512SUMS     |   1 +
 contrib/src/d3d9/dxva2api.patch | 316 ++++++++++++++++++++++++++++++++++++++++
 contrib/src/d3d9/rules.mak      |  23 ++-
 3 files changed, 336 insertions(+), 4 deletions(-)

diff --git a/contrib/src/d3d9/SHA512SUMS b/contrib/src/d3d9/SHA512SUMS
index d5090c8d06..cf4fe86865 100644
--- a/contrib/src/d3d9/SHA512SUMS
+++ b/contrib/src/d3d9/SHA512SUMS
@@ -1,2 +1,3 @@
 81ee35501f7657dee19bc24f94af15a34a61b84fd0855a4ff91ab95b0e16ec163594e64accde1acdd289a07b8cd9c0cd640cbcbc87b11bebd92e4db841da80aa  d3d9caps.h
 42cfe1b2234065e4ce712f806370d0acbdf9bb4e4dd74859f21fd7e7428eabca9b5607c03aba57d3994d0946722d1837a454891a2e7f8242d353f29bb6a80d55  d3d9.h
+dda26118ad53e99cd8533b773fa2a38f7a184af8b68c797d0efa3256abc80f0d3c304b12601933eff79ed6c67f6f2fce40e31eadfb7ccf27ca2a297f465c113b  dxva2api.idl
diff --git a/contrib/src/d3d9/dxva2api.patch b/contrib/src/d3d9/dxva2api.patch
new file mode 100644
index 0000000000..951ffb83ae
--- /dev/null
+++ b/contrib/src/d3d9/dxva2api.patch
@@ -0,0 +1,316 @@
+--- ../tarballs/dxva2api.idl	2017-04-11 14:13:48.105355400 +0200
++++ dxva2api/dxva2api.idl	2017-04-11 14:59:17.092294600 +0200
+@@ -15,11 +15,12 @@
+ cpp_quote("#endif")
+ 
+ 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 +143,19 @@
+ 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 +220,40 @@
+   };
+ } 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 +318,60 @@
+ 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("/* 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")
+@@ -481,4 +485,82 @@
+             [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_ */")
diff --git a/contrib/src/d3d9/rules.mak b/contrib/src/d3d9/rules.mak
index 69b4488854..62307dcb0b 100644
--- a/contrib/src/d3d9/rules.mak
+++ b/contrib/src/d3d9/rules.mak
@@ -8,16 +8,20 @@ IDL_INC_PATH = /`echo $(MSYSTEM) | tr A-Z a-z`/$(BUILD)/include
 endif
 
 D3D9CAPS_COMMIT_ID := 477108e5706e73421634436c21cb76e1795b3609
-D3D9_H_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,$(D3D9CAPS_H_URL))
@@ -25,7 +29,10 @@ $(TARBALLS)/d3d9caps.h:
 $(TARBALLS)/d3d9.h:
 	$(call download,$(D3D9_H_URL))
 
-.sum-d3d9: $(TARBALLS)/d3d9caps.h $(TARBALLS)/d3d9.h
+$(TARBALLS)/dxva2api.idl:
+	$(call download,$(DXVA2API_IDL_URL))
+
+.sum-d3d9: $(TARBALLS)/d3d9caps.h $(TARBALLS)/d3d9.h $(TARBALLS)/dxva2api.idl
 
 $(DST_D3D9CAPS_H): $(TARBALLS)/d3d9caps.h .sum-d3d9
 	mkdir -p -- "$(PREFIX)/include/"
@@ -35,8 +42,16 @@ $(DST_D3D9_H): $(TARBALLS)/d3d9.h .sum-d3d9
 	mkdir -p -- "$(PREFIX)/include/"
 	cp $(TARBALLS)/d3d9.h $@ && cd "$(PREFIX)/include/" && patch -fp1 < ../$(SRC)/d3d9/d3d9.patch
 
+dxva2api: .sum-d3d9
+	mkdir -p $@
+	cp $(TARBALLS)/dxva2api.idl $@ && cd $@ && patch -fp1 < ../$(SRC)/d3d9/dxva2api.patch
+
+$(DST_DXVA2API_H): dxva2api
+	mkdir -p -- "$(PREFIX)/include/"
+	$(WIDL) -DBOOL=WINBOOL -D_D3D9_H_ -D__C89_NAMELESS -I$(IDL_INC_PATH) -h -o $@ $</dxva2api.idl
+
 .d3d9caps: $(DST_D3D9CAPS_H)
 	touch $@
-    
-.d3d9: $(DST_D3D9_H) $(DST_D3D9CAPS_H)
+
+.d3d9: $(DST_D3D9_H) $(DST_D3D9CAPS_H) $(DST_DXVA2API_H)
 	touch $@



More information about the vlc-commits mailing list