]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blob - libavcodec/vaapi.h
d62066281e3541998516ae0db30e6fdff6e6f574
[frescor/ffmpeg.git] / libavcodec / vaapi.h
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 #include <stdint.h>
28
29 /**
30  * \defgroup VAAPI_Decoding VA API Decoding
31  * \ingroup Decoder
32  * @{
33  */
34
35 /**
36  * This structure is used to share data between the FFmpeg library and
37  * the client video application.
38  * This shall be zero-allocated and available as
39  * AVCodecContext.hwaccel_context. All user members can be set once
40  * during initialization or through each AVCodecContext.get_buffer()
41  * function call. In any case, they must be valid prior to calling
42  * decoding functions.
43  */
44 struct vaapi_context {
45     /**
46      * Window system dependent data
47      *
48      * - encoding: unused
49      * - decoding: Set by user
50      */
51     void *display;
52
53     /**
54      * Configuration ID
55      *
56      * - encoding: unused
57      * - decoding: Set by user
58      */
59     uint32_t config_id;
60
61     /**
62      * Context ID (video decode pipeline)
63      *
64      * - encoding: unused
65      * - decoding: Set by user
66      */
67     uint32_t context_id;
68
69     /**
70      * VAPictureParameterBuffer ID
71      *
72      * - encoding: unused
73      * - decoding: Set by libavcodec
74      */
75     VABufferID pic_param_buf_id;
76
77     /**
78      * VAIQMatrixBuffer ID
79      *
80      * - encoding: unused
81      * - decoding: Set by libavcodec
82      */
83     VABufferID iq_matrix_buf_id;
84
85     /**
86      * VABitPlaneBuffer ID (for VC-1 decoding)
87      *
88      * - encoding: unused
89      * - decoding: Set by libavcodec
90      */
91     VABufferID bitplane_buf_id;
92
93     /**
94      * Slice parameter/data buffer IDs
95      *
96      * - encoding: unused
97      * - decoding: Set by libavcodec
98      */
99     VABufferID *slice_buf_ids;
100
101     /**
102      * Number of effective slice buffer IDs to send to the HW
103      *
104      * - encoding: unused
105      * - decoding: Set by libavcodec
106      */
107     unsigned int n_slice_buf_ids;
108
109     /**
110      * Size of pre-allocated slice_buf_ids
111      *
112      * - encoding: unused
113      * - decoding: Set by libavcodec
114      */
115     unsigned int slice_buf_ids_alloc;
116
117     /**
118      * Picture parameter buffer
119      *
120      * - encoding: unused
121      * - decoding: Set by libavcodec
122      */
123     union {
124         VAPictureParameterBufferMPEG2 mpeg2;
125         VAPictureParameterBufferMPEG4 mpeg4;
126         VAPictureParameterBufferH264  h264;
127         VAPictureParameterBufferVC1   vc1;
128     } pic_param;
129
130     /**
131      * Size of a VAPictureParameterBuffer element
132      *
133      * - encoding: unused
134      * - decoding: Set by libavcodec
135      */
136     unsigned int pic_param_size;
137
138     /**
139      * Inverse quantization matrix buffer
140      *
141      * - encoding: unused
142      * - decoding: Set by libavcodec
143      */
144     union {
145         VAIQMatrixBufferMPEG2         mpeg2;
146         VAIQMatrixBufferMPEG4         mpeg4;
147         VAIQMatrixBufferH264          h264;
148     } iq_matrix;
149
150     /**
151      * Size of a VAIQMatrixBuffer element
152      *
153      * - encoding: unused
154      * - decoding: Set by libavcodec
155      */
156     unsigned int iq_matrix_size;
157
158     /**
159      * Flag: is quantization matrix present?
160      *
161      * - encoding: unused
162      * - decoding: Set by libavcodec
163      */
164     uint8_t iq_matrix_present;
165
166     /**
167      * VC-1 bitplane buffer
168      *
169      * - encoding: unused
170      * - decoding: Set by libavcodec
171      */
172     uint8_t *bitplane_buffer;
173
174     /**
175      * Size of VC-1 bitplane buffer
176      *
177      * - encoding: unused
178      * - decoding: Set by libavcodec
179      */
180     unsigned int bitplane_buffer_size;
181
182     /**
183      * Pointer to VASliceParameterBuffers
184      *
185      * - encoding: unused
186      * - decoding: Set by libavcodec
187      */
188     void *slice_params;
189
190     /**
191      * Size of a VASliceParameterBuffer element
192      *
193      * - encoding: unused
194      * - decoding: Set by libavcodec
195      */
196     unsigned int slice_param_size;
197
198     /**
199      * Size of pre-allocated slice_params
200      *
201      * - encoding: unused
202      * - decoding: Set by libavcodec
203      */
204     unsigned int slice_params_alloc;
205
206     /**
207      * Number of slices currently filled in
208      *
209      * - encoding: unused
210      * - decoding: Set by libavcodec
211      */
212     unsigned int slice_count;
213
214     /**
215      * Pointer to slice data buffer base
216      * - encoding: unused
217      * - decoding: Set by libavcodec
218      */
219     const uint8_t *slice_data;
220
221     /**
222      * Current size of slice data
223      *
224      * - encoding: unused
225      * - decoding: Set by libavcodec
226      */
227     uint32_t slice_data_size;
228 };
229
230 /* @} */
231
232 #endif /* AVCODEC_VAAPI_H */