summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_dxva2.h (plain)
blob: 6c36cb4b6b437dc1115000dc2088feaa6df0bd4d
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20#ifndef AVUTIL_HWCONTEXT_DXVA2_H
21#define AVUTIL_HWCONTEXT_DXVA2_H
22
23/**
24 * @file
25 * An API-specific header for AV_HWDEVICE_TYPE_DXVA2.
26 *
27 * Only fixed-size pools are supported.
28 *
29 * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
30 * with the data pointer set to a pointer to IDirect3DSurface9.
31 */
32
33#include <d3d9.h>
34#include <dxva2api.h>
35
36/**
37 * This struct is allocated as AVHWDeviceContext.hwctx
38 */
39typedef struct AVDXVA2DeviceContext {
40 IDirect3DDeviceManager9 *devmgr;
41} AVDXVA2DeviceContext;
42
43/**
44 * This struct is allocated as AVHWFramesContext.hwctx
45 */
46typedef struct AVDXVA2FramesContext {
47 /**
48 * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or
49 * DXVA2_VideoDecoderRenderTarget). Must be set by the caller.
50 */
51 DWORD surface_type;
52
53 /**
54 * The surface pool. When an external pool is not provided by the caller,
55 * this will be managed (allocated and filled on init, freed on uninit) by
56 * libavutil.
57 */
58 IDirect3DSurface9 **surfaces;
59 int nb_surfaces;
60
61 /**
62 * Certain drivers require the decoder to be destroyed before the surfaces.
63 * To allow internally managed pools to work properly in such cases, this
64 * field is provided.
65 *
66 * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on
67 * it just before the internal surface pool is freed.
68 */
69 IDirectXVideoDecoder *decoder_to_release;
70} AVDXVA2FramesContext;
71
72#endif /* AVUTIL_HWCONTEXT_DXVA2_H */
73