FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
hwcontext_d3d11va.c File Reference
#include "config.h"
#include <windows.h>
#include "thread.h"
#include <initguid.h>
#include <d3d11.h>
#include <dxgi1_2.h>
#include "avassert.h"
#include "common.h"
#include "hwcontext.h"
#include "hwcontext_d3d11va.h"
#include "hwcontext_internal.h"
#include "imgutils.h"
#include "pixdesc.h"
#include "pixfmt.h"

Go to the source code of this file.

Data Structures

struct  D3D11VAFramesContext
 

Macros

#define _WIN32_WINNT   0x0600
 
#define COBJMACROS
 

Typedefs

typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY )(REFIID riid, void **ppFactory)
 

Functions

static av_cold void load_functions (void)
 
static void d3d11va_default_lock (void *ctx)
 
static void d3d11va_default_unlock (void *ctx)
 
static void d3d11va_frames_uninit (AVHWFramesContext *ctx)
 
static void free_texture (void *opaque, uint8_t *data)
 
static AVBufferRefwrap_texture_buf (ID3D11Texture2D *tex, int index)
 
static AVBufferRefd3d11va_alloc_single (AVHWFramesContext *ctx)
 
static AVBufferRefd3d11va_pool_alloc (void *opaque, int size)
 
static int d3d11va_frames_init (AVHWFramesContext *ctx)
 
static int d3d11va_get_buffer (AVHWFramesContext *ctx, AVFrame *frame)
 
