lavu: VAAPI hwcontext implementation
[libav.git] / libavutil / hwcontext_vaapi.h
1 /*
2 * This file is part of Libav.
3 *
4 * Libav 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 * Libav 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 Libav; 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 /**
37 * VAAPI connection details.
38 *
39 * Allocated as AVHWDeviceContext.hwctx
40 */
41 typedef struct AVVAAPIDeviceContext {
42 /**
43 * The VADisplay handle, to be filled by the user.
44 */
45 VADisplay display;
46 } AVVAAPIDeviceContext;
47
48 /**
49 * VAAPI-specific data associated with a frame pool.
50 *
51 * Allocated as AVHWFramesContext.hwctx.
52 */
53 typedef struct AVVAAPIFramesContext {
54 /**
55 * Set by the user to apply surface attributes to all surfaces in
56 * the frame pool. If null, default settings are used.
57 */
58 VASurfaceAttrib *attributes;
59 int nb_attributes;
60 /**
61 * The surfaces IDs of all surfaces in the pool after creation.
62 * Only valid if AVHWFramesContext.initial_pool_size was positive.
63 * These are intended to be used as the render_targets arguments to
64 * vaCreateContext().
65 */
66 VASurfaceID *surface_ids;
67 int nb_surfaces;
68 } AVVAAPIFramesContext;
69
70 /**
71 * VAAPI hardware pipeline configuration details.
72 *
73 * Allocated with av_hwdevice_hwconfig_alloc().
74 */
75 typedef struct AVVAAPIHWConfig {
76 /**
77 * ID of a VAAPI pipeline configuration.
78 */
79 VAConfigID config_id;
80 } AVVAAPIHWConfig;
81
82 #endif /* AVUTIL_HWCONTEXT_VAAPI_H */