Path: blob/master/dep/ffmpeg/include/libavutil/hwcontext_d3d11va.h
4216 views
/*1* This file is part of FFmpeg.2*3* FFmpeg is free software; you can redistribute it and/or4* modify it under the terms of the GNU Lesser General Public5* License as published by the Free Software Foundation; either6* version 2.1 of the License, or (at your option) any later version.7*8* FFmpeg is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11* Lesser General Public License for more details.12*13* You should have received a copy of the GNU Lesser General Public14* License along with FFmpeg; if not, write to the Free Software15* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA16*/1718#ifndef AVUTIL_HWCONTEXT_D3D11VA_H19#define AVUTIL_HWCONTEXT_D3D11VA_H2021/**22* @file23* An API-specific header for AV_HWDEVICE_TYPE_D3D11VA.24*25* The default pool implementation will be fixed-size if initial_pool_size is26* set (and allocate elements from an array texture). Otherwise it will allocate27* individual textures. Be aware that decoding requires a single array texture.28*29* Using sw_format==AV_PIX_FMT_YUV420P has special semantics, and maps to30* DXGI_FORMAT_420_OPAQUE. av_hwframe_transfer_data() is not supported for31* this format. Refer to MSDN for details.32*33* av_hwdevice_ctx_create() for this device type supports a key named "debug"34* for the AVDictionary entry. If this is set to any value, the device creation35* code will try to load various supported D3D debugging layers.36*/3738#include <d3d11.h>39#include <stdint.h>4041/**42* This struct is allocated as AVHWDeviceContext.hwctx43*/44typedef struct AVD3D11VADeviceContext {45/**46* Device used for texture creation and access. This can also be used to47* set the libavcodec decoding device.48*49* Must be set by the user. This is the only mandatory field - the other50* device context fields are set from this and are available for convenience.51*52* Deallocating the AVHWDeviceContext will always release this interface,53* and it does not matter whether it was user-allocated.54*/55ID3D11Device *device;5657/**58* If unset, this will be set from the device field on init.59*60* Deallocating the AVHWDeviceContext will always release this interface,61* and it does not matter whether it was user-allocated.62*/63ID3D11DeviceContext *device_context;6465/**66* If unset, this will be set from the device field on init.67*68* Deallocating the AVHWDeviceContext will always release this interface,69* and it does not matter whether it was user-allocated.70*/71ID3D11VideoDevice *video_device;7273/**74* If unset, this will be set from the device_context field on init.75*76* Deallocating the AVHWDeviceContext will always release this interface,77* and it does not matter whether it was user-allocated.78*/79ID3D11VideoContext *video_context;8081/**82* Callbacks for locking. They protect accesses to device_context and83* video_context calls. They also protect access to the internal staging84* texture (for av_hwframe_transfer_data() calls). They do NOT protect85* access to hwcontext or decoder state in general.86*87* If unset on init, the hwcontext implementation will set them to use an88* internal mutex.89*90* The underlying lock must be recursive. lock_ctx is for free use by the91* locking implementation.92*/93void (*lock)(void *lock_ctx);94void (*unlock)(void *lock_ctx);95void *lock_ctx;96} AVD3D11VADeviceContext;9798/**99* D3D11 frame descriptor for pool allocation.100*101* In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs102* with the data pointer pointing at an object of this type describing the103* planes of the frame.104*105* This has no use outside of custom allocation, and AVFrame AVBufferRef do not106* necessarily point to an instance of this struct.107*/108typedef struct AVD3D11FrameDescriptor {109/**110* The texture in which the frame is located. The reference count is111* managed by the AVBufferRef, and destroying the reference will release112* the interface.113*114* Normally stored in AVFrame.data[0].115*/116ID3D11Texture2D *texture;117118/**119* The index into the array texture element representing the frame, or 0120* if the texture is not an array texture.121*122* Normally stored in AVFrame.data[1] (cast from intptr_t).123*/124intptr_t index;125} AVD3D11FrameDescriptor;126127/**128* This struct is allocated as AVHWFramesContext.hwctx129*/130typedef struct AVD3D11VAFramesContext {131/**132* The canonical texture used for pool allocation. If this is set to NULL133* on init, the hwframes implementation will allocate and set an array134* texture if initial_pool_size > 0.135*136* The only situation when the API user should set this is:137* - the user wants to do manual pool allocation (setting138* AVHWFramesContext.pool), instead of letting AVHWFramesContext139* allocate the pool140* - of an array texture141* - and wants it to use it for decoding142* - this has to be done before calling av_hwframe_ctx_init()143*144* Deallocating the AVHWFramesContext will always release this interface,145* and it does not matter whether it was user-allocated.146*147* This is in particular used by the libavcodec D3D11VA hwaccel, which148* requires a single array texture. It will create ID3D11VideoDecoderOutputView149* objects for each array texture element on decoder initialization.150*/151ID3D11Texture2D *texture;152153/**154* D3D11_TEXTURE2D_DESC.BindFlags used for texture creation. The user must155* at least set D3D11_BIND_DECODER if the frames context is to be used for156* video decoding.157* This field is ignored/invalid if a user-allocated texture is provided.158*/159UINT BindFlags;160161/**162* D3D11_TEXTURE2D_DESC.MiscFlags used for texture creation.163* This field is ignored/invalid if a user-allocated texture is provided.164*/165UINT MiscFlags;166167/**168* In case if texture structure member above is not NULL contains the same texture169* pointer for all elements and different indexes into the array texture.170* In case if texture structure member above is NULL, all elements contains171* pointers to separate non-array textures and 0 indexes.172* This field is ignored/invalid if a user-allocated texture is provided.173*/174AVD3D11FrameDescriptor *texture_infos;175} AVD3D11VAFramesContext;176177#endif /* AVUTIL_HWCONTEXT_D3D11VA_H */178179180