1 /*
2  * Video Acceleration API (shared data between FFmpeg and the video player)
3  * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
4  *
5  * Copyright (C) 2008-2009 Splitted-Desktop Systems
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #ifndef AVCODEC_VAAPI_H
25 #define AVCODEC_VAAPI_H
26 
27 /**
28  * @file
29  * @ingroup lavc_codec_hwaccel_vaapi
30  * Public libavcodec VA API header.
31  */
32 
33 #include <stdint.h>
34 
35 /**
36  * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
37  * @ingroup lavc_codec_hwaccel
38  * @{
39  */
40 
41 /**
42  * This structure is used to share data between the FFmpeg library and
43  * the client video application.
44  * This shall be zero-allocated and available as
45  * AVCodecContext.hwaccel_context. All user members can be set once
46  * during initialization or through each AVCodecContext.get_buffer()
47  * function call. In any case, they must be valid prior to calling
48  * decoding functions.
49  */
50 struct vaapi_context {
51     /**
52      * Window system dependent data
53      *
54      * - encoding: unused
55      * - decoding: Set by user
56      */
57     void *display;
58 
59     /**
60      * Configuration ID
61      *
62      * - encoding: unused
63      * - decoding: Set by user
64      */
65     uint32_t config_id;
66 
67     /**
68      * Context ID (video decode pipeline)
69      *
70      * - encoding: unused
71      * - decoding: Set by user
72      */
73     uint32_t context_id;
74 
75     /**
76      * VAPictureParameterBuffer ID
77      *
78      * - encoding: unused
79      * - decoding: Set by libavcodec
80      */
81     uint32_t pic_param_buf_id;
82 
83     /**
84      * VAIQMatrixBuffer ID
85      *
86      * - encoding: unused
87      * - decoding: Set by libavcodec
88      */
89     uint32_t iq_matrix_buf_id;
90 
91     /**
92      * VABitPlaneBuffer ID (for VC-1 decoding)
93      *
94      * - encoding: unused
95      * - decoding: Set by libavcodec
96      */
97     uint32_t bitplane_buf_id;
98 
99     /**
100      * Slice parameter/data buffer IDs
101      *
102      * - encoding: unused
103      * - decoding: Set by libavcodec
104      */
105     uint32_t *slice_buf_ids;
106 
107     /**
108      * Number of effective slice buffer IDs to send to the HW
109      *
110      * - encoding: unused
111      * - decoding: Set by libavcodec
112      */
113     unsigned int n_slice_buf_ids;
114 
115     /**
116      * Size of pre-allocated slice_buf_ids
117      *
118      * - encoding: unused
119      * - decoding: Set by libavcodec
120      */
121     unsigned int slice_buf_ids_alloc;
122 
123     /**
124      * Pointer to VASliceParameterBuffers
125      *
126      * - encoding: unused
127      * - decoding: Set by libavcodec
128      */
129     void *slice_params;
130 
131     /**
132      * Size of a VASliceParameterBuffer element
133      *
134      * - encoding: unused
135      * - decoding: Set by libavcodec
136      */
137     unsigned int slice_param_size;
138 
139     /**
140      * Size of pre-allocated slice_params
141      *
142      * - encoding: unused
143      * - decoding: Set by libavcodec
144      */
145     unsigned int slice_params_alloc;
146 
147     /**
148      * Number of slices currently filled in
149      *
150      * - encoding: unused
151      * - decoding: Set by libavcodec
152      */
153     unsigned int slice_count;
154 
155     /**
156      * Pointer to slice data buffer base
157      * - encoding: unused
158      * - decoding: Set by libavcodec
159      */
160     const uint8_t *slice_data;
161 
162     /**
163      * Current size of slice data
164      *
165      * - encoding: unused
166      * - decoding: Set by libavcodec
167      */
168     uint32_t slice_data_size;
169 };
170 
171 /* @} */
172 
173 #endif /* AVCODEC_VAAPI_H */
174