[vlc-devel] [PATCH] contrib: generate the d3d11.h with ID3D11VideoDecoder support

Steve Lhomme robux4 at gmail.com
Sun Jun 7 09:10:02 CEST 2015


Anyone can have a look ?

The D3D11 decoder has been merged in libav, FFMpeg and VLC master. So
it would be useful to build able to build without the Microsoft SDK.

Thanks

On Mon, May 25, 2015 at 4:20 PM, Steve Lhomme <robux4 at gmail.com> wrote:
>
> And also with dxgidebug.h to show leaks
>
> ---
> replaces previous [PATCH 2/3] generate the d3d11.h with ID3D11VideoDecoder
> support
> ---
>  contrib/src/d3d11/dxgidebug.patch          |  51 +++++++
>  contrib/src/d3d11/id3d11videodecoder.patch | 221
> +++++++++++++++++++++++++++++
>  contrib/src/d3d11/rules.mak                |  29 ++++
>  3 files changed, 301 insertions(+)
>  create mode 100644 contrib/src/d3d11/dxgidebug.patch
>  create mode 100644 contrib/src/d3d11/id3d11videodecoder.patch
>  create mode 100644 contrib/src/d3d11/rules.mak
>
> diff --git a/contrib/src/d3d11/dxgidebug.patch
> b/contrib/src/d3d11/dxgidebug.patch
> new file mode 100644
> index 0000000..f12999e
> --- /dev/null
> +++ b/contrib/src/d3d11/dxgidebug.patch
> @@ -0,0 +1,51 @@
> +diff --git a/dxgidebug.idl b/dxgidebug.idl
> +--- /dev/null
> ++++ b/dxgidebug.idl
> +@@ -0,0 +1,44 @@
> ++/*
> ++ * Copyright 2015 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 "oaidl.idl";
> ++
> ++cpp_quote("DEFINE_GUID(DXGI_DEBUG_ALL,   0xe48ae283, 0xda80, 0x490b, 0x87,
> 0xe6, 0x43, 0xe9, 0xa9, 0xcf, 0xda, 0x08);")
> ++cpp_quote("DEFINE_GUID(DXGI_DEBUG_DX,    0x35cdd7fc, 0x13b2, 0x421d, 0xa5,
> 0xd7, 0x7e, 0x44, 0x51, 0x28, 0x7d, 0x64);")
> ++cpp_quote("DEFINE_GUID(DXGI_DEBUG_DXGI,  0x25cddaa4, 0xb1c6, 0x47e1, 0xac,
> 0x3e, 0x98, 0x87, 0x5b, 0x5a, 0x2e, 0x2a);")
> ++cpp_quote("DEFINE_GUID(DXGI_DEBUG_APP,   0x06cd6e01, 0x4219, 0x4ebd, 0x87,
> 0x90, 0x27, 0xed, 0x23, 0x36, 0x0c, 0x62);")
> ++
> ++typedef enum DXGI_DEBUG_RLO_FLAGS {
> ++    DXGI_DEBUG_RLO_SUMMARY         = 0x0001,
> ++    DXGI_DEBUG_RLO_DETAIL          = 0x0002,
> ++    DXGI_DEBUG_RLO_IGNORE_INTERNAL = 0x0004,
> ++    DXGI_DEBUG_RLO_ALL             = 0x0007
> ++} DXGI_DEBUG_RLO_FLAGS;
> ++
> ++[
> ++    object,
> ++    local,
> ++    uuid(119e7452-de9e-40fe-8806-88f90c12b441)
> ++]
> ++interface IDXGIDebug : IUnknown
> ++{
> ++    HRESULT ReportLiveObjects(
> ++        [in] GUID apiid,
> ++        [in] DXGI_DEBUG_RLO_FLAGS flags);
> ++}
> ++
> +--
> +1.9.5.msysgit.0
> +
> diff --git a/contrib/src/d3d11/id3d11videodecoder.patch
> b/contrib/src/d3d11/id3d11videodecoder.patch
> new file mode 100644
> index 0000000..2c68d01
> --- /dev/null
> +++ b/contrib/src/d3d11/id3d11videodecoder.patch
> @@ -0,0 +1,221 @@
> +diff --git a/d3d11.idl b/d3d11.idl
> +--- a/d3d11.idl
> ++++ b/d3d11.idl
> +@@ -2125,6 +2125,214 @@ interface ID3D11Device : IUnknown
> +     UINT GetExceptionMode();
> + }
> +
> ++typedef enum D3D11_VDOV_DIMENSION
> ++{
> ++    D3D11_VDOV_DIMENSION_UNKNOWN = 0,
> ++    D3D11_VDOV_DIMENSION_TEXTURE2D
> ++} D3D11_VDOV_DIMENSION;
> ++
> ++typedef struct D3D11_TEX2D_VDOV
> ++{
> ++    UINT ArraySlice;
> ++} D3D11_TEX2D_VDOV;
> ++
> ++typedef struct D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC
> ++{
> ++    GUID DecodeProfile;
> ++    D3D11_VDOV_DIMENSION ViewDimension;
> ++
> ++    union
> ++    {
> ++        D3D11_TEX2D_VDOV Texture2D;
> ++    };
> ++} D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC;
> ++
> ++[
> ++    object,
> ++    local,
> ++    uuid(c2931aea-2a85-4f20-860f-fba1fd256e18)
> ++]
> ++interface ID3D11VideoDecoderOutputView : ID3D11View
> ++{
> ++    void GetDesc(
> ++        [out] D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC *pDesc );
> ++}
> ++
> ++[
> ++    object,
> ++    local,
> ++    uuid(3c9c5b51-995d-48d1-9b8d-fa5caeded65c)
> ++]
> ++interface ID3D11VideoDecoder : ID3D11DeviceChild
> ++{
> ++}
> ++
> ++typedef enum D3D11_VIDEO_DECODER_BUFFER_TYPE
> ++{
> ++    D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS = 0,
> ++    D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL,
> ++    D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE,
> ++    D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL,
> ++    D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX,
> ++    D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL,
> ++    D3D11_VIDEO_DECODER_BUFFER_BITSTREAM,
> ++    D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR,
> ++    D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN
> ++} D3D11_VIDEO_DECODER_BUFFER_TYPE;
> ++
> ++typedef struct D3D11_ENCRYPTED_BLOCK_INFO
> ++{
> ++    UINT NumEncryptedBytesAtBeginning;
> ++    UINT NumBytesInSkipPattern;
> ++    UINT NumBytesInEncryptPattern;
> ++} D3D11_ENCRYPTED_BLOCK_INFO;
> ++
> ++typedef struct D3D11_VIDEO_DECODER_BUFFER_DESC
> ++{
> ++    D3D11_VIDEO_DECODER_BUFFER_TYPE BufferType;
> ++    UINT BufferIndex;
> ++    UINT DataOffset;
> ++    UINT DataSize;
> ++    UINT FirstMBaddress;
> ++    UINT NumMBsInBuffer;
> ++    UINT Width;
> ++    UINT Height;
> ++    UINT Stride;
> ++    UINT ReservedBits;
> ++    void *pIV;
> ++    UINT IVSize;
> ++    BOOL PartialEncryption;
> ++    D3D11_ENCRYPTED_BLOCK_INFO EncryptedBlockInfo;
> ++} D3D11_VIDEO_DECODER_BUFFER_DESC;
> ++
> ++[
> ++    object,
> ++    local,
> ++    uuid(61f21c45-3c0e-4a74-9cea-67100d9ad5e4)
> ++]
> ++interface ID3D11VideoContext : ID3D11DeviceChild
> ++{
> ++    HRESULT GetDecoderBuffer(
> ++        [in] ID3D11VideoDecoder *pDecoder,
> ++        [in] D3D11_VIDEO_DECODER_BUFFER_TYPE BufferType,
> ++        [out] UINT *pBufferSize,
> ++        [out] void **ppBuffer);
> ++    HRESULT ReleaseDecoderBuffer(
> ++        [in] ID3D11VideoDecoder *pDecoder,
> ++        [in] D3D11_VIDEO_DECODER_BUFFER_TYPE BufferType);
> ++    HRESULT DecoderBeginFrame(
> ++        [in] ID3D11VideoDecoder *pDecoder,
> ++        [in] ID3D11VideoDecoderOutputView *pVideoDecoderOutputView,
> ++        [in] UINT ContentKeySize,
> ++        [in] const void *pContentKey);
> ++    HRESULT DecoderEndFrame(
> ++        [in] ID3D11VideoDecoder *pDecoder);
> ++    HRESULT SubmitDecoderBuffers(
> ++        [in] ID3D11VideoDecoder *pDecoder,
> ++        [in] UINT NumBuffers,
> ++        [in] const D3D11_VIDEO_DECODER_BUFFER_DESC *pBufferDesc);
> ++}
> ++
> ++typedef struct D3D11_VIDEO_DECODER_DESC
> ++{
> ++    GUID Guid;
> ++    UINT SampleWidth;
> ++    UINT SampleHeight;
> ++    DXGI_FORMAT OutputFormat;
> ++} D3D11_VIDEO_DECODER_DESC;
> ++
> ++typedef struct D3D11_VIDEO_DECODER_CONFIG
> ++{
> ++    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;
> ++} D3D11_VIDEO_DECODER_CONFIG;
> ++
> ++typedef enum D3D11_AUTHENTICATED_CHANNEL_TYPE
> ++{
> ++    D3D11_AUTHENTICATED_CHANNEL_D3D11 = 1,
> ++    D3D11_AUTHENTICATED_CHANNEL_DRIVER_SOFTWARE,
> ++    D3D11_AUTHENTICATED_CHANNEL_DRIVER_HARDWARE
> ++} D3D11_AUTHENTICATED_CHANNEL_TYPE;
> ++
> ++interface ID3D11VideoProcessorEnumerator;
> ++interface ID3D11VideoProcessor;
> ++interface ID3D11VideoProcessorInputView;
> ++interface ID3D11VideoProcessorOutputView;
> ++interface ID3D11AuthenticatedChannel;
> ++interface ID3D11CryptoSession;
> ++
> ++[
> ++    object,
> ++    local,
> ++    uuid(10ec4d5b-975a-4689-b9e4-d0aac30fe333)
> ++]
> ++interface ID3D11VideoDevice : IUnknown
> ++{
> ++    HRESULT CreateVideoDecoder(
> ++        [in] const D3D11_VIDEO_DECODER_DESC *pVideoDesc,
> ++        [in] const D3D11_VIDEO_DECODER_CONFIG *pConfig,
> ++        [out] ID3D11VideoDecoder **ppVideoDecoder);
> ++    HRESULT CreateVideoProcessor(
> ++        [in] ID3D11VideoProcessorEnumerator *ppProcEnumerator,
> ++        [in] UINT RateConversionIndex,
> ++        [out] ID3D11VideoProcessor **ppVideoProcessor);
> ++    HRESULT CreateAuthenticatedChannel(
> ++        [in] D3D11_AUTHENTICATED_CHANNEL_TYPE ChannelType,
> ++        [out] ID3D11AuthenticatedChannel **ppAuthenticatedChannel);
> ++    HRESULT CreateCryptoSession(
> ++        [in] const GUID *pCryptoType,
> ++        [in] const GUID *pDecoderProfile,
> ++        [in] const GUID *pKeyExchangeType,
> ++        [out] ID3D11CryptoSession **ppCryptoSession);
> ++    HRESULT CreateVideoDecoderOutputView(
> ++        [in] ID3D11Resource *pResource,
> ++        [in] const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC *pDesc,
> ++        [out] ID3D11VideoDecoderOutputView **ppVideoDecoderOutputView);
> ++    HRESULT CreateVideoProcessorInputView(
> ++        [in] ID3D11Resource *pResource,
> ++        [in] ID3D11VideoProcessorEnumerator *ppProcEnumerator,
> ++        [in] const void *pInputDesc,   /*
> D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC */
> ++        [out] ID3D11VideoProcessorInputView **ppVideoProcInputView);
> ++    HRESULT CreateVideoProcessorOutputView(
> ++        [in] ID3D11Resource *pResource,
> ++        [in] ID3D11VideoProcessorEnumerator *pEnumerator,
> ++        [in] const void *pOutputDesc,  /*
> D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC */
> ++        [out] ID3D11VideoProcessorOutputView **ppVideoProcOutputView);
> ++    HRESULT CreateVideoProcessorEnumerator(
> ++        [in] const void *pContentDesc, /*
> D3D11_VIDEO_PROCESSOR_CONTENT_DESC */
> ++        [out] ID3D11VideoProcessorEnumerator **ppProcEnumerator);
> ++    UINT GetVideoDecoderProfileCount(void);
> ++    HRESULT GetVideoDecoderProfile(
> ++        [in] UINT DecoderIndex,
> ++        [out] GUID *pDecoderProfile);
> ++    HRESULT CheckVideoDecoderFormat(
> ++        [in] const GUID *pDecoderProfile,
> ++        [in] DXGI_FORMAT Format,
> ++        [out] BOOL *pSupported);
> ++    HRESULT GetVideoDecoderConfigCount(
> ++        [in] const D3D11_VIDEO_DECODER_DESC *pDesc,
> ++        [out] UINT *pCount);
> ++    HRESULT GetVideoDecoderConfig(
> ++        [in] const D3D11_VIDEO_DECODER_DESC *pDesc,
> ++        [in] UINT DecoderIndex,
> ++        [out] D3D11_VIDEO_DECODER_CONFIG *pConfig);
> ++}
> ++
> + typedef enum D3D11_CREATE_DEVICE_FLAG {
> +     D3D11_CREATE_DEVICE_SINGLETHREADED  = 0x0001,
> +     D3D11_CREATE_DEVICE_DEBUG           = 0x0002,
> +--
> +1.9.5.msysgit.0
> +
> diff --git a/contrib/src/d3d11/rules.mak b/contrib/src/d3d11/rules.mak
> new file mode 100644
> index 0000000..21b26f6
> --- /dev/null
> +++ b/contrib/src/d3d11/rules.mak
> @@ -0,0 +1,29 @@
> +# generate Direct3D11 temporary include
> +
> +#ugly way to get the default location of standard idl files
> +IDL_INC_PATH = /`echo $(MSYSTEM) | tr A-Z a-z`/$(BUILD)/include
> +
> +D3D11_IDL_URL :=
> http://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/direct-x/include/d3d11.idl?format=raw
> +DST_D3D11_H = $(PREFIX)/include/d3d11.h
> +DST_DXGIDEBUG_H = $(PREFIX)/include/dxgidebug.h
> +
> +
> +ifdef HAVE_WIN32
> +PKGS += d3d11
> +endif
> +
> +$(TARBALLS)/d3d11.idl:
> +    $(call download,$(D3D11_IDL_URL))
> +    (cd $(TARBALLS) && patch -fp1) < $(SRC)/d3d11/id3d11videodecoder.patch
> +
> +$(TARBALLS)/dxgidebug.idl:
> +    (cd $(TARBALLS) && patch -fp1) < $(SRC)/d3d11/dxgidebug.patch
> +
> +$(DST_D3D11_H): $(TARBALLS)/d3d11.idl
> +    widl -DBOOL=WINBOOL -I$(IDL_INC_PATH) -h -o $@ $<
> +
> +$(DST_DXGIDEBUG_H): $(TARBALLS)/dxgidebug.idl
> +    widl -DBOOL=WINBOOL -I$(IDL_INC_PATH) -h -o $@ $<
> +
> +.d3d11: $(DST_D3D11_H) $(DST_DXGIDEBUG_H)
> +    touch $@
> --
> 1.9.5.msysgit.0
>



More information about the vlc-devel mailing list