static int d3d11va_transfer_get_formats (AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
 
static int d3d11va_create_staging_texture (AVHWFramesContext *ctx)
 
static void fill_texture_ptrs (uint8_t *data[4], int linesize[4], AVHWFramesContext *ctx, D3D11_TEXTURE2D_DESC *desc, D3D11_MAPPED_SUBRESOURCE *map)
 
static int d3d11va_transfer_data (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
 
static int d3d11va_device_init (AVHWDeviceContext *hwdev)
 
static void d3d11va_device_uninit (AVHWDeviceContext *hwdev)
 
static int d3d11va_device_create (AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags)
 

Variables

static AVOnce functions_loaded = AV_ONCE_INIT
 
static PFN_CREATE_DXGI_FACTORY mCreateDXGIFactory
 
static PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice
 
struct {
   DXGI_FORMAT   d3d_format
 
   enum AVPixelFormat   pix_fmt
 
supported_formats []
 
const HWContextType ff_hwcontext_type_d3d11va
 

Macro Definition Documentation

#define _WIN32_WINNT   0x0600

Definition at line 29 of file hwcontext_d3d11va.c.

#define COBJMACROS

Definition at line 31 of file hwcontext_d3d11va.c.

Typedef Documentation

typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory)

Definition at line 50 of file hwcontext_d3d11va.c.

Function Documentation

static av_cold void load_functions ( void  )
static

Definition at line 57 of file hwcontext_d3d11va.c.

Referenced by d3d11va_device_create().

static void d3d11va_default_lock ( void ctx)
static

Definition at line 99 of file hwcontext_d3d11va.c.

Referenced by d3d11va_device_init(), and d3d11va_device_uninit().

static void d3d11va_default_unlock ( void ctx)
static

Definition at line 104 of file hwcontext_d3d11va.c.

Referenced by d3d11va_device_init().

static void d3d11va_frames_uninit ( AVHWFramesContext ctx)
static

Definition at line 109 of file hwcontext_d3d11va.c.

static void free_texture ( void opaque,
uint8_t data 
)
static

Definition at line 123 of file hwcontext_d3d11va.c.

Referenced by wrap_texture_buf().

static AVBufferRef* wrap_texture_buf ( ID3D11Texture2D *  tex,
int  index 
)
static

Definition at line 128 of file hwcontext_d3d11va.c.

Referenced by d3d11va_alloc_single(), and d3d11va_pool_alloc().

static AVBufferRef* d3d11va_alloc_single ( AVHWFramesContext ctx)
static

Definition at line 150 of file hwcontext_d3d11va.c.

Referenced by d3d11va_pool_alloc().

static AVBufferRef* d3d11va_pool_alloc ( void opaque,
int  size 
)
static

Definition at line 178 of file hwcontext_d3d11va.c.

Referenced by d3d11va_frames_init().

static int d3d11va_frames_init ( AVHWFramesContext ctx)
static

Definition at line 199 of file hwcontext_d3d11va.c.

static int d3d11va_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 259 of file hwcontext_d3d11va.c.

static int d3d11va_transfer_get_formats ( AVHWFramesContext ctx,
enum AVHWFrameTransferDirection  dir,
enum AVPixelFormat **  formats 
)
static

Definition at line 278 of file hwcontext_d3d11va.c.

static int d3d11va_create_staging_texture ( AVHWFramesContext ctx)
static

Definition at line 301 of file hwcontext_d3d11va.c.

Referenced by d3d11va_transfer_data().

static void fill_texture_ptrs ( uint8_t data[4],
int  linesize[4],
AVHWFramesContext ctx,
D3D11_TEXTURE2D_DESC *  desc,
D3D11_MAPPED_SUBRESOURCE *  map 
)
static

Definition at line 326 of file hwcontext_d3d11va.c.

Referenced by d3d11va_transfer_data().

static int d3d11va_transfer_data ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 340 of file hwcontext_d3d11va.c.

static int d3d11va_device_init ( AVHWDeviceContext hwdev)
static

Definition at line 418 of file hwcontext_d3d11va.c.

static void d3d11va_device_uninit ( AVHWDeviceContext hwdev)
static

Definition at line 456 of file hwcontext_d3d11va.c.

static int d3d11va_device_create ( AVHWDeviceContext ctx,
const char *  device,
AVDictionary opts,
int  flags 
)
static

Definition at line 476 of file hwcontext_d3d11va.c.

Variable Documentation

AVOnce functions_loaded = AV_ONCE_INIT
static

Definition at line 52 of file hwcontext_d3d11va.c.

Referenced by d3d11va_device_create().

PFN_CREATE_DXGI_FACTORY mCreateDXGIFactory
static

Definition at line 54 of file hwcontext_d3d11va.c.

Referenced by d3d11va_device_create(), and load_functions().

PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice
static

Definition at line 55 of file hwcontext_d3d11va.c.

Referenced by d3d11va_device_create(), and load_functions().

DXGI_FORMAT d3d_format

Definition at line 89 of file hwcontext_d3d11va.c.

Referenced by txd_decode_frame().

enum AVPixelFormat pix_fmt

Definition at line 90 of file hwcontext_d3d11va.c.

const { ... } supported_formats[]
Initial value:
= {
{ DXGI_FORMAT_NV12, AV_PIX_FMT_NV12 },
{ DXGI_FORMAT_P010, AV_PIX_FMT_P010 },
{ DXGI_FORMAT_420_OPAQUE, AV_PIX_FMT_YUV420P },
}
#define AV_PIX_FMT_P010
Definition: pixfmt.h:424
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:90
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62

Referenced by d3d11va_frames_init().

const HWContextType ff_hwcontext_type_d3d11va
Initial value:
= {
.name = "D3D11VA",
.device_hwctx_size = sizeof(AVD3D11VADeviceContext),
.frames_hwctx_size = sizeof(AVD3D11VAFramesContext),
.frames_priv_size = sizeof(D3D11VAFramesContext),
.device_create = d3d11va_device_create,
.device_uninit = d3d11va_device_uninit,
.frames_init = d3d11va_frames_init,
.frames_uninit = d3d11va_frames_uninit,
.frames_get_buffer = d3d11va_get_buffer,
.transfer_get_formats = d3d11va_transfer_get_formats,
.transfer_data_to = d3d11va_transfer_data,
.transfer_data_from = d3d11va_transfer_data,
}
static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pixelformat)
Definition: v4l2.c:188
static void d3d11va_device_uninit(AVHWDeviceContext *hwdev)
static int d3d11va_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
static void d3d11va_frames_uninit(AVHWFramesContext *ctx)
static int d3d11va_device_init(AVHWDeviceContext *hwdev)
static int d3d11va_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
static int d3d11va_frames_init(AVHWFramesContext *ctx)
static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags)
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
This struct is allocated as AVHWFramesContext.hwctx.
Hardware surfaces for Direct3D11.
Definition: pixfmt.h:327
This struct is allocated as AVHWDeviceContext.hwctx.
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 549 of file hwcontext_d3d11va.c.