FFmpeg
hwcontext_vaapi.h
Go to the documentation of this file.
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 #ifndef AVUTIL_HWCONTEXT_VAAPI_H
20 #define AVUTIL_HWCONTEXT_VAAPI_H
21 
22 #include <va/va.h>
23 
24 /**
25  * @file
26  * API-specific header for AV_HWDEVICE_TYPE_VAAPI.
27  *
28  * Dynamic frame pools are supported, but note that any pool used as a render
29  * target is required to be of fixed size in order to be be usable as an
30  * argument to vaCreateContext().
31  *
32  * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
33  * with the data pointer set to a VASurfaceID.
34  */
35 
36 enum {
37  /**
38  * The quirks field has been set by the user and should not be detected
39  * automatically by av_hwdevice_ctx_init().
40  */
42  /**
43  * The driver does not destroy parameter buffers when they are used by
44  * vaRenderPicture(). Additional code will be required to destroy them
45  * separately afterwards.
46  */
48 
49  /**
50  * The driver does not support the VASurfaceAttribMemoryType attribute,
51  * so the surface allocation code will not try to use it.
52  */
54 
55  /**
56  * The driver does not support surface attributes at all.
57  * The surface allocation code will never pass them to surface allocation,
58  * and the results of the vaQuerySurfaceAttributes() call will be faked.
59  */
61 };
62 
63 /**
64  * VAAPI connection details.
65  *
66  * Allocated as AVHWDeviceContext.hwctx
67  */
68 typedef struct AVVAAPIDeviceContext {
69  /**
70  * The VADisplay handle, to be filled by the user.
71  */
72  VADisplay display;
73  /**
74  * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
75  * with reference to a table of known drivers, unless the
76  * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
77  * may need to refer to this field when performing any later
78  * operations using VAAPI with the same VADisplay.
79  */
80  unsigned int driver_quirks;
82 
83 /**
84  * VAAPI-specific data associated with a frame pool.
85  *
86  * Allocated as AVHWFramesContext.hwctx.
87  */
88 typedef struct AVVAAPIFramesContext {
89  /**
90  * Set by the user to apply surface attributes to all surfaces in
91  * the frame pool. If null, default settings are used.
92  */
93  VASurfaceAttrib *attributes;
95  /**
96  * The surfaces IDs of all surfaces in the pool after creation.
97  * Only valid if AVHWFramesContext.initial_pool_size was positive.
98  * These are intended to be used as the render_targets arguments to
99  * vaCreateContext().
100  */
101  VASurfaceID *surface_ids;
104 
105 /**
106  * VAAPI hardware pipeline configuration details.
107  *
108  * Allocated with av_hwdevice_hwconfig_alloc().
109  */
110 typedef struct AVVAAPIHWConfig {
111  /**
112  * ID of a VAAPI pipeline configuration.
113  */
114  VAConfigID config_id;
116 
117 #endif /* AVUTIL_HWCONTEXT_VAAPI_H */
AVVAAPIFramesContext::attributes
VASurfaceAttrib * attributes
Set by the user to apply surface attributes to all surfaces in the frame pool.
Definition: hwcontext_vaapi.h:93
AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE
@ AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE
The driver does not support the VASurfaceAttribMemoryType attribute, so the surface allocation code w...
Definition: hwcontext_vaapi.h:53
AVVAAPIHWConfig
VAAPI hardware pipeline configuration details.
Definition: hwcontext_vaapi.h:110
AVVAAPIDeviceContext::driver_quirks
unsigned int driver_quirks
Driver quirks to apply - this is filled by av_hwdevice_ctx_init(), with reference to a table of known...
Definition: hwcontext_vaapi.h:80
AVVAAPIDeviceContext::display
VADisplay display
The VADisplay handle, to be filled by the user.
Definition: hwcontext_vaapi.h:72
AVVAAPIHWConfig::config_id
VAConfigID config_id
ID of a VAAPI pipeline configuration.
Definition: hwcontext_vaapi.h:114
AVVAAPIFramesContext::surface_ids
VASurfaceID * surface_ids
The surfaces IDs of all surfaces in the pool after creation.
Definition: hwcontext_vaapi.h:101
AV_VAAPI_DRIVER_QUIRK_USER_SET
@ AV_VAAPI_DRIVER_QUIRK_USER_SET
The quirks field has been set by the user and should not be detected automatically by av_hwdevice_ctx...
Definition: hwcontext_vaapi.h:41
AVVAAPIFramesContext::nb_attributes
int nb_attributes
Definition: hwcontext_vaapi.h:94
AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES
@ AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES
The driver does not support surface attributes at all.
Definition: hwcontext_vaapi.h:60
AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS
@ AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS
The driver does not destroy parameter buffers when they are used by vaRenderPicture().
Definition: hwcontext_vaapi.h:47
AVVAAPIFramesContext::nb_surfaces
int nb_surfaces
Definition: hwcontext_vaapi.h:102
AVVAAPIFramesContext
VAAPI-specific data associated with a frame pool.
Definition: hwcontext_vaapi.h:88
AVVAAPIDeviceContext
VAAPI connection details.
Definition: hwcontext_vaapi.h:68