yading@10
|
1 /*
|
yading@10
|
2 * copyright (c) 2001 Fabrice Bellard
|
yading@10
|
3 *
|
yading@10
|
4 * This file is part of FFmpeg.
|
yading@10
|
5 *
|
yading@10
|
6 * FFmpeg is free software; you can redistribute it and/or
|
yading@10
|
7 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
8 * License as published by the Free Software Foundation; either
|
yading@10
|
9 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
10 *
|
yading@10
|
11 * FFmpeg is distributed in the hope that it will be useful,
|
yading@10
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
14 * Lesser General Public License for more details.
|
yading@10
|
15 *
|
yading@10
|
16 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
17 * License along with FFmpeg; if not, write to the Free Software
|
yading@10
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
19 */
|
yading@10
|
20
|
yading@10
|
21 #ifndef AVCODEC_AVCODEC_H
|
yading@10
|
22 #define AVCODEC_AVCODEC_H
|
yading@10
|
23
|
yading@10
|
24 /**
|
yading@10
|
25 * @file
|
yading@10
|
26 * external API header
|
yading@10
|
27 */
|
yading@10
|
28
|
yading@10
|
29 #include <errno.h>
|
yading@10
|
30 #include "libavutil/samplefmt.h"
|
yading@10
|
31 #include "libavutil/avutil.h"
|
yading@10
|
32 #include "libavutil/buffer.h"
|
yading@10
|
33 #include "libavutil/cpu.h"
|
yading@10
|
34 #include "libavutil/channel_layout.h"
|
yading@10
|
35 #include "libavutil/dict.h"
|
yading@10
|
36 #include "libavutil/frame.h"
|
yading@10
|
37 #include "libavutil/log.h"
|
yading@10
|
38 #include "libavutil/pixfmt.h"
|
yading@10
|
39 #include "libavutil/rational.h"
|
yading@10
|
40
|
yading@10
|
41 #include "libavcodec/version.h"
|
yading@10
|
42 /**
|
yading@10
|
43 * @defgroup libavc Encoding/Decoding Library
|
yading@10
|
44 * @{
|
yading@10
|
45 *
|
yading@10
|
46 * @defgroup lavc_decoding Decoding
|
yading@10
|
47 * @{
|
yading@10
|
48 * @}
|
yading@10
|
49 *
|
yading@10
|
50 * @defgroup lavc_encoding Encoding
|
yading@10
|
51 * @{
|
yading@10
|
52 * @}
|
yading@10
|
53 *
|
yading@10
|
54 * @defgroup lavc_codec Codecs
|
yading@10
|
55 * @{
|
yading@10
|
56 * @defgroup lavc_codec_native Native Codecs
|
yading@10
|
57 * @{
|
yading@10
|
58 * @}
|
yading@10
|
59 * @defgroup lavc_codec_wrappers External library wrappers
|
yading@10
|
60 * @{
|
yading@10
|
61 * @}
|
yading@10
|
62 * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
|
yading@10
|
63 * @{
|
yading@10
|
64 * @}
|
yading@10
|
65 * @}
|
yading@10
|
66 * @defgroup lavc_internal Internal
|
yading@10
|
67 * @{
|
yading@10
|
68 * @}
|
yading@10
|
69 * @}
|
yading@10
|
70 *
|
yading@10
|
71 */
|
yading@10
|
72
|
yading@10
|
73 /**
|
yading@10
|
74 * @defgroup lavc_core Core functions/structures.
|
yading@10
|
75 * @ingroup libavc
|
yading@10
|
76 *
|
yading@10
|
77 * Basic definitions, functions for querying libavcodec capabilities,
|
yading@10
|
78 * allocating core structures, etc.
|
yading@10
|
79 * @{
|
yading@10
|
80 */
|
yading@10
|
81
|
yading@10
|
82
|
yading@10
|
83 /**
|
yading@10
|
84 * Identify the syntax and semantics of the bitstream.
|
yading@10
|
85 * The principle is roughly:
|
yading@10
|
86 * Two decoders with the same ID can decode the same streams.
|
yading@10
|
87 * Two encoders with the same ID can encode compatible streams.
|
yading@10
|
88 * There may be slight deviations from the principle due to implementation
|
yading@10
|
89 * details.
|
yading@10
|
90 *
|
yading@10
|
91 * If you add a codec ID to this list, add it so that
|
yading@10
|
92 * 1. no value of a existing codec ID changes (that would break ABI),
|
yading@10
|
93 * 2. Give it a value which when taken as ASCII is recognized uniquely by a human as this specific codec.
|
yading@10
|
94 * This ensures that 2 forks can independently add AVCodecIDs without producing conflicts.
|
yading@10
|
95 *
|
yading@10
|
96 * After adding new codec IDs, do not forget to add an entry to the codec
|
yading@10
|
97 * descriptor list and bump libavcodec minor version.
|
yading@10
|
98 */
|
yading@10
|
99 enum AVCodecID {
|
yading@10
|
100 AV_CODEC_ID_NONE,
|
yading@10
|
101
|
yading@10
|
102 /* video codecs */
|
yading@10
|
103 AV_CODEC_ID_MPEG1VIDEO,
|
yading@10
|
104 AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
|
yading@10
|
105 AV_CODEC_ID_MPEG2VIDEO_XVMC,
|
yading@10
|
106 AV_CODEC_ID_H261,
|
yading@10
|
107 AV_CODEC_ID_H263,
|
yading@10
|
108 AV_CODEC_ID_RV10,
|
yading@10
|
109 AV_CODEC_ID_RV20,
|
yading@10
|
110 AV_CODEC_ID_MJPEG,
|
yading@10
|
111 AV_CODEC_ID_MJPEGB,
|
yading@10
|
112 AV_CODEC_ID_LJPEG,
|
yading@10
|
113 AV_CODEC_ID_SP5X,
|
yading@10
|
114 AV_CODEC_ID_JPEGLS,
|
yading@10
|
115 AV_CODEC_ID_MPEG4,
|
yading@10
|
116 AV_CODEC_ID_RAWVIDEO,
|
yading@10
|
117 AV_CODEC_ID_MSMPEG4V1,
|
yading@10
|
118 AV_CODEC_ID_MSMPEG4V2,
|
yading@10
|
119 AV_CODEC_ID_MSMPEG4V3,
|
yading@10
|
120 AV_CODEC_ID_WMV1,
|
yading@10
|
121 AV_CODEC_ID_WMV2,
|
yading@10
|
122 AV_CODEC_ID_H263P,
|
yading@10
|
123 AV_CODEC_ID_H263I,
|
yading@10
|
124 AV_CODEC_ID_FLV1,
|
yading@10
|
125 AV_CODEC_ID_SVQ1,
|
yading@10
|
126 AV_CODEC_ID_SVQ3,
|
yading@10
|
127 AV_CODEC_ID_DVVIDEO,
|
yading@10
|
128 AV_CODEC_ID_HUFFYUV,
|
yading@10
|
129 AV_CODEC_ID_CYUV,
|
yading@10
|
130 AV_CODEC_ID_H264,
|
yading@10
|
131 AV_CODEC_ID_INDEO3,
|
yading@10
|
132 AV_CODEC_ID_VP3,
|
yading@10
|
133 AV_CODEC_ID_THEORA,
|
yading@10
|
134 AV_CODEC_ID_ASV1,
|
yading@10
|
135 AV_CODEC_ID_ASV2,
|
yading@10
|
136 AV_CODEC_ID_FFV1,
|
yading@10
|
137 AV_CODEC_ID_4XM,
|
yading@10
|
138 AV_CODEC_ID_VCR1,
|
yading@10
|
139 AV_CODEC_ID_CLJR,
|
yading@10
|
140 AV_CODEC_ID_MDEC,
|
yading@10
|
141 AV_CODEC_ID_ROQ,
|
yading@10
|
142 AV_CODEC_ID_INTERPLAY_VIDEO,
|
yading@10
|
143 AV_CODEC_ID_XAN_WC3,
|
yading@10
|
144 AV_CODEC_ID_XAN_WC4,
|
yading@10
|
145 AV_CODEC_ID_RPZA,
|
yading@10
|
146 AV_CODEC_ID_CINEPAK,
|
yading@10
|
147 AV_CODEC_ID_WS_VQA,
|
yading@10
|
148 AV_CODEC_ID_MSRLE,
|
yading@10
|
149 AV_CODEC_ID_MSVIDEO1,
|
yading@10
|
150 AV_CODEC_ID_IDCIN,
|
yading@10
|
151 AV_CODEC_ID_8BPS,
|
yading@10
|
152 AV_CODEC_ID_SMC,
|
yading@10
|
153 AV_CODEC_ID_FLIC,
|
yading@10
|
154 AV_CODEC_ID_TRUEMOTION1,
|
yading@10
|
155 AV_CODEC_ID_VMDVIDEO,
|
yading@10
|
156 AV_CODEC_ID_MSZH,
|
yading@10
|
157 AV_CODEC_ID_ZLIB,
|
yading@10
|
158 AV_CODEC_ID_QTRLE,
|
yading@10
|
159 AV_CODEC_ID_TSCC,
|
yading@10
|
160 AV_CODEC_ID_ULTI,
|
yading@10
|
161 AV_CODEC_ID_QDRAW,
|
yading@10
|
162 AV_CODEC_ID_VIXL,
|
yading@10
|
163 AV_CODEC_ID_QPEG,
|
yading@10
|
164 AV_CODEC_ID_PNG,
|
yading@10
|
165 AV_CODEC_ID_PPM,
|
yading@10
|
166 AV_CODEC_ID_PBM,
|
yading@10
|
167 AV_CODEC_ID_PGM,
|
yading@10
|
168 AV_CODEC_ID_PGMYUV,
|
yading@10
|
169 AV_CODEC_ID_PAM,
|
yading@10
|
170 AV_CODEC_ID_FFVHUFF,
|
yading@10
|
171 AV_CODEC_ID_RV30,
|
yading@10
|
172 AV_CODEC_ID_RV40,
|
yading@10
|
173 AV_CODEC_ID_VC1,
|
yading@10
|
174 AV_CODEC_ID_WMV3,
|
yading@10
|
175 AV_CODEC_ID_LOCO,
|
yading@10
|
176 AV_CODEC_ID_WNV1,
|
yading@10
|
177 AV_CODEC_ID_AASC,
|
yading@10
|
178 AV_CODEC_ID_INDEO2,
|
yading@10
|
179 AV_CODEC_ID_FRAPS,
|
yading@10
|
180 AV_CODEC_ID_TRUEMOTION2,
|
yading@10
|
181 AV_CODEC_ID_BMP,
|
yading@10
|
182 AV_CODEC_ID_CSCD,
|
yading@10
|
183 AV_CODEC_ID_MMVIDEO,
|
yading@10
|
184 AV_CODEC_ID_ZMBV,
|
yading@10
|
185 AV_CODEC_ID_AVS,
|
yading@10
|
186 AV_CODEC_ID_SMACKVIDEO,
|
yading@10
|
187 AV_CODEC_ID_NUV,
|
yading@10
|
188 AV_CODEC_ID_KMVC,
|
yading@10
|
189 AV_CODEC_ID_FLASHSV,
|
yading@10
|
190 AV_CODEC_ID_CAVS,
|
yading@10
|
191 AV_CODEC_ID_JPEG2000,
|
yading@10
|
192 AV_CODEC_ID_VMNC,
|
yading@10
|
193 AV_CODEC_ID_VP5,
|
yading@10
|
194 AV_CODEC_ID_VP6,
|
yading@10
|
195 AV_CODEC_ID_VP6F,
|
yading@10
|
196 AV_CODEC_ID_TARGA,
|
yading@10
|
197 AV_CODEC_ID_DSICINVIDEO,
|
yading@10
|
198 AV_CODEC_ID_TIERTEXSEQVIDEO,
|
yading@10
|
199 AV_CODEC_ID_TIFF,
|
yading@10
|
200 AV_CODEC_ID_GIF,
|
yading@10
|
201 AV_CODEC_ID_DXA,
|
yading@10
|
202 AV_CODEC_ID_DNXHD,
|
yading@10
|
203 AV_CODEC_ID_THP,
|
yading@10
|
204 AV_CODEC_ID_SGI,
|
yading@10
|
205 AV_CODEC_ID_C93,
|
yading@10
|
206 AV_CODEC_ID_BETHSOFTVID,
|
yading@10
|
207 AV_CODEC_ID_PTX,
|
yading@10
|
208 AV_CODEC_ID_TXD,
|
yading@10
|
209 AV_CODEC_ID_VP6A,
|
yading@10
|
210 AV_CODEC_ID_AMV,
|
yading@10
|
211 AV_CODEC_ID_VB,
|
yading@10
|
212 AV_CODEC_ID_PCX,
|
yading@10
|
213 AV_CODEC_ID_SUNRAST,
|
yading@10
|
214 AV_CODEC_ID_INDEO4,
|
yading@10
|
215 AV_CODEC_ID_INDEO5,
|
yading@10
|
216 AV_CODEC_ID_MIMIC,
|
yading@10
|
217 AV_CODEC_ID_RL2,
|
yading@10
|
218 AV_CODEC_ID_ESCAPE124,
|
yading@10
|
219 AV_CODEC_ID_DIRAC,
|
yading@10
|
220 AV_CODEC_ID_BFI,
|
yading@10
|
221 AV_CODEC_ID_CMV,
|
yading@10
|
222 AV_CODEC_ID_MOTIONPIXELS,
|
yading@10
|
223 AV_CODEC_ID_TGV,
|
yading@10
|
224 AV_CODEC_ID_TGQ,
|
yading@10
|
225 AV_CODEC_ID_TQI,
|
yading@10
|
226 AV_CODEC_ID_AURA,
|
yading@10
|
227 AV_CODEC_ID_AURA2,
|
yading@10
|
228 AV_CODEC_ID_V210X,
|
yading@10
|
229 AV_CODEC_ID_TMV,
|
yading@10
|
230 AV_CODEC_ID_V210,
|
yading@10
|
231 AV_CODEC_ID_DPX,
|
yading@10
|
232 AV_CODEC_ID_MAD,
|
yading@10
|
233 AV_CODEC_ID_FRWU,
|
yading@10
|
234 AV_CODEC_ID_FLASHSV2,
|
yading@10
|
235 AV_CODEC_ID_CDGRAPHICS,
|
yading@10
|
236 AV_CODEC_ID_R210,
|
yading@10
|
237 AV_CODEC_ID_ANM,
|
yading@10
|
238 AV_CODEC_ID_BINKVIDEO,
|
yading@10
|
239 AV_CODEC_ID_IFF_ILBM,
|
yading@10
|
240 AV_CODEC_ID_IFF_BYTERUN1,
|
yading@10
|
241 AV_CODEC_ID_KGV1,
|
yading@10
|
242 AV_CODEC_ID_YOP,
|
yading@10
|
243 AV_CODEC_ID_VP8,
|
yading@10
|
244 AV_CODEC_ID_PICTOR,
|
yading@10
|
245 AV_CODEC_ID_ANSI,
|
yading@10
|
246 AV_CODEC_ID_A64_MULTI,
|
yading@10
|
247 AV_CODEC_ID_A64_MULTI5,
|
yading@10
|
248 AV_CODEC_ID_R10K,
|
yading@10
|
249 AV_CODEC_ID_MXPEG,
|
yading@10
|
250 AV_CODEC_ID_LAGARITH,
|
yading@10
|
251 AV_CODEC_ID_PRORES,
|
yading@10
|
252 AV_CODEC_ID_JV,
|
yading@10
|
253 AV_CODEC_ID_DFA,
|
yading@10
|
254 AV_CODEC_ID_WMV3IMAGE,
|
yading@10
|
255 AV_CODEC_ID_VC1IMAGE,
|
yading@10
|
256 AV_CODEC_ID_UTVIDEO,
|
yading@10
|
257 AV_CODEC_ID_BMV_VIDEO,
|
yading@10
|
258 AV_CODEC_ID_VBLE,
|
yading@10
|
259 AV_CODEC_ID_DXTORY,
|
yading@10
|
260 AV_CODEC_ID_V410,
|
yading@10
|
261 AV_CODEC_ID_XWD,
|
yading@10
|
262 AV_CODEC_ID_CDXL,
|
yading@10
|
263 AV_CODEC_ID_XBM,
|
yading@10
|
264 AV_CODEC_ID_ZEROCODEC,
|
yading@10
|
265 AV_CODEC_ID_MSS1,
|
yading@10
|
266 AV_CODEC_ID_MSA1,
|
yading@10
|
267 AV_CODEC_ID_TSCC2,
|
yading@10
|
268 AV_CODEC_ID_MTS2,
|
yading@10
|
269 AV_CODEC_ID_CLLC,
|
yading@10
|
270 AV_CODEC_ID_MSS2,
|
yading@10
|
271 AV_CODEC_ID_VP9,
|
yading@10
|
272 AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
|
yading@10
|
273 AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
|
yading@10
|
274 AV_CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
|
yading@10
|
275 AV_CODEC_ID_EXR = MKBETAG('0','E','X','R'),
|
yading@10
|
276 AV_CODEC_ID_AVRP = MKBETAG('A','V','R','P'),
|
yading@10
|
277
|
yading@10
|
278 AV_CODEC_ID_012V = MKBETAG('0','1','2','V'),
|
yading@10
|
279 AV_CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'),
|
yading@10
|
280 AV_CODEC_ID_AVUI = MKBETAG('A','V','U','I'),
|
yading@10
|
281 AV_CODEC_ID_AYUV = MKBETAG('A','Y','U','V'),
|
yading@10
|
282 AV_CODEC_ID_TARGA_Y216 = MKBETAG('T','2','1','6'),
|
yading@10
|
283 AV_CODEC_ID_V308 = MKBETAG('V','3','0','8'),
|
yading@10
|
284 AV_CODEC_ID_V408 = MKBETAG('V','4','0','8'),
|
yading@10
|
285 AV_CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'),
|
yading@10
|
286 AV_CODEC_ID_SANM = MKBETAG('S','A','N','M'),
|
yading@10
|
287 AV_CODEC_ID_PAF_VIDEO = MKBETAG('P','A','F','V'),
|
yading@10
|
288 AV_CODEC_ID_AVRN = MKBETAG('A','V','R','n'),
|
yading@10
|
289 AV_CODEC_ID_CPIA = MKBETAG('C','P','I','A'),
|
yading@10
|
290 AV_CODEC_ID_XFACE = MKBETAG('X','F','A','C'),
|
yading@10
|
291 AV_CODEC_ID_SGIRLE = MKBETAG('S','G','I','R'),
|
yading@10
|
292 AV_CODEC_ID_MVC1 = MKBETAG('M','V','C','1'),
|
yading@10
|
293 AV_CODEC_ID_MVC2 = MKBETAG('M','V','C','2'),
|
yading@10
|
294 AV_CODEC_ID_SNOW = MKBETAG('S','N','O','W'),
|
yading@10
|
295 AV_CODEC_ID_WEBP = MKBETAG('W','E','B','P'),
|
yading@10
|
296
|
yading@10
|
297 /* various PCM "codecs" */
|
yading@10
|
298 AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
yading@10
|
299 AV_CODEC_ID_PCM_S16LE = 0x10000,
|
yading@10
|
300 AV_CODEC_ID_PCM_S16BE,
|
yading@10
|
301 AV_CODEC_ID_PCM_U16LE,
|
yading@10
|
302 AV_CODEC_ID_PCM_U16BE,
|
yading@10
|
303 AV_CODEC_ID_PCM_S8,
|
yading@10
|
304 AV_CODEC_ID_PCM_U8,
|
yading@10
|
305 AV_CODEC_ID_PCM_MULAW,
|
yading@10
|
306 AV_CODEC_ID_PCM_ALAW,
|
yading@10
|
307 AV_CODEC_ID_PCM_S32LE,
|
yading@10
|
308 AV_CODEC_ID_PCM_S32BE,
|
yading@10
|
309 AV_CODEC_ID_PCM_U32LE,
|
yading@10
|
310 AV_CODEC_ID_PCM_U32BE,
|
yading@10
|
311 AV_CODEC_ID_PCM_S24LE,
|
yading@10
|
312 AV_CODEC_ID_PCM_S24BE,
|
yading@10
|
313 AV_CODEC_ID_PCM_U24LE,
|
yading@10
|
314 AV_CODEC_ID_PCM_U24BE,
|
yading@10
|
315 AV_CODEC_ID_PCM_S24DAUD,
|
yading@10
|
316 AV_CODEC_ID_PCM_ZORK,
|
yading@10
|
317 AV_CODEC_ID_PCM_S16LE_PLANAR,
|
yading@10
|
318 AV_CODEC_ID_PCM_DVD,
|
yading@10
|
319 AV_CODEC_ID_PCM_F32BE,
|
yading@10
|
320 AV_CODEC_ID_PCM_F32LE,
|
yading@10
|
321 AV_CODEC_ID_PCM_F64BE,
|
yading@10
|
322 AV_CODEC_ID_PCM_F64LE,
|
yading@10
|
323 AV_CODEC_ID_PCM_BLURAY,
|
yading@10
|
324 AV_CODEC_ID_PCM_LXF,
|
yading@10
|
325 AV_CODEC_ID_S302M,
|
yading@10
|
326 AV_CODEC_ID_PCM_S8_PLANAR,
|
yading@10
|
327 AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24,'P','S','P'),
|
yading@10
|
328 AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32,'P','S','P'),
|
yading@10
|
329 AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P','S','P',16),
|
yading@10
|
330
|
yading@10
|
331 /* various ADPCM codecs */
|
yading@10
|
332 AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
|
yading@10
|
333 AV_CODEC_ID_ADPCM_IMA_WAV,
|
yading@10
|
334 AV_CODEC_ID_ADPCM_IMA_DK3,
|
yading@10
|
335 AV_CODEC_ID_ADPCM_IMA_DK4,
|
yading@10
|
336 AV_CODEC_ID_ADPCM_IMA_WS,
|
yading@10
|
337 AV_CODEC_ID_ADPCM_IMA_SMJPEG,
|
yading@10
|
338 AV_CODEC_ID_ADPCM_MS,
|
yading@10
|
339 AV_CODEC_ID_ADPCM_4XM,
|
yading@10
|
340 AV_CODEC_ID_ADPCM_XA,
|
yading@10
|
341 AV_CODEC_ID_ADPCM_ADX,
|
yading@10
|
342 AV_CODEC_ID_ADPCM_EA,
|
yading@10
|
343 AV_CODEC_ID_ADPCM_G726,
|
yading@10
|
344 AV_CODEC_ID_ADPCM_CT,
|
yading@10
|
345 AV_CODEC_ID_ADPCM_SWF,
|
yading@10
|
346 AV_CODEC_ID_ADPCM_YAMAHA,
|
yading@10
|
347 AV_CODEC_ID_ADPCM_SBPRO_4,
|
yading@10
|
348 AV_CODEC_ID_ADPCM_SBPRO_3,
|
yading@10
|
349 AV_CODEC_ID_ADPCM_SBPRO_2,
|
yading@10
|
350 AV_CODEC_ID_ADPCM_THP,
|
yading@10
|
351 AV_CODEC_ID_ADPCM_IMA_AMV,
|
yading@10
|
352 AV_CODEC_ID_ADPCM_EA_R1,
|
yading@10
|
353 AV_CODEC_ID_ADPCM_EA_R3,
|
yading@10
|
354 AV_CODEC_ID_ADPCM_EA_R2,
|
yading@10
|
355 AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
|
yading@10
|
356 AV_CODEC_ID_ADPCM_IMA_EA_EACS,
|
yading@10
|
357 AV_CODEC_ID_ADPCM_EA_XAS,
|
yading@10
|
358 AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
|
yading@10
|
359 AV_CODEC_ID_ADPCM_IMA_ISS,
|
yading@10
|
360 AV_CODEC_ID_ADPCM_G722,
|
yading@10
|
361 AV_CODEC_ID_ADPCM_IMA_APC,
|
yading@10
|
362 AV_CODEC_ID_VIMA = MKBETAG('V','I','M','A'),
|
yading@10
|
363 AV_CODEC_ID_ADPCM_AFC = MKBETAG('A','F','C',' '),
|
yading@10
|
364 AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O','K','I',' '),
|
yading@10
|
365
|
yading@10
|
366 /* AMR */
|
yading@10
|
367 AV_CODEC_ID_AMR_NB = 0x12000,
|
yading@10
|
368 AV_CODEC_ID_AMR_WB,
|
yading@10
|
369
|
yading@10
|
370 /* RealAudio codecs*/
|
yading@10
|
371 AV_CODEC_ID_RA_144 = 0x13000,
|
yading@10
|
372 AV_CODEC_ID_RA_288,
|
yading@10
|
373
|
yading@10
|
374 /* various DPCM codecs */
|
yading@10
|
375 AV_CODEC_ID_ROQ_DPCM = 0x14000,
|
yading@10
|
376 AV_CODEC_ID_INTERPLAY_DPCM,
|
yading@10
|
377 AV_CODEC_ID_XAN_DPCM,
|
yading@10
|
378 AV_CODEC_ID_SOL_DPCM,
|
yading@10
|
379
|
yading@10
|
380 /* audio codecs */
|
yading@10
|
381 AV_CODEC_ID_MP2 = 0x15000,
|
yading@10
|
382 AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
|
yading@10
|
383 AV_CODEC_ID_AAC,
|
yading@10
|
384 AV_CODEC_ID_AC3,
|
yading@10
|
385 AV_CODEC_ID_DTS,
|
yading@10
|
386 AV_CODEC_ID_VORBIS,
|
yading@10
|
387 AV_CODEC_ID_DVAUDIO,
|
yading@10
|
388 AV_CODEC_ID_WMAV1,
|
yading@10
|
389 AV_CODEC_ID_WMAV2,
|
yading@10
|
390 AV_CODEC_ID_MACE3,
|
yading@10
|
391 AV_CODEC_ID_MACE6,
|
yading@10
|
392 AV_CODEC_ID_VMDAUDIO,
|
yading@10
|
393 AV_CODEC_ID_FLAC,
|
yading@10
|
394 AV_CODEC_ID_MP3ADU,
|
yading@10
|
395 AV_CODEC_ID_MP3ON4,
|
yading@10
|
396 AV_CODEC_ID_SHORTEN,
|
yading@10
|
397 AV_CODEC_ID_ALAC,
|
yading@10
|
398 AV_CODEC_ID_WESTWOOD_SND1,
|
yading@10
|
399 AV_CODEC_ID_GSM, ///< as in Berlin toast format
|
yading@10
|
400 AV_CODEC_ID_QDM2,
|
yading@10
|
401 AV_CODEC_ID_COOK,
|
yading@10
|
402 AV_CODEC_ID_TRUESPEECH,
|
yading@10
|
403 AV_CODEC_ID_TTA,
|
yading@10
|
404 AV_CODEC_ID_SMACKAUDIO,
|
yading@10
|
405 AV_CODEC_ID_QCELP,
|
yading@10
|
406 AV_CODEC_ID_WAVPACK,
|
yading@10
|
407 AV_CODEC_ID_DSICINAUDIO,
|
yading@10
|
408 AV_CODEC_ID_IMC,
|
yading@10
|
409 AV_CODEC_ID_MUSEPACK7,
|
yading@10
|
410 AV_CODEC_ID_MLP,
|
yading@10
|
411 AV_CODEC_ID_GSM_MS, /* as found in WAV */
|
yading@10
|
412 AV_CODEC_ID_ATRAC3,
|
yading@10
|
413 AV_CODEC_ID_VOXWARE,
|
yading@10
|
414 AV_CODEC_ID_APE,
|
yading@10
|
415 AV_CODEC_ID_NELLYMOSER,
|
yading@10
|
416 AV_CODEC_ID_MUSEPACK8,
|
yading@10
|
417 AV_CODEC_ID_SPEEX,
|
yading@10
|
418 AV_CODEC_ID_WMAVOICE,
|
yading@10
|
419 AV_CODEC_ID_WMAPRO,
|
yading@10
|
420 AV_CODEC_ID_WMALOSSLESS,
|
yading@10
|
421 AV_CODEC_ID_ATRAC3P,
|
yading@10
|
422 AV_CODEC_ID_EAC3,
|
yading@10
|
423 AV_CODEC_ID_SIPR,
|
yading@10
|
424 AV_CODEC_ID_MP1,
|
yading@10
|
425 AV_CODEC_ID_TWINVQ,
|
yading@10
|
426 AV_CODEC_ID_TRUEHD,
|
yading@10
|
427 AV_CODEC_ID_MP4ALS,
|
yading@10
|
428 AV_CODEC_ID_ATRAC1,
|
yading@10
|
429 AV_CODEC_ID_BINKAUDIO_RDFT,
|
yading@10
|
430 AV_CODEC_ID_BINKAUDIO_DCT,
|
yading@10
|
431 AV_CODEC_ID_AAC_LATM,
|
yading@10
|
432 AV_CODEC_ID_QDMC,
|
yading@10
|
433 AV_CODEC_ID_CELT,
|
yading@10
|
434 AV_CODEC_ID_G723_1,
|
yading@10
|
435 AV_CODEC_ID_G729,
|
yading@10
|
436 AV_CODEC_ID_8SVX_EXP,
|
yading@10
|
437 AV_CODEC_ID_8SVX_FIB,
|
yading@10
|
438 AV_CODEC_ID_BMV_AUDIO,
|
yading@10
|
439 AV_CODEC_ID_RALF,
|
yading@10
|
440 AV_CODEC_ID_IAC,
|
yading@10
|
441 AV_CODEC_ID_ILBC,
|
yading@10
|
442 AV_CODEC_ID_OPUS_DEPRECATED,
|
yading@10
|
443 AV_CODEC_ID_COMFORT_NOISE,
|
yading@10
|
444 AV_CODEC_ID_TAK_DEPRECATED,
|
yading@10
|
445 AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),
|
yading@10
|
446 AV_CODEC_ID_SONIC = MKBETAG('S','O','N','C'),
|
yading@10
|
447 AV_CODEC_ID_SONIC_LS = MKBETAG('S','O','N','L'),
|
yading@10
|
448 AV_CODEC_ID_PAF_AUDIO = MKBETAG('P','A','F','A'),
|
yading@10
|
449 AV_CODEC_ID_OPUS = MKBETAG('O','P','U','S'),
|
yading@10
|
450 AV_CODEC_ID_TAK = MKBETAG('t','B','a','K'),
|
yading@10
|
451 AV_CODEC_ID_EVRC = MKBETAG('s','e','v','c'),
|
yading@10
|
452 AV_CODEC_ID_SMV = MKBETAG('s','s','m','v'),
|
yading@10
|
453
|
yading@10
|
454 /* subtitle codecs */
|
yading@10
|
455 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
|
yading@10
|
456 AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
|
yading@10
|
457 AV_CODEC_ID_DVB_SUBTITLE,
|
yading@10
|
458 AV_CODEC_ID_TEXT, ///< raw UTF-8 text
|
yading@10
|
459 AV_CODEC_ID_XSUB,
|
yading@10
|
460 AV_CODEC_ID_SSA,
|
yading@10
|
461 AV_CODEC_ID_MOV_TEXT,
|
yading@10
|
462 AV_CODEC_ID_HDMV_PGS_SUBTITLE,
|
yading@10
|
463 AV_CODEC_ID_DVB_TELETEXT,
|
yading@10
|
464 AV_CODEC_ID_SRT,
|
yading@10
|
465 AV_CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'),
|
yading@10
|
466 AV_CODEC_ID_EIA_608 = MKBETAG('c','6','0','8'),
|
yading@10
|
467 AV_CODEC_ID_JACOSUB = MKBETAG('J','S','U','B'),
|
yading@10
|
468 AV_CODEC_ID_SAMI = MKBETAG('S','A','M','I'),
|
yading@10
|
469 AV_CODEC_ID_REALTEXT = MKBETAG('R','T','X','T'),
|
yading@10
|
470 AV_CODEC_ID_SUBVIEWER1 = MKBETAG('S','b','V','1'),
|
yading@10
|
471 AV_CODEC_ID_SUBVIEWER = MKBETAG('S','u','b','V'),
|
yading@10
|
472 AV_CODEC_ID_SUBRIP = MKBETAG('S','R','i','p'),
|
yading@10
|
473 AV_CODEC_ID_WEBVTT = MKBETAG('W','V','T','T'),
|
yading@10
|
474 AV_CODEC_ID_MPL2 = MKBETAG('M','P','L','2'),
|
yading@10
|
475 AV_CODEC_ID_VPLAYER = MKBETAG('V','P','l','r'),
|
yading@10
|
476 AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'),
|
yading@10
|
477 AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska
|
yading@10
|
478
|
yading@10
|
479 /* other specific kind of codecs (generally used for attachments) */
|
yading@10
|
480 AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
yading@10
|
481 AV_CODEC_ID_TTF = 0x18000,
|
yading@10
|
482 AV_CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'),
|
yading@10
|
483 AV_CODEC_ID_XBIN = MKBETAG('X','B','I','N'),
|
yading@10
|
484 AV_CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'),
|
yading@10
|
485 AV_CODEC_ID_OTF = MKBETAG( 0 ,'O','T','F'),
|
yading@10
|
486 AV_CODEC_ID_SMPTE_KLV = MKBETAG('K','L','V','A'),
|
yading@10
|
487 AV_CODEC_ID_DVD_NAV = MKBETAG('D','N','A','V'),
|
yading@10
|
488
|
yading@10
|
489
|
yading@10
|
490 AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
|
yading@10
|
491
|
yading@10
|
492 AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
|
yading@10
|
493 * stream (only used by libavformat) */
|
yading@10
|
494 AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
|
yading@10
|
495 * stream (only used by libavformat) */
|
yading@10
|
496 AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
|
yading@10
|
497
|
yading@10
|
498 #if FF_API_CODEC_ID
|
yading@10
|
499 #include "old_codec_ids.h"
|
yading@10
|
500 #endif
|
yading@10
|
501 };
|
yading@10
|
502
|
yading@10
|
503 /**
|
yading@10
|
504 * This struct describes the properties of a single codec described by an
|
yading@10
|
505 * AVCodecID.
|
yading@10
|
506 * @see avcodec_get_descriptor()
|
yading@10
|
507 */
|
yading@10
|
508 typedef struct AVCodecDescriptor {
|
yading@10
|
509 enum AVCodecID id;
|
yading@10
|
510 enum AVMediaType type;
|
yading@10
|
511 /**
|
yading@10
|
512 * Name of the codec described by this descriptor. It is non-empty and
|
yading@10
|
513 * unique for each codec descriptor. It should contain alphanumeric
|
yading@10
|
514 * characters and '_' only.
|
yading@10
|
515 */
|
yading@10
|
516 const char *name;
|
yading@10
|
517 /**
|
yading@10
|
518 * A more descriptive name for this codec. May be NULL.
|
yading@10
|
519 */
|
yading@10
|
520 const char *long_name;
|
yading@10
|
521 /**
|
yading@10
|
522 * Codec properties, a combination of AV_CODEC_PROP_* flags.
|
yading@10
|
523 */
|
yading@10
|
524 int props;
|
yading@10
|
525 } AVCodecDescriptor;
|
yading@10
|
526
|
yading@10
|
527 /**
|
yading@10
|
528 * Codec uses only intra compression.
|
yading@10
|
529 * Video codecs only.
|
yading@10
|
530 */
|
yading@10
|
531 #define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
|
yading@10
|
532 /**
|
yading@10
|
533 * Codec supports lossy compression. Audio and video codecs only.
|
yading@10
|
534 * @note a codec may support both lossy and lossless
|
yading@10
|
535 * compression modes
|
yading@10
|
536 */
|
yading@10
|
537 #define AV_CODEC_PROP_LOSSY (1 << 1)
|
yading@10
|
538 /**
|
yading@10
|
539 * Codec supports lossless compression. Audio and video codecs only.
|
yading@10
|
540 */
|
yading@10
|
541 #define AV_CODEC_PROP_LOSSLESS (1 << 2)
|
yading@10
|
542 /**
|
yading@10
|
543 * Subtitle codec is bitmap based
|
yading@10
|
544 * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
|
yading@10
|
545 */
|
yading@10
|
546 #define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
|
yading@10
|
547 /**
|
yading@10
|
548 * Subtitle codec is text based.
|
yading@10
|
549 * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
|
yading@10
|
550 */
|
yading@10
|
551 #define AV_CODEC_PROP_TEXT_SUB (1 << 17)
|
yading@10
|
552
|
yading@10
|
553 /**
|
yading@10
|
554 * @ingroup lavc_decoding
|
yading@10
|
555 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
|
yading@10
|
556 * This is mainly needed because some optimized bitstream readers read
|
yading@10
|
557 * 32 or 64 bit at once and could read over the end.<br>
|
yading@10
|
558 * Note: If the first 23 bits of the additional bytes are not 0, then damaged
|
yading@10
|
559 * MPEG bitstreams could cause overread and segfault.
|
yading@10
|
560 */
|
yading@10
|
561 #define FF_INPUT_BUFFER_PADDING_SIZE 16
|
yading@10
|
562
|
yading@10
|
563 /**
|
yading@10
|
564 * @ingroup lavc_encoding
|
yading@10
|
565 * minimum encoding buffer size
|
yading@10
|
566 * Used to avoid some checks during header writing.
|
yading@10
|
567 */
|
yading@10
|
568 #define FF_MIN_BUFFER_SIZE 16384
|
yading@10
|
569
|
yading@10
|
570
|
yading@10
|
571 /**
|
yading@10
|
572 * @ingroup lavc_encoding
|
yading@10
|
573 * motion estimation type.
|
yading@10
|
574 */
|
yading@10
|
575 enum Motion_Est_ID {
|
yading@10
|
576 ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed
|
yading@10
|
577 ME_FULL,
|
yading@10
|
578 ME_LOG,
|
yading@10
|
579 ME_PHODS,
|
yading@10
|
580 ME_EPZS, ///< enhanced predictive zonal search
|
yading@10
|
581 ME_X1, ///< reserved for experiments
|
yading@10
|
582 ME_HEX, ///< hexagon based search
|
yading@10
|
583 ME_UMH, ///< uneven multi-hexagon search
|
yading@10
|
584 ME_TESA, ///< transformed exhaustive search algorithm
|
yading@10
|
585 ME_ITER=50, ///< iterative search
|
yading@10
|
586 };
|
yading@10
|
587
|
yading@10
|
588 /**
|
yading@10
|
589 * @ingroup lavc_decoding
|
yading@10
|
590 */
|
yading@10
|
591 enum AVDiscard{
|
yading@10
|
592 /* We leave some space between them for extensions (drop some
|
yading@10
|
593 * keyframes for intra-only or drop just some bidir frames). */
|
yading@10
|
594 AVDISCARD_NONE =-16, ///< discard nothing
|
yading@10
|
595 AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
|
yading@10
|
596 AVDISCARD_NONREF = 8, ///< discard all non reference
|
yading@10
|
597 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
|
yading@10
|
598 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
|
yading@10
|
599 AVDISCARD_ALL = 48, ///< discard all
|
yading@10
|
600 };
|
yading@10
|
601
|
yading@10
|
602 enum AVColorPrimaries{
|
yading@10
|
603 AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
|
yading@10
|
604 AVCOL_PRI_UNSPECIFIED = 2,
|
yading@10
|
605 AVCOL_PRI_BT470M = 4,
|
yading@10
|
606 AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
|
yading@10
|
607 AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
|
yading@10
|
608 AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
|
yading@10
|
609 AVCOL_PRI_FILM = 8,
|
yading@10
|
610 AVCOL_PRI_NB , ///< Not part of ABI
|
yading@10
|
611 };
|
yading@10
|
612
|
yading@10
|
613 enum AVColorTransferCharacteristic{
|
yading@10
|
614 AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
|
yading@10
|
615 AVCOL_TRC_UNSPECIFIED = 2,
|
yading@10
|
616 AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
|
yading@10
|
617 AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
|
yading@10
|
618 AVCOL_TRC_SMPTE240M = 7,
|
yading@10
|
619 AVCOL_TRC_NB , ///< Not part of ABI
|
yading@10
|
620 };
|
yading@10
|
621
|
yading@10
|
622 enum AVColorSpace{
|
yading@10
|
623 AVCOL_SPC_RGB = 0,
|
yading@10
|
624 AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
|
yading@10
|
625 AVCOL_SPC_UNSPECIFIED = 2,
|
yading@10
|
626 AVCOL_SPC_FCC = 4,
|
yading@10
|
627 AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
|
yading@10
|
628 AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
|
yading@10
|
629 AVCOL_SPC_SMPTE240M = 7,
|
yading@10
|
630 AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
|
yading@10
|
631 AVCOL_SPC_NB , ///< Not part of ABI
|
yading@10
|
632 };
|
yading@10
|
633 #define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG
|
yading@10
|
634
|
yading@10
|
635 enum AVColorRange{
|
yading@10
|
636 AVCOL_RANGE_UNSPECIFIED = 0,
|
yading@10
|
637 AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
|
yading@10
|
638 AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
|
yading@10
|
639 AVCOL_RANGE_NB , ///< Not part of ABI
|
yading@10
|
640 };
|
yading@10
|
641
|
yading@10
|
642 /**
|
yading@10
|
643 * X X 3 4 X X are luma samples,
|
yading@10
|
644 * 1 2 1-6 are possible chroma positions
|
yading@10
|
645 * X X 5 6 X 0 is undefined/unknown position
|
yading@10
|
646 */
|
yading@10
|
647 enum AVChromaLocation{
|
yading@10
|
648 AVCHROMA_LOC_UNSPECIFIED = 0,
|
yading@10
|
649 AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default
|
yading@10
|
650 AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263
|
yading@10
|
651 AVCHROMA_LOC_TOPLEFT = 3, ///< DV
|
yading@10
|
652 AVCHROMA_LOC_TOP = 4,
|
yading@10
|
653 AVCHROMA_LOC_BOTTOMLEFT = 5,
|
yading@10
|
654 AVCHROMA_LOC_BOTTOM = 6,
|
yading@10
|
655 AVCHROMA_LOC_NB , ///< Not part of ABI
|
yading@10
|
656 };
|
yading@10
|
657
|
yading@10
|
658 enum AVAudioServiceType {
|
yading@10
|
659 AV_AUDIO_SERVICE_TYPE_MAIN = 0,
|
yading@10
|
660 AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
|
yading@10
|
661 AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
|
yading@10
|
662 AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
|
yading@10
|
663 AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
|
yading@10
|
664 AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
|
yading@10
|
665 AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
|
yading@10
|
666 AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
|
yading@10
|
667 AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
|
yading@10
|
668 AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
|
yading@10
|
669 };
|
yading@10
|
670
|
yading@10
|
671 /**
|
yading@10
|
672 * @ingroup lavc_encoding
|
yading@10
|
673 */
|
yading@10
|
674 typedef struct RcOverride{
|
yading@10
|
675 int start_frame;
|
yading@10
|
676 int end_frame;
|
yading@10
|
677 int qscale; // If this is 0 then quality_factor will be used instead.
|
yading@10
|
678 float quality_factor;
|
yading@10
|
679 } RcOverride;
|
yading@10
|
680
|
yading@10
|
681 #define FF_MAX_B_FRAMES 16
|
yading@10
|
682
|
yading@10
|
683 /* encoding support
|
yading@10
|
684 These flags can be passed in AVCodecContext.flags before initialization.
|
yading@10
|
685 Note: Not everything is supported yet.
|
yading@10
|
686 */
|
yading@10
|
687
|
yading@10
|
688 /**
|
yading@10
|
689 * Allow decoders to produce frames with data planes that are not aligned
|
yading@10
|
690 * to CPU requirements (e.g. due to cropping).
|
yading@10
|
691 */
|
yading@10
|
692 #define CODEC_FLAG_UNALIGNED 0x0001
|
yading@10
|
693 #define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale.
|
yading@10
|
694 #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263.
|
yading@10
|
695 #define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC.
|
yading@10
|
696 #define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
|
yading@10
|
697 #define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
|
yading@10
|
698 /**
|
yading@10
|
699 * The parent program guarantees that the input for B-frames containing
|
yading@10
|
700 * streams is not written to for at least s->max_b_frames+1 frames, if
|
yading@10
|
701 * this is not set the input will be copied.
|
yading@10
|
702 */
|
yading@10
|
703 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
|
yading@10
|
704 #define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.
|
yading@10
|
705 #define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.
|
yading@10
|
706 #define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
|
yading@10
|
707 #define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
|
yading@10
|
708 #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
|
yading@10
|
709 #define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
|
yading@10
|
710 location instead of only at frame boundaries. */
|
yading@10
|
711 #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
|
yading@10
|
712 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
|
yading@10
|
713 #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
|
yading@10
|
714 #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
|
yading@10
|
715 #define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
|
yading@10
|
716 /* Fx : Flag for h263+ extra options */
|
yading@10
|
717 #define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
|
yading@10
|
718 #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
|
yading@10
|
719 #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
|
yading@10
|
720 #define CODEC_FLAG_CLOSED_GOP 0x80000000
|
yading@10
|
721 #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks.
|
yading@10
|
722 #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
|
yading@10
|
723 #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
|
yading@10
|
724 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. DEPRECATED!!!!
|
yading@10
|
725 #define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS.
|
yading@10
|
726
|
yading@10
|
727 #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
|
yading@10
|
728 #define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe
|
yading@10
|
729
|
yading@10
|
730 /* Unsupported options :
|
yading@10
|
731 * Syntax Arithmetic coding (SAC)
|
yading@10
|
732 * Reference Picture Selection
|
yading@10
|
733 * Independent Segment Decoding */
|
yading@10
|
734 /* /Fx */
|
yading@10
|
735 /* codec capabilities */
|
yading@10
|
736
|
yading@10
|
737 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
|
yading@10
|
738 /**
|
yading@10
|
739 * Codec uses get_buffer() for allocating buffers and supports custom allocators.
|
yading@10
|
740 * If not set, it might not use get_buffer() at all or use operations that
|
yading@10
|
741 * assume the buffer was allocated by avcodec_default_get_buffer.
|
yading@10
|
742 */
|
yading@10
|
743 #define CODEC_CAP_DR1 0x0002
|
yading@10
|
744 #define CODEC_CAP_TRUNCATED 0x0008
|
yading@10
|
745 /* Codec can export data for HW decoding (XvMC). */
|
yading@10
|
746 #define CODEC_CAP_HWACCEL 0x0010
|
yading@10
|
747 /**
|
yading@10
|
748 * Encoder or decoder requires flushing with NULL input at the end in order to
|
yading@10
|
749 * give the complete and correct output.
|
yading@10
|
750 *
|
yading@10
|
751 * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
|
yading@10
|
752 * with NULL data. The user can still send NULL data to the public encode
|
yading@10
|
753 * or decode function, but libavcodec will not pass it along to the codec
|
yading@10
|
754 * unless this flag is set.
|
yading@10
|
755 *
|
yading@10
|
756 * Decoders:
|
yading@10
|
757 * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
|
yading@10
|
758 * avpkt->size=0 at the end to get the delayed data until the decoder no longer
|
yading@10
|
759 * returns frames.
|
yading@10
|
760 *
|
yading@10
|
761 * Encoders:
|
yading@10
|
762 * The encoder needs to be fed with NULL data at the end of encoding until the
|
yading@10
|
763 * encoder no longer returns data.
|
yading@10
|
764 *
|
yading@10
|
765 * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
|
yading@10
|
766 * flag also means that the encoder must set the pts and duration for
|
yading@10
|
767 * each output packet. If this flag is not set, the pts and duration will
|
yading@10
|
768 * be determined by libavcodec from the input frame.
|
yading@10
|
769 */
|
yading@10
|
770 #define CODEC_CAP_DELAY 0x0020
|
yading@10
|
771 /**
|
yading@10
|
772 * Codec can be fed a final frame with a smaller size.
|
yading@10
|
773 * This can be used to prevent truncation of the last audio samples.
|
yading@10
|
774 */
|
yading@10
|
775 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
|
yading@10
|
776 /**
|
yading@10
|
777 * Codec can export data for HW decoding (VDPAU).
|
yading@10
|
778 */
|
yading@10
|
779 #define CODEC_CAP_HWACCEL_VDPAU 0x0080
|
yading@10
|
780 /**
|
yading@10
|
781 * Codec can output multiple frames per AVPacket
|
yading@10
|
782 * Normally demuxers return one frame at a time, demuxers which do not do
|
yading@10
|
783 * are connected to a parser to split what they return into proper frames.
|
yading@10
|
784 * This flag is reserved to the very rare category of codecs which have a
|
yading@10
|
785 * bitstream that cannot be split into frames without timeconsuming
|
yading@10
|
786 * operations like full decoding. Demuxers carring such bitstreams thus
|
yading@10
|
787 * may return multiple frames in a packet. This has many disadvantages like
|
yading@10
|
788 * prohibiting stream copy in many cases thus it should only be considered
|
yading@10
|
789 * as a last resort.
|
yading@10
|
790 */
|
yading@10
|
791 #define CODEC_CAP_SUBFRAMES 0x0100
|
yading@10
|
792 /**
|
yading@10
|
793 * Codec is experimental and is thus avoided in favor of non experimental
|
yading@10
|
794 * encoders
|
yading@10
|
795 */
|
yading@10
|
796 #define CODEC_CAP_EXPERIMENTAL 0x0200
|
yading@10
|
797 /**
|
yading@10
|
798 * Codec should fill in channel configuration and samplerate instead of container
|
yading@10
|
799 */
|
yading@10
|
800 #define CODEC_CAP_CHANNEL_CONF 0x0400
|
yading@10
|
801
|
yading@10
|
802 /**
|
yading@10
|
803 * Codec is able to deal with negative linesizes
|
yading@10
|
804 */
|
yading@10
|
805 #define CODEC_CAP_NEG_LINESIZES 0x0800
|
yading@10
|
806
|
yading@10
|
807 /**
|
yading@10
|
808 * Codec supports frame-level multithreading.
|
yading@10
|
809 */
|
yading@10
|
810 #define CODEC_CAP_FRAME_THREADS 0x1000
|
yading@10
|
811 /**
|
yading@10
|
812 * Codec supports slice-based (or partition-based) multithreading.
|
yading@10
|
813 */
|
yading@10
|
814 #define CODEC_CAP_SLICE_THREADS 0x2000
|
yading@10
|
815 /**
|
yading@10
|
816 * Codec supports changed parameters at any point.
|
yading@10
|
817 */
|
yading@10
|
818 #define CODEC_CAP_PARAM_CHANGE 0x4000
|
yading@10
|
819 /**
|
yading@10
|
820 * Codec supports avctx->thread_count == 0 (auto).
|
yading@10
|
821 */
|
yading@10
|
822 #define CODEC_CAP_AUTO_THREADS 0x8000
|
yading@10
|
823 /**
|
yading@10
|
824 * Audio encoder supports receiving a different number of samples in each call.
|
yading@10
|
825 */
|
yading@10
|
826 #define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000
|
yading@10
|
827 /**
|
yading@10
|
828 * Codec is intra only.
|
yading@10
|
829 */
|
yading@10
|
830 #define CODEC_CAP_INTRA_ONLY 0x40000000
|
yading@10
|
831 /**
|
yading@10
|
832 * Codec is lossless.
|
yading@10
|
833 */
|
yading@10
|
834 #define CODEC_CAP_LOSSLESS 0x80000000
|
yading@10
|
835
|
yading@10
|
836 //The following defines may change, don't expect compatibility if you use them.
|
yading@10
|
837 #define MB_TYPE_INTRA4x4 0x0001
|
yading@10
|
838 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
|
yading@10
|
839 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific
|
yading@10
|
840 #define MB_TYPE_16x16 0x0008
|
yading@10
|
841 #define MB_TYPE_16x8 0x0010
|
yading@10
|
842 #define MB_TYPE_8x16 0x0020
|
yading@10
|
843 #define MB_TYPE_8x8 0x0040
|
yading@10
|
844 #define MB_TYPE_INTERLACED 0x0080
|
yading@10
|
845 #define MB_TYPE_DIRECT2 0x0100 //FIXME
|
yading@10
|
846 #define MB_TYPE_ACPRED 0x0200
|
yading@10
|
847 #define MB_TYPE_GMC 0x0400
|
yading@10
|
848 #define MB_TYPE_SKIP 0x0800
|
yading@10
|
849 #define MB_TYPE_P0L0 0x1000
|
yading@10
|
850 #define MB_TYPE_P1L0 0x2000
|
yading@10
|
851 #define MB_TYPE_P0L1 0x4000
|
yading@10
|
852 #define MB_TYPE_P1L1 0x8000
|
yading@10
|
853 #define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
|
yading@10
|
854 #define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
|
yading@10
|
855 #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
|
yading@10
|
856 #define MB_TYPE_QUANT 0x00010000
|
yading@10
|
857 #define MB_TYPE_CBP 0x00020000
|
yading@10
|
858 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
|
yading@10
|
859
|
yading@10
|
860 /**
|
yading@10
|
861 * Pan Scan area.
|
yading@10
|
862 * This specifies the area which should be displayed.
|
yading@10
|
863 * Note there may be multiple such areas for one frame.
|
yading@10
|
864 */
|
yading@10
|
865 typedef struct AVPanScan{
|
yading@10
|
866 /**
|
yading@10
|
867 * id
|
yading@10
|
868 * - encoding: Set by user.
|
yading@10
|
869 * - decoding: Set by libavcodec.
|
yading@10
|
870 */
|
yading@10
|
871 int id;
|
yading@10
|
872
|
yading@10
|
873 /**
|
yading@10
|
874 * width and height in 1/16 pel
|
yading@10
|
875 * - encoding: Set by user.
|
yading@10
|
876 * - decoding: Set by libavcodec.
|
yading@10
|
877 */
|
yading@10
|
878 int width;
|
yading@10
|
879 int height;
|
yading@10
|
880
|
yading@10
|
881 /**
|
yading@10
|
882 * position of the top left corner in 1/16 pel for up to 3 fields/frames
|
yading@10
|
883 * - encoding: Set by user.
|
yading@10
|
884 * - decoding: Set by libavcodec.
|
yading@10
|
885 */
|
yading@10
|
886 int16_t position[3][2];
|
yading@10
|
887 }AVPanScan;
|
yading@10
|
888
|
yading@10
|
889 #define FF_QSCALE_TYPE_MPEG1 0
|
yading@10
|
890 #define FF_QSCALE_TYPE_MPEG2 1
|
yading@10
|
891 #define FF_QSCALE_TYPE_H264 2
|
yading@10
|
892 #define FF_QSCALE_TYPE_VP56 3
|
yading@10
|
893
|
yading@10
|
894 #if FF_API_GET_BUFFER
|
yading@10
|
895 #define FF_BUFFER_TYPE_INTERNAL 1
|
yading@10
|
896 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
|
yading@10
|
897 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
|
yading@10
|
898 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
|
yading@10
|
899
|
yading@10
|
900 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
|
yading@10
|
901 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
|
yading@10
|
902 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
|
yading@10
|
903 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
|
yading@10
|
904 #endif
|
yading@10
|
905
|
yading@10
|
906 /**
|
yading@10
|
907 * The decoder will keep a reference to the frame and may reuse it later.
|
yading@10
|
908 */
|
yading@10
|
909 #define AV_GET_BUFFER_FLAG_REF (1 << 0)
|
yading@10
|
910
|
yading@10
|
911 /**
|
yading@10
|
912 * @defgroup lavc_packet AVPacket
|
yading@10
|
913 *
|
yading@10
|
914 * Types and functions for working with AVPacket.
|
yading@10
|
915 * @{
|
yading@10
|
916 */
|
yading@10
|
917 enum AVPacketSideDataType {
|
yading@10
|
918 AV_PKT_DATA_PALETTE,
|
yading@10
|
919 AV_PKT_DATA_NEW_EXTRADATA,
|
yading@10
|
920
|
yading@10
|
921 /**
|
yading@10
|
922 * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
|
yading@10
|
923 * @code
|
yading@10
|
924 * u32le param_flags
|
yading@10
|
925 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
|
yading@10
|
926 * s32le channel_count
|
yading@10
|
927 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
|
yading@10
|
928 * u64le channel_layout
|
yading@10
|
929 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
|
yading@10
|
930 * s32le sample_rate
|
yading@10
|
931 * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
|
yading@10
|
932 * s32le width
|
yading@10
|
933 * s32le height
|
yading@10
|
934 * @endcode
|
yading@10
|
935 */
|
yading@10
|
936 AV_PKT_DATA_PARAM_CHANGE,
|
yading@10
|
937
|
yading@10
|
938 /**
|
yading@10
|
939 * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
|
yading@10
|
940 * structures with info about macroblocks relevant to splitting the
|
yading@10
|
941 * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
|
yading@10
|
942 * That is, it does not necessarily contain info about all macroblocks,
|
yading@10
|
943 * as long as the distance between macroblocks in the info is smaller
|
yading@10
|
944 * than the target payload size.
|
yading@10
|
945 * Each MB info structure is 12 bytes, and is laid out as follows:
|
yading@10
|
946 * @code
|
yading@10
|
947 * u32le bit offset from the start of the packet
|
yading@10
|
948 * u8 current quantizer at the start of the macroblock
|
yading@10
|
949 * u8 GOB number
|
yading@10
|
950 * u16le macroblock address within the GOB
|
yading@10
|
951 * u8 horizontal MV predictor
|
yading@10
|
952 * u8 vertical MV predictor
|
yading@10
|
953 * u8 horizontal MV predictor for block number 3
|
yading@10
|
954 * u8 vertical MV predictor for block number 3
|
yading@10
|
955 * @endcode
|
yading@10
|
956 */
|
yading@10
|
957 AV_PKT_DATA_H263_MB_INFO,
|
yading@10
|
958
|
yading@10
|
959 /**
|
yading@10
|
960 * Recommmends skipping the specified number of samples
|
yading@10
|
961 * @code
|
yading@10
|
962 * u32le number of samples to skip from start of this packet
|
yading@10
|
963 * u32le number of samples to skip from end of this packet
|
yading@10
|
964 * u8 reason for start skip
|
yading@10
|
965 * u8 reason for end skip (0=padding silence, 1=convergence)
|
yading@10
|
966 * @endcode
|
yading@10
|
967 */
|
yading@10
|
968 AV_PKT_DATA_SKIP_SAMPLES=70,
|
yading@10
|
969
|
yading@10
|
970 /**
|
yading@10
|
971 * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
|
yading@10
|
972 * the packet may contain "dual mono" audio specific to Japanese DTV
|
yading@10
|
973 * and if it is true, recommends only the selected channel to be used.
|
yading@10
|
974 * @code
|
yading@10
|
975 * u8 selected channels (0=mail/left, 1=sub/right, 2=both)
|
yading@10
|
976 * @endcode
|
yading@10
|
977 */
|
yading@10
|
978 AV_PKT_DATA_JP_DUALMONO,
|
yading@10
|
979
|
yading@10
|
980 /**
|
yading@10
|
981 * A list of zero terminated key/value strings. There is no end marker for
|
yading@10
|
982 * the list, so it is required to rely on the side data size to stop.
|
yading@10
|
983 */
|
yading@10
|
984 AV_PKT_DATA_STRINGS_METADATA,
|
yading@10
|
985
|
yading@10
|
986 /**
|
yading@10
|
987 * Subtitle event position
|
yading@10
|
988 * @code
|
yading@10
|
989 * u32le x1
|
yading@10
|
990 * u32le y1
|
yading@10
|
991 * u32le x2
|
yading@10
|
992 * u32le y2
|
yading@10
|
993 * @endcode
|
yading@10
|
994 */
|
yading@10
|
995 AV_PKT_DATA_SUBTITLE_POSITION,
|
yading@10
|
996
|
yading@10
|
997 /**
|
yading@10
|
998 * Data found in BlockAdditional element of matroska container. There is
|
yading@10
|
999 * no end marker for the data, so it is required to rely on the side data
|
yading@10
|
1000 * size to recognize the end. 8 byte id (as found in BlockAddId) followed
|
yading@10
|
1001 * by data.
|
yading@10
|
1002 */
|
yading@10
|
1003 AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
|
yading@10
|
1004 };
|
yading@10
|
1005
|
yading@10
|
1006 /**
|
yading@10
|
1007 * This structure stores compressed data. It is typically exported by demuxers
|
yading@10
|
1008 * and then passed as input to decoders, or received as output from encoders and
|
yading@10
|
1009 * then passed to muxers.
|
yading@10
|
1010 *
|
yading@10
|
1011 * For video, it should typically contain one compressed frame. For audio it may
|
yading@10
|
1012 * contain several compressed frames.
|
yading@10
|
1013 *
|
yading@10
|
1014 * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
|
yading@10
|
1015 * ABI. Thus it may be allocated on stack and no new fields can be added to it
|
yading@10
|
1016 * without libavcodec and libavformat major bump.
|
yading@10
|
1017 *
|
yading@10
|
1018 * The semantics of data ownership depends on the buf or destruct (deprecated)
|
yading@10
|
1019 * fields. If either is set, the packet data is dynamically allocated and is
|
yading@10
|
1020 * valid indefinitely until av_free_packet() is called (which in turn calls
|
yading@10
|
1021 * av_buffer_unref()/the destruct callback to free the data). If neither is set,
|
yading@10
|
1022 * the packet data is typically backed by some static buffer somewhere and is
|
yading@10
|
1023 * only valid for a limited time (e.g. until the next read call when demuxing).
|
yading@10
|
1024 *
|
yading@10
|
1025 * The side data is always allocated with av_malloc() and is freed in
|
yading@10
|
1026 * av_free_packet().
|
yading@10
|
1027 */
|
yading@10
|
1028 typedef struct AVPacket {
|
yading@10
|
1029 /**
|
yading@10
|
1030 * A reference to the reference-counted buffer where the packet data is
|
yading@10
|
1031 * stored.
|
yading@10
|
1032 * May be NULL, then the packet data is not reference-counted.
|
yading@10
|
1033 */
|
yading@10
|
1034 AVBufferRef *buf;
|
yading@10
|
1035 /**
|
yading@10
|
1036 * Presentation timestamp in AVStream->time_base units; the time at which
|
yading@10
|
1037 * the decompressed packet will be presented to the user.
|
yading@10
|
1038 * Can be AV_NOPTS_VALUE if it is not stored in the file.
|
yading@10
|
1039 * pts MUST be larger or equal to dts as presentation cannot happen before
|
yading@10
|
1040 * decompression, unless one wants to view hex dumps. Some formats misuse
|
yading@10
|
1041 * the terms dts and pts/cts to mean something different. Such timestamps
|
yading@10
|
1042 * must be converted to true pts/dts before they are stored in AVPacket.
|
yading@10
|
1043 */
|
yading@10
|
1044 int64_t pts;
|
yading@10
|
1045 /**
|
yading@10
|
1046 * Decompression timestamp in AVStream->time_base units; the time at which
|
yading@10
|
1047 * the packet is decompressed.
|
yading@10
|
1048 * Can be AV_NOPTS_VALUE if it is not stored in the file.
|
yading@10
|
1049 */
|
yading@10
|
1050 int64_t dts;
|
yading@10
|
1051 uint8_t *data;
|
yading@10
|
1052 int size;
|
yading@10
|
1053 int stream_index;
|
yading@10
|
1054 /**
|
yading@10
|
1055 * A combination of AV_PKT_FLAG values
|
yading@10
|
1056 */
|
yading@10
|
1057 int flags;
|
yading@10
|
1058 /**
|
yading@10
|
1059 * Additional packet data that can be provided by the container.
|
yading@10
|
1060 * Packet can contain several types of side information.
|
yading@10
|
1061 */
|
yading@10
|
1062 struct {
|
yading@10
|
1063 uint8_t *data;
|
yading@10
|
1064 int size;
|
yading@10
|
1065 enum AVPacketSideDataType type;
|
yading@10
|
1066 } *side_data;
|
yading@10
|
1067 int side_data_elems;
|
yading@10
|
1068
|
yading@10
|
1069 /**
|
yading@10
|
1070 * Duration of this packet in AVStream->time_base units, 0 if unknown.
|
yading@10
|
1071 * Equals next_pts - this_pts in presentation order.
|
yading@10
|
1072 */
|
yading@10
|
1073 int duration;
|
yading@10
|
1074 #if FF_API_DESTRUCT_PACKET
|
yading@10
|
1075 attribute_deprecated
|
yading@10
|
1076 void (*destruct)(struct AVPacket *);
|
yading@10
|
1077 attribute_deprecated
|
yading@10
|
1078 void *priv;
|
yading@10
|
1079 #endif
|
yading@10
|
1080 int64_t pos; ///< byte position in stream, -1 if unknown
|
yading@10
|
1081
|
yading@10
|
1082 /**
|
yading@10
|
1083 * Time difference in AVStream->time_base units from the pts of this
|
yading@10
|
1084 * packet to the point at which the output from the decoder has converged
|
yading@10
|
1085 * independent from the availability of previous frames. That is, the
|
yading@10
|
1086 * frames are virtually identical no matter if decoding started from
|
yading@10
|
1087 * the very first frame or from this keyframe.
|
yading@10
|
1088 * Is AV_NOPTS_VALUE if unknown.
|
yading@10
|
1089 * This field is not the display duration of the current packet.
|
yading@10
|
1090 * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
|
yading@10
|
1091 * set.
|
yading@10
|
1092 *
|
yading@10
|
1093 * The purpose of this field is to allow seeking in streams that have no
|
yading@10
|
1094 * keyframes in the conventional sense. It corresponds to the
|
yading@10
|
1095 * recovery point SEI in H.264 and match_time_delta in NUT. It is also
|
yading@10
|
1096 * essential for some types of subtitle streams to ensure that all
|
yading@10
|
1097 * subtitles are correctly displayed after seeking.
|
yading@10
|
1098 */
|
yading@10
|
1099 int64_t convergence_duration;
|
yading@10
|
1100 } AVPacket;
|
yading@10
|
1101 #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
|
yading@10
|
1102 #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
|
yading@10
|
1103
|
yading@10
|
1104 enum AVSideDataParamChangeFlags {
|
yading@10
|
1105 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
|
yading@10
|
1106 AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
|
yading@10
|
1107 AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
|
yading@10
|
1108 AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
|
yading@10
|
1109 };
|
yading@10
|
1110 /**
|
yading@10
|
1111 * @}
|
yading@10
|
1112 */
|
yading@10
|
1113
|
yading@10
|
1114 struct AVCodecInternal;
|
yading@10
|
1115
|
yading@10
|
1116 enum AVFieldOrder {
|
yading@10
|
1117 AV_FIELD_UNKNOWN,
|
yading@10
|
1118 AV_FIELD_PROGRESSIVE,
|
yading@10
|
1119 AV_FIELD_TT, //< Top coded_first, top displayed first
|
yading@10
|
1120 AV_FIELD_BB, //< Bottom coded first, bottom displayed first
|
yading@10
|
1121 AV_FIELD_TB, //< Top coded first, bottom displayed first
|
yading@10
|
1122 AV_FIELD_BT, //< Bottom coded first, top displayed first
|
yading@10
|
1123 };
|
yading@10
|
1124
|
yading@10
|
1125 /**
|
yading@10
|
1126 * main external API structure.
|
yading@10
|
1127 * New fields can be added to the end with minor version bumps.
|
yading@10
|
1128 * Removal, reordering and changes to existing fields require a major
|
yading@10
|
1129 * version bump.
|
yading@10
|
1130 * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user
|
yading@10
|
1131 * applications.
|
yading@10
|
1132 * sizeof(AVCodecContext) must not be used outside libav*.
|
yading@10
|
1133 */
|
yading@10
|
1134 typedef struct AVCodecContext {
|
yading@10
|
1135 /**
|
yading@10
|
1136 * information on struct for av_log
|
yading@10
|
1137 * - set by avcodec_alloc_context3
|
yading@10
|
1138 */
|
yading@10
|
1139 const AVClass *av_class;
|
yading@10
|
1140 int log_level_offset;
|
yading@10
|
1141
|
yading@10
|
1142 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
|
yading@10
|
1143 const struct AVCodec *codec;
|
yading@10
|
1144 char codec_name[32];
|
yading@10
|
1145 enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
|
yading@10
|
1146
|
yading@10
|
1147 /**
|
yading@10
|
1148 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
|
yading@10
|
1149 * This is used to work around some encoder bugs.
|
yading@10
|
1150 * A demuxer should set this to what is stored in the field used to identify the codec.
|
yading@10
|
1151 * If there are multiple such fields in a container then the demuxer should choose the one
|
yading@10
|
1152 * which maximizes the information about the used codec.
|
yading@10
|
1153 * If the codec tag field in a container is larger than 32 bits then the demuxer should
|
yading@10
|
1154 * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
|
yading@10
|
1155 * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
|
yading@10
|
1156 * first.
|
yading@10
|
1157 * - encoding: Set by user, if not then the default based on codec_id will be used.
|
yading@10
|
1158 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
|
yading@10
|
1159 */
|
yading@10
|
1160 unsigned int codec_tag;
|
yading@10
|
1161
|
yading@10
|
1162 /**
|
yading@10
|
1163 * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
|
yading@10
|
1164 * This is used to work around some encoder bugs.
|
yading@10
|
1165 * - encoding: unused
|
yading@10
|
1166 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
|
yading@10
|
1167 */
|
yading@10
|
1168 unsigned int stream_codec_tag;
|
yading@10
|
1169
|
yading@10
|
1170 void *priv_data;
|
yading@10
|
1171
|
yading@10
|
1172 /**
|
yading@10
|
1173 * Private context used for internal data.
|
yading@10
|
1174 *
|
yading@10
|
1175 * Unlike priv_data, this is not codec-specific. It is used in general
|
yading@10
|
1176 * libavcodec functions.
|
yading@10
|
1177 */
|
yading@10
|
1178 struct AVCodecInternal *internal;
|
yading@10
|
1179
|
yading@10
|
1180 /**
|
yading@10
|
1181 * Private data of the user, can be used to carry app specific stuff.
|
yading@10
|
1182 * - encoding: Set by user.
|
yading@10
|
1183 * - decoding: Set by user.
|
yading@10
|
1184 */
|
yading@10
|
1185 void *opaque;
|
yading@10
|
1186
|
yading@10
|
1187 /**
|
yading@10
|
1188 * the average bitrate
|
yading@10
|
1189 * - encoding: Set by user; unused for constant quantizer encoding.
|
yading@10
|
1190 * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
|
yading@10
|
1191 */
|
yading@10
|
1192 int bit_rate;
|
yading@10
|
1193
|
yading@10
|
1194 /**
|
yading@10
|
1195 * number of bits the bitstream is allowed to diverge from the reference.
|
yading@10
|
1196 * the reference can be CBR (for CBR pass1) or VBR (for pass2)
|
yading@10
|
1197 * - encoding: Set by user; unused for constant quantizer encoding.
|
yading@10
|
1198 * - decoding: unused
|
yading@10
|
1199 */
|
yading@10
|
1200 int bit_rate_tolerance;
|
yading@10
|
1201
|
yading@10
|
1202 /**
|
yading@10
|
1203 * Global quality for codecs which cannot change it per frame.
|
yading@10
|
1204 * This should be proportional to MPEG-1/2/4 qscale.
|
yading@10
|
1205 * - encoding: Set by user.
|
yading@10
|
1206 * - decoding: unused
|
yading@10
|
1207 */
|
yading@10
|
1208 int global_quality;
|
yading@10
|
1209
|
yading@10
|
1210 /**
|
yading@10
|
1211 * - encoding: Set by user.
|
yading@10
|
1212 * - decoding: unused
|
yading@10
|
1213 */
|
yading@10
|
1214 int compression_level;
|
yading@10
|
1215 #define FF_COMPRESSION_DEFAULT -1
|
yading@10
|
1216
|
yading@10
|
1217 /**
|
yading@10
|
1218 * CODEC_FLAG_*.
|
yading@10
|
1219 * - encoding: Set by user.
|
yading@10
|
1220 * - decoding: Set by user.
|
yading@10
|
1221 */
|
yading@10
|
1222 int flags;
|
yading@10
|
1223
|
yading@10
|
1224 /**
|
yading@10
|
1225 * CODEC_FLAG2_*
|
yading@10
|
1226 * - encoding: Set by user.
|
yading@10
|
1227 * - decoding: Set by user.
|
yading@10
|
1228 */
|
yading@10
|
1229 int flags2;
|
yading@10
|
1230
|
yading@10
|
1231 /**
|
yading@10
|
1232 * some codecs need / can use extradata like Huffman tables.
|
yading@10
|
1233 * mjpeg: Huffman tables
|
yading@10
|
1234 * rv10: additional flags
|
yading@10
|
1235 * mpeg4: global headers (they can be in the bitstream or here)
|
yading@10
|
1236 * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
|
yading@10
|
1237 * than extradata_size to avoid prolems if it is read with the bitstream reader.
|
yading@10
|
1238 * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
|
yading@10
|
1239 * - encoding: Set/allocated/freed by libavcodec.
|
yading@10
|
1240 * - decoding: Set/allocated/freed by user.
|
yading@10
|
1241 */
|
yading@10
|
1242 uint8_t *extradata;
|
yading@10
|
1243 int extradata_size;
|
yading@10
|
1244
|
yading@10
|
1245 /**
|
yading@10
|
1246 * This is the fundamental unit of time (in seconds) in terms
|
yading@10
|
1247 * of which frame timestamps are represented. For fixed-fps content,
|
yading@10
|
1248 * timebase should be 1/framerate and timestamp increments should be
|
yading@10
|
1249 * identically 1.
|
yading@10
|
1250 * - encoding: MUST be set by user.
|
yading@10
|
1251 * - decoding: Set by libavcodec.
|
yading@10
|
1252 */
|
yading@10
|
1253 AVRational time_base;
|
yading@10
|
1254
|
yading@10
|
1255 /**
|
yading@10
|
1256 * For some codecs, the time base is closer to the field rate than the frame rate.
|
yading@10
|
1257 * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
|
yading@10
|
1258 * if no telecine is used ...
|
yading@10
|
1259 *
|
yading@10
|
1260 * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
|
yading@10
|
1261 */
|
yading@10
|
1262 int ticks_per_frame;
|
yading@10
|
1263
|
yading@10
|
1264 /**
|
yading@10
|
1265 * Codec delay.
|
yading@10
|
1266 *
|
yading@10
|
1267 * Encoding: Number of frames delay there will be from the encoder input to
|
yading@10
|
1268 * the decoder output. (we assume the decoder matches the spec)
|
yading@10
|
1269 * Decoding: Number of frames delay in addition to what a standard decoder
|
yading@10
|
1270 * as specified in the spec would produce.
|
yading@10
|
1271 *
|
yading@10
|
1272 * Video:
|
yading@10
|
1273 * Number of frames the decoded output will be delayed relative to the
|
yading@10
|
1274 * encoded input.
|
yading@10
|
1275 *
|
yading@10
|
1276 * Audio:
|
yading@10
|
1277 * For encoding, this is the number of "priming" samples added to the
|
yading@10
|
1278 * beginning of the stream. The decoded output will be delayed by this
|
yading@10
|
1279 * many samples relative to the input to the encoder. Note that this
|
yading@10
|
1280 * field is purely informational and does not directly affect the pts
|
yading@10
|
1281 * output by the encoder, which should always be based on the actual
|
yading@10
|
1282 * presentation time, including any delay.
|
yading@10
|
1283 * For decoding, this is the number of samples the decoder needs to
|
yading@10
|
1284 * output before the decoder's output is valid. When seeking, you should
|
yading@10
|
1285 * start decoding this many samples prior to your desired seek point.
|
yading@10
|
1286 *
|
yading@10
|
1287 * - encoding: Set by libavcodec.
|
yading@10
|
1288 * - decoding: Set by libavcodec.
|
yading@10
|
1289 */
|
yading@10
|
1290 int delay;
|
yading@10
|
1291
|
yading@10
|
1292
|
yading@10
|
1293 /* video only */
|
yading@10
|
1294 /**
|
yading@10
|
1295 * picture width / height.
|
yading@10
|
1296 * - encoding: MUST be set by user.
|
yading@10
|
1297 * - decoding: May be set by the user before opening the decoder if known e.g.
|
yading@10
|
1298 * from the container. Some decoders will require the dimensions
|
yading@10
|
1299 * to be set by the caller. During decoding, the decoder may
|
yading@10
|
1300 * overwrite those values as required.
|
yading@10
|
1301 */
|
yading@10
|
1302 int width, height;
|
yading@10
|
1303
|
yading@10
|
1304 /**
|
yading@10
|
1305 * Bitstream width / height, may be different from width/height e.g. when
|
yading@10
|
1306 * the decoded frame is cropped before being output or lowres is enabled.
|
yading@10
|
1307 * - encoding: unused
|
yading@10
|
1308 * - decoding: May be set by the user before opening the decoder if known
|
yading@10
|
1309 * e.g. from the container. During decoding, the decoder may
|
yading@10
|
1310 * overwrite those values as required.
|
yading@10
|
1311 */
|
yading@10
|
1312 int coded_width, coded_height;
|
yading@10
|
1313
|
yading@10
|
1314 #define FF_ASPECT_EXTENDED 15
|
yading@10
|
1315
|
yading@10
|
1316 /**
|
yading@10
|
1317 * the number of pictures in a group of pictures, or 0 for intra_only
|
yading@10
|
1318 * - encoding: Set by user.
|
yading@10
|
1319 * - decoding: unused
|
yading@10
|
1320 */
|
yading@10
|
1321 int gop_size;
|
yading@10
|
1322
|
yading@10
|
1323 /**
|
yading@10
|
1324 * Pixel format, see AV_PIX_FMT_xxx.
|
yading@10
|
1325 * May be set by the demuxer if known from headers.
|
yading@10
|
1326 * May be overridden by the decoder if it knows better.
|
yading@10
|
1327 * - encoding: Set by user.
|
yading@10
|
1328 * - decoding: Set by user if known, overridden by libavcodec if known
|
yading@10
|
1329 */
|
yading@10
|
1330 enum AVPixelFormat pix_fmt;
|
yading@10
|
1331
|
yading@10
|
1332 /**
|
yading@10
|
1333 * Motion estimation algorithm used for video coding.
|
yading@10
|
1334 * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
|
yading@10
|
1335 * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
|
yading@10
|
1336 * - encoding: MUST be set by user.
|
yading@10
|
1337 * - decoding: unused
|
yading@10
|
1338 */
|
yading@10
|
1339 int me_method;
|
yading@10
|
1340
|
yading@10
|
1341 /**
|
yading@10
|
1342 * If non NULL, 'draw_horiz_band' is called by the libavcodec
|
yading@10
|
1343 * decoder to draw a horizontal band. It improves cache usage. Not
|
yading@10
|
1344 * all codecs can do that. You must check the codec capabilities
|
yading@10
|
1345 * beforehand.
|
yading@10
|
1346 * When multithreading is used, it may be called from multiple threads
|
yading@10
|
1347 * at the same time; threads might draw different parts of the same AVFrame,
|
yading@10
|
1348 * or multiple AVFrames, and there is no guarantee that slices will be drawn
|
yading@10
|
1349 * in order.
|
yading@10
|
1350 * The function is also used by hardware acceleration APIs.
|
yading@10
|
1351 * It is called at least once during frame decoding to pass
|
yading@10
|
1352 * the data needed for hardware render.
|
yading@10
|
1353 * In that mode instead of pixel data, AVFrame points to
|
yading@10
|
1354 * a structure specific to the acceleration API. The application
|
yading@10
|
1355 * reads the structure and can change some fields to indicate progress
|
yading@10
|
1356 * or mark state.
|
yading@10
|
1357 * - encoding: unused
|
yading@10
|
1358 * - decoding: Set by user.
|
yading@10
|
1359 * @param height the height of the slice
|
yading@10
|
1360 * @param y the y position of the slice
|
yading@10
|
1361 * @param type 1->top field, 2->bottom field, 3->frame
|
yading@10
|
1362 * @param offset offset into the AVFrame.data from which the slice should be read
|
yading@10
|
1363 */
|
yading@10
|
1364 void (*draw_horiz_band)(struct AVCodecContext *s,
|
yading@10
|
1365 const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
|
yading@10
|
1366 int y, int type, int height);
|
yading@10
|
1367
|
yading@10
|
1368 /**
|
yading@10
|
1369 * callback to negotiate the pixelFormat
|
yading@10
|
1370 * @param fmt is the list of formats which are supported by the codec,
|
yading@10
|
1371 * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
|
yading@10
|
1372 * The first is always the native one.
|
yading@10
|
1373 * @return the chosen format
|
yading@10
|
1374 * - encoding: unused
|
yading@10
|
1375 * - decoding: Set by user, if not set the native format will be chosen.
|
yading@10
|
1376 */
|
yading@10
|
1377 enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
|
yading@10
|
1378
|
yading@10
|
1379 /**
|
yading@10
|
1380 * maximum number of B-frames between non-B-frames
|
yading@10
|
1381 * Note: The output will be delayed by max_b_frames+1 relative to the input.
|
yading@10
|
1382 * - encoding: Set by user.
|
yading@10
|
1383 * - decoding: unused
|
yading@10
|
1384 */
|
yading@10
|
1385 int max_b_frames;
|
yading@10
|
1386
|
yading@10
|
1387 /**
|
yading@10
|
1388 * qscale factor between IP and B-frames
|
yading@10
|
1389 * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
|
yading@10
|
1390 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
|
yading@10
|
1391 * - encoding: Set by user.
|
yading@10
|
1392 * - decoding: unused
|
yading@10
|
1393 */
|
yading@10
|
1394 float b_quant_factor;
|
yading@10
|
1395
|
yading@10
|
1396 /** obsolete FIXME remove */
|
yading@10
|
1397 int rc_strategy;
|
yading@10
|
1398 #define FF_RC_STRATEGY_XVID 1
|
yading@10
|
1399
|
yading@10
|
1400 int b_frame_strategy;
|
yading@10
|
1401
|
yading@10
|
1402 /**
|
yading@10
|
1403 * qscale offset between IP and B-frames
|
yading@10
|
1404 * - encoding: Set by user.
|
yading@10
|
1405 * - decoding: unused
|
yading@10
|
1406 */
|
yading@10
|
1407 float b_quant_offset;
|
yading@10
|
1408
|
yading@10
|
1409 /**
|
yading@10
|
1410 * Size of the frame reordering buffer in the decoder.
|
yading@10
|
1411 * For MPEG-2 it is 1 IPB or 0 low delay IP.
|
yading@10
|
1412 * - encoding: Set by libavcodec.
|
yading@10
|
1413 * - decoding: Set by libavcodec.
|
yading@10
|
1414 */
|
yading@10
|
1415 int has_b_frames;
|
yading@10
|
1416
|
yading@10
|
1417 /**
|
yading@10
|
1418 * 0-> h263 quant 1-> mpeg quant
|
yading@10
|
1419 * - encoding: Set by user.
|
yading@10
|
1420 * - decoding: unused
|
yading@10
|
1421 */
|
yading@10
|
1422 int mpeg_quant;
|
yading@10
|
1423
|
yading@10
|
1424 /**
|
yading@10
|
1425 * qscale factor between P and I-frames
|
yading@10
|
1426 * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
|
yading@10
|
1427 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
|
yading@10
|
1428 * - encoding: Set by user.
|
yading@10
|
1429 * - decoding: unused
|
yading@10
|
1430 */
|
yading@10
|
1431 float i_quant_factor;
|
yading@10
|
1432
|
yading@10
|
1433 /**
|
yading@10
|
1434 * qscale offset between P and I-frames
|
yading@10
|
1435 * - encoding: Set by user.
|
yading@10
|
1436 * - decoding: unused
|
yading@10
|
1437 */
|
yading@10
|
1438 float i_quant_offset;
|
yading@10
|
1439
|
yading@10
|
1440 /**
|
yading@10
|
1441 * luminance masking (0-> disabled)
|
yading@10
|
1442 * - encoding: Set by user.
|
yading@10
|
1443 * - decoding: unused
|
yading@10
|
1444 */
|
yading@10
|
1445 float lumi_masking;
|
yading@10
|
1446
|
yading@10
|
1447 /**
|
yading@10
|
1448 * temporary complexity masking (0-> disabled)
|
yading@10
|
1449 * - encoding: Set by user.
|
yading@10
|
1450 * - decoding: unused
|
yading@10
|
1451 */
|
yading@10
|
1452 float temporal_cplx_masking;
|
yading@10
|
1453
|
yading@10
|
1454 /**
|
yading@10
|
1455 * spatial complexity masking (0-> disabled)
|
yading@10
|
1456 * - encoding: Set by user.
|
yading@10
|
1457 * - decoding: unused
|
yading@10
|
1458 */
|
yading@10
|
1459 float spatial_cplx_masking;
|
yading@10
|
1460
|
yading@10
|
1461 /**
|
yading@10
|
1462 * p block masking (0-> disabled)
|
yading@10
|
1463 * - encoding: Set by user.
|
yading@10
|
1464 * - decoding: unused
|
yading@10
|
1465 */
|
yading@10
|
1466 float p_masking;
|
yading@10
|
1467
|
yading@10
|
1468 /**
|
yading@10
|
1469 * darkness masking (0-> disabled)
|
yading@10
|
1470 * - encoding: Set by user.
|
yading@10
|
1471 * - decoding: unused
|
yading@10
|
1472 */
|
yading@10
|
1473 float dark_masking;
|
yading@10
|
1474
|
yading@10
|
1475 /**
|
yading@10
|
1476 * slice count
|
yading@10
|
1477 * - encoding: Set by libavcodec.
|
yading@10
|
1478 * - decoding: Set by user (or 0).
|
yading@10
|
1479 */
|
yading@10
|
1480 int slice_count;
|
yading@10
|
1481 /**
|
yading@10
|
1482 * prediction method (needed for huffyuv)
|
yading@10
|
1483 * - encoding: Set by user.
|
yading@10
|
1484 * - decoding: unused
|
yading@10
|
1485 */
|
yading@10
|
1486 int prediction_method;
|
yading@10
|
1487 #define FF_PRED_LEFT 0
|
yading@10
|
1488 #define FF_PRED_PLANE 1
|
yading@10
|
1489 #define FF_PRED_MEDIAN 2
|
yading@10
|
1490
|
yading@10
|
1491 /**
|
yading@10
|
1492 * slice offsets in the frame in bytes
|
yading@10
|
1493 * - encoding: Set/allocated by libavcodec.
|
yading@10
|
1494 * - decoding: Set/allocated by user (or NULL).
|
yading@10
|
1495 */
|
yading@10
|
1496 int *slice_offset;
|
yading@10
|
1497
|
yading@10
|
1498 /**
|
yading@10
|
1499 * sample aspect ratio (0 if unknown)
|
yading@10
|
1500 * That is the width of a pixel divided by the height of the pixel.
|
yading@10
|
1501 * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
|
yading@10
|
1502 * - encoding: Set by user.
|
yading@10
|
1503 * - decoding: Set by libavcodec.
|
yading@10
|
1504 */
|
yading@10
|
1505 AVRational sample_aspect_ratio;
|
yading@10
|
1506
|
yading@10
|
1507 /**
|
yading@10
|
1508 * motion estimation comparison function
|
yading@10
|
1509 * - encoding: Set by user.
|
yading@10
|
1510 * - decoding: unused
|
yading@10
|
1511 */
|
yading@10
|
1512 int me_cmp;
|
yading@10
|
1513 /**
|
yading@10
|
1514 * subpixel motion estimation comparison function
|
yading@10
|
1515 * - encoding: Set by user.
|
yading@10
|
1516 * - decoding: unused
|
yading@10
|
1517 */
|
yading@10
|
1518 int me_sub_cmp;
|
yading@10
|
1519 /**
|
yading@10
|
1520 * macroblock comparison function (not supported yet)
|
yading@10
|
1521 * - encoding: Set by user.
|
yading@10
|
1522 * - decoding: unused
|
yading@10
|
1523 */
|
yading@10
|
1524 int mb_cmp;
|
yading@10
|
1525 /**
|
yading@10
|
1526 * interlaced DCT comparison function
|
yading@10
|
1527 * - encoding: Set by user.
|
yading@10
|
1528 * - decoding: unused
|
yading@10
|
1529 */
|
yading@10
|
1530 int ildct_cmp;
|
yading@10
|
1531 #define FF_CMP_SAD 0
|
yading@10
|
1532 #define FF_CMP_SSE 1
|
yading@10
|
1533 #define FF_CMP_SATD 2
|
yading@10
|
1534 #define FF_CMP_DCT 3
|
yading@10
|
1535 #define FF_CMP_PSNR 4
|
yading@10
|
1536 #define FF_CMP_BIT 5
|
yading@10
|
1537 #define FF_CMP_RD 6
|
yading@10
|
1538 #define FF_CMP_ZERO 7
|
yading@10
|
1539 #define FF_CMP_VSAD 8
|
yading@10
|
1540 #define FF_CMP_VSSE 9
|
yading@10
|
1541 #define FF_CMP_NSSE 10
|
yading@10
|
1542 #define FF_CMP_W53 11
|
yading@10
|
1543 #define FF_CMP_W97 12
|
yading@10
|
1544 #define FF_CMP_DCTMAX 13
|
yading@10
|
1545 #define FF_CMP_DCT264 14
|
yading@10
|
1546 #define FF_CMP_CHROMA 256
|
yading@10
|
1547
|
yading@10
|
1548 /**
|
yading@10
|
1549 * ME diamond size & shape
|
yading@10
|
1550 * - encoding: Set by user.
|
yading@10
|
1551 * - decoding: unused
|
yading@10
|
1552 */
|
yading@10
|
1553 int dia_size;
|
yading@10
|
1554
|
yading@10
|
1555 /**
|
yading@10
|
1556 * amount of previous MV predictors (2a+1 x 2a+1 square)
|
yading@10
|
1557 * - encoding: Set by user.
|
yading@10
|
1558 * - decoding: unused
|
yading@10
|
1559 */
|
yading@10
|
1560 int last_predictor_count;
|
yading@10
|
1561
|
yading@10
|
1562 /**
|
yading@10
|
1563 * prepass for motion estimation
|
yading@10
|
1564 * - encoding: Set by user.
|
yading@10
|
1565 * - decoding: unused
|
yading@10
|
1566 */
|
yading@10
|
1567 int pre_me;
|
yading@10
|
1568
|
yading@10
|
1569 /**
|
yading@10
|
1570 * motion estimation prepass comparison function
|
yading@10
|
1571 * - encoding: Set by user.
|
yading@10
|
1572 * - decoding: unused
|
yading@10
|
1573 */
|
yading@10
|
1574 int me_pre_cmp;
|
yading@10
|
1575
|
yading@10
|
1576 /**
|
yading@10
|
1577 * ME prepass diamond size & shape
|
yading@10
|
1578 * - encoding: Set by user.
|
yading@10
|
1579 * - decoding: unused
|
yading@10
|
1580 */
|
yading@10
|
1581 int pre_dia_size;
|
yading@10
|
1582
|
yading@10
|
1583 /**
|
yading@10
|
1584 * subpel ME quality
|
yading@10
|
1585 * - encoding: Set by user.
|
yading@10
|
1586 * - decoding: unused
|
yading@10
|
1587 */
|
yading@10
|
1588 int me_subpel_quality;
|
yading@10
|
1589
|
yading@10
|
1590 /**
|
yading@10
|
1591 * DTG active format information (additional aspect ratio
|
yading@10
|
1592 * information only used in DVB MPEG-2 transport streams)
|
yading@10
|
1593 * 0 if not set.
|
yading@10
|
1594 *
|
yading@10
|
1595 * - encoding: unused
|
yading@10
|
1596 * - decoding: Set by decoder.
|
yading@10
|
1597 */
|
yading@10
|
1598 int dtg_active_format;
|
yading@10
|
1599 #define FF_DTG_AFD_SAME 8
|
yading@10
|
1600 #define FF_DTG_AFD_4_3 9
|
yading@10
|
1601 #define FF_DTG_AFD_16_9 10
|
yading@10
|
1602 #define FF_DTG_AFD_14_9 11
|
yading@10
|
1603 #define FF_DTG_AFD_4_3_SP_14_9 13
|
yading@10
|
1604 #define FF_DTG_AFD_16_9_SP_14_9 14
|
yading@10
|
1605 #define FF_DTG_AFD_SP_4_3 15
|
yading@10
|
1606
|
yading@10
|
1607 /**
|
yading@10
|
1608 * maximum motion estimation search range in subpel units
|
yading@10
|
1609 * If 0 then no limit.
|
yading@10
|
1610 *
|
yading@10
|
1611 * - encoding: Set by user.
|
yading@10
|
1612 * - decoding: unused
|
yading@10
|
1613 */
|
yading@10
|
1614 int me_range;
|
yading@10
|
1615
|
yading@10
|
1616 /**
|
yading@10
|
1617 * intra quantizer bias
|
yading@10
|
1618 * - encoding: Set by user.
|
yading@10
|
1619 * - decoding: unused
|
yading@10
|
1620 */
|
yading@10
|
1621 int intra_quant_bias;
|
yading@10
|
1622 #define FF_DEFAULT_QUANT_BIAS 999999
|
yading@10
|
1623
|
yading@10
|
1624 /**
|
yading@10
|
1625 * inter quantizer bias
|
yading@10
|
1626 * - encoding: Set by user.
|
yading@10
|
1627 * - decoding: unused
|
yading@10
|
1628 */
|
yading@10
|
1629 int inter_quant_bias;
|
yading@10
|
1630
|
yading@10
|
1631 /**
|
yading@10
|
1632 * slice flags
|
yading@10
|
1633 * - encoding: unused
|
yading@10
|
1634 * - decoding: Set by user.
|
yading@10
|
1635 */
|
yading@10
|
1636 int slice_flags;
|
yading@10
|
1637 #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
|
yading@10
|
1638 #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
|
yading@10
|
1639 #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
|
yading@10
|
1640
|
yading@10
|
1641 /**
|
yading@10
|
1642 * XVideo Motion Acceleration
|
yading@10
|
1643 * - encoding: forbidden
|
yading@10
|
1644 * - decoding: set by decoder
|
yading@10
|
1645 */
|
yading@10
|
1646 int xvmc_acceleration;
|
yading@10
|
1647
|
yading@10
|
1648 /**
|
yading@10
|
1649 * macroblock decision mode
|
yading@10
|
1650 * - encoding: Set by user.
|
yading@10
|
1651 * - decoding: unused
|
yading@10
|
1652 */
|
yading@10
|
1653 int mb_decision;
|
yading@10
|
1654 #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
|
yading@10
|
1655 #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
|
yading@10
|
1656 #define FF_MB_DECISION_RD 2 ///< rate distortion
|
yading@10
|
1657
|
yading@10
|
1658 /**
|
yading@10
|
1659 * custom intra quantization matrix
|
yading@10
|
1660 * - encoding: Set by user, can be NULL.
|
yading@10
|
1661 * - decoding: Set by libavcodec.
|
yading@10
|
1662 */
|
yading@10
|
1663 uint16_t *intra_matrix;
|
yading@10
|
1664
|
yading@10
|
1665 /**
|
yading@10
|
1666 * custom inter quantization matrix
|
yading@10
|
1667 * - encoding: Set by user, can be NULL.
|
yading@10
|
1668 * - decoding: Set by libavcodec.
|
yading@10
|
1669 */
|
yading@10
|
1670 uint16_t *inter_matrix;
|
yading@10
|
1671
|
yading@10
|
1672 /**
|
yading@10
|
1673 * scene change detection threshold
|
yading@10
|
1674 * 0 is default, larger means fewer detected scene changes.
|
yading@10
|
1675 * - encoding: Set by user.
|
yading@10
|
1676 * - decoding: unused
|
yading@10
|
1677 */
|
yading@10
|
1678 int scenechange_threshold;
|
yading@10
|
1679
|
yading@10
|
1680 /**
|
yading@10
|
1681 * noise reduction strength
|
yading@10
|
1682 * - encoding: Set by user.
|
yading@10
|
1683 * - decoding: unused
|
yading@10
|
1684 */
|
yading@10
|
1685 int noise_reduction;
|
yading@10
|
1686
|
yading@10
|
1687 /**
|
yading@10
|
1688 * Motion estimation threshold below which no motion estimation is
|
yading@10
|
1689 * performed, but instead the user specified motion vectors are used.
|
yading@10
|
1690 *
|
yading@10
|
1691 * - encoding: Set by user.
|
yading@10
|
1692 * - decoding: unused
|
yading@10
|
1693 */
|
yading@10
|
1694 int me_threshold;
|
yading@10
|
1695
|
yading@10
|
1696 /**
|
yading@10
|
1697 * Macroblock threshold below which the user specified macroblock types will be used.
|
yading@10
|
1698 * - encoding: Set by user.
|
yading@10
|
1699 * - decoding: unused
|
yading@10
|
1700 */
|
yading@10
|
1701 int mb_threshold;
|
yading@10
|
1702
|
yading@10
|
1703 /**
|
yading@10
|
1704 * precision of the intra DC coefficient - 8
|
yading@10
|
1705 * - encoding: Set by user.
|
yading@10
|
1706 * - decoding: unused
|
yading@10
|
1707 */
|
yading@10
|
1708 int intra_dc_precision;
|
yading@10
|
1709
|
yading@10
|
1710 /**
|
yading@10
|
1711 * Number of macroblock rows at the top which are skipped.
|
yading@10
|
1712 * - encoding: unused
|
yading@10
|
1713 * - decoding: Set by user.
|
yading@10
|
1714 */
|
yading@10
|
1715 int skip_top;
|
yading@10
|
1716
|
yading@10
|
1717 /**
|
yading@10
|
1718 * Number of macroblock rows at the bottom which are skipped.
|
yading@10
|
1719 * - encoding: unused
|
yading@10
|
1720 * - decoding: Set by user.
|
yading@10
|
1721 */
|
yading@10
|
1722 int skip_bottom;
|
yading@10
|
1723
|
yading@10
|
1724 /**
|
yading@10
|
1725 * Border processing masking, raises the quantizer for mbs on the borders
|
yading@10
|
1726 * of the picture.
|
yading@10
|
1727 * - encoding: Set by user.
|
yading@10
|
1728 * - decoding: unused
|
yading@10
|
1729 */
|
yading@10
|
1730 float border_masking;
|
yading@10
|
1731
|
yading@10
|
1732 /**
|
yading@10
|
1733 * minimum MB lagrange multipler
|
yading@10
|
1734 * - encoding: Set by user.
|
yading@10
|
1735 * - decoding: unused
|
yading@10
|
1736 */
|
yading@10
|
1737 int mb_lmin;
|
yading@10
|
1738
|
yading@10
|
1739 /**
|
yading@10
|
1740 * maximum MB lagrange multipler
|
yading@10
|
1741 * - encoding: Set by user.
|
yading@10
|
1742 * - decoding: unused
|
yading@10
|
1743 */
|
yading@10
|
1744 int mb_lmax;
|
yading@10
|
1745
|
yading@10
|
1746 /**
|
yading@10
|
1747 *
|
yading@10
|
1748 * - encoding: Set by user.
|
yading@10
|
1749 * - decoding: unused
|
yading@10
|
1750 */
|
yading@10
|
1751 int me_penalty_compensation;
|
yading@10
|
1752
|
yading@10
|
1753 /**
|
yading@10
|
1754 *
|
yading@10
|
1755 * - encoding: Set by user.
|
yading@10
|
1756 * - decoding: unused
|
yading@10
|
1757 */
|
yading@10
|
1758 int bidir_refine;
|
yading@10
|
1759
|
yading@10
|
1760 /**
|
yading@10
|
1761 *
|
yading@10
|
1762 * - encoding: Set by user.
|
yading@10
|
1763 * - decoding: unused
|
yading@10
|
1764 */
|
yading@10
|
1765 int brd_scale;
|
yading@10
|
1766
|
yading@10
|
1767 /**
|
yading@10
|
1768 * minimum GOP size
|
yading@10
|
1769 * - encoding: Set by user.
|
yading@10
|
1770 * - decoding: unused
|
yading@10
|
1771 */
|
yading@10
|
1772 int keyint_min;
|
yading@10
|
1773
|
yading@10
|
1774 /**
|
yading@10
|
1775 * number of reference frames
|
yading@10
|
1776 * - encoding: Set by user.
|
yading@10
|
1777 * - decoding: Set by lavc.
|
yading@10
|
1778 */
|
yading@10
|
1779 int refs;
|
yading@10
|
1780
|
yading@10
|
1781 /**
|
yading@10
|
1782 * chroma qp offset from luma
|
yading@10
|
1783 * - encoding: Set by user.
|
yading@10
|
1784 * - decoding: unused
|
yading@10
|
1785 */
|
yading@10
|
1786 int chromaoffset;
|
yading@10
|
1787
|
yading@10
|
1788 /**
|
yading@10
|
1789 * Multiplied by qscale for each frame and added to scene_change_score.
|
yading@10
|
1790 * - encoding: Set by user.
|
yading@10
|
1791 * - decoding: unused
|
yading@10
|
1792 */
|
yading@10
|
1793 int scenechange_factor;
|
yading@10
|
1794
|
yading@10
|
1795 /**
|
yading@10
|
1796 *
|
yading@10
|
1797 * Note: Value depends upon the compare function used for fullpel ME.
|
yading@10
|
1798 * - encoding: Set by user.
|
yading@10
|
1799 * - decoding: unused
|
yading@10
|
1800 */
|
yading@10
|
1801 int mv0_threshold;
|
yading@10
|
1802
|
yading@10
|
1803 /**
|
yading@10
|
1804 * Adjust sensitivity of b_frame_strategy 1.
|
yading@10
|
1805 * - encoding: Set by user.
|
yading@10
|
1806 * - decoding: unused
|
yading@10
|
1807 */
|
yading@10
|
1808 int b_sensitivity;
|
yading@10
|
1809
|
yading@10
|
1810 /**
|
yading@10
|
1811 * Chromaticity coordinates of the source primaries.
|
yading@10
|
1812 * - encoding: Set by user
|
yading@10
|
1813 * - decoding: Set by libavcodec
|
yading@10
|
1814 */
|
yading@10
|
1815 enum AVColorPrimaries color_primaries;
|
yading@10
|
1816
|
yading@10
|
1817 /**
|
yading@10
|
1818 * Color Transfer Characteristic.
|
yading@10
|
1819 * - encoding: Set by user
|
yading@10
|
1820 * - decoding: Set by libavcodec
|
yading@10
|
1821 */
|
yading@10
|
1822 enum AVColorTransferCharacteristic color_trc;
|
yading@10
|
1823
|
yading@10
|
1824 /**
|
yading@10
|
1825 * YUV colorspace type.
|
yading@10
|
1826 * - encoding: Set by user
|
yading@10
|
1827 * - decoding: Set by libavcodec
|
yading@10
|
1828 */
|
yading@10
|
1829 enum AVColorSpace colorspace;
|
yading@10
|
1830
|
yading@10
|
1831 /**
|
yading@10
|
1832 * MPEG vs JPEG YUV range.
|
yading@10
|
1833 * - encoding: Set by user
|
yading@10
|
1834 * - decoding: Set by libavcodec
|
yading@10
|
1835 */
|
yading@10
|
1836 enum AVColorRange color_range;
|
yading@10
|
1837
|
yading@10
|
1838 /**
|
yading@10
|
1839 * This defines the location of chroma samples.
|
yading@10
|
1840 * - encoding: Set by user
|
yading@10
|
1841 * - decoding: Set by libavcodec
|
yading@10
|
1842 */
|
yading@10
|
1843 enum AVChromaLocation chroma_sample_location;
|
yading@10
|
1844
|
yading@10
|
1845 /**
|
yading@10
|
1846 * Number of slices.
|
yading@10
|
1847 * Indicates number of picture subdivisions. Used for parallelized
|
yading@10
|
1848 * decoding.
|
yading@10
|
1849 * - encoding: Set by user
|
yading@10
|
1850 * - decoding: unused
|
yading@10
|
1851 */
|
yading@10
|
1852 int slices;
|
yading@10
|
1853
|
yading@10
|
1854 /** Field order
|
yading@10
|
1855 * - encoding: set by libavcodec
|
yading@10
|
1856 * - decoding: Set by user.
|
yading@10
|
1857 */
|
yading@10
|
1858 enum AVFieldOrder field_order;
|
yading@10
|
1859
|
yading@10
|
1860 /* audio only */
|
yading@10
|
1861 int sample_rate; ///< samples per second
|
yading@10
|
1862 int channels; ///< number of audio channels
|
yading@10
|
1863
|
yading@10
|
1864 /**
|
yading@10
|
1865 * audio sample format
|
yading@10
|
1866 * - encoding: Set by user.
|
yading@10
|
1867 * - decoding: Set by libavcodec.
|
yading@10
|
1868 */
|
yading@10
|
1869 enum AVSampleFormat sample_fmt; ///< sample format
|
yading@10
|
1870
|
yading@10
|
1871 /* The following data should not be initialized. */
|
yading@10
|
1872 /**
|
yading@10
|
1873 * Number of samples per channel in an audio frame.
|
yading@10
|
1874 *
|
yading@10
|
1875 * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
|
yading@10
|
1876 * except the last must contain exactly frame_size samples per channel.
|
yading@10
|
1877 * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
|
yading@10
|
1878 * frame size is not restricted.
|
yading@10
|
1879 * - decoding: may be set by some decoders to indicate constant frame size
|
yading@10
|
1880 */
|
yading@10
|
1881 int frame_size;
|
yading@10
|
1882
|
yading@10
|
1883 /**
|
yading@10
|
1884 * Frame counter, set by libavcodec.
|
yading@10
|
1885 *
|
yading@10
|
1886 * - decoding: total number of frames returned from the decoder so far.
|
yading@10
|
1887 * - encoding: total number of frames passed to the encoder so far.
|
yading@10
|
1888 *
|
yading@10
|
1889 * @note the counter is not incremented if encoding/decoding resulted in
|
yading@10
|
1890 * an error.
|
yading@10
|
1891 */
|
yading@10
|
1892 int frame_number;
|
yading@10
|
1893
|
yading@10
|
1894 /**
|
yading@10
|
1895 * number of bytes per packet if constant and known or 0
|
yading@10
|
1896 * Used by some WAV based audio codecs.
|
yading@10
|
1897 */
|
yading@10
|
1898 int block_align;
|
yading@10
|
1899
|
yading@10
|
1900 /**
|
yading@10
|
1901 * Audio cutoff bandwidth (0 means "automatic")
|
yading@10
|
1902 * - encoding: Set by user.
|
yading@10
|
1903 * - decoding: unused
|
yading@10
|
1904 */
|
yading@10
|
1905 int cutoff;
|
yading@10
|
1906
|
yading@10
|
1907 #if FF_API_REQUEST_CHANNELS
|
yading@10
|
1908 /**
|
yading@10
|
1909 * Decoder should decode to this many channels if it can (0 for default)
|
yading@10
|
1910 * - encoding: unused
|
yading@10
|
1911 * - decoding: Set by user.
|
yading@10
|
1912 * @deprecated Deprecated in favor of request_channel_layout.
|
yading@10
|
1913 */
|
yading@10
|
1914 int request_channels;
|
yading@10
|
1915 #endif
|
yading@10
|
1916
|
yading@10
|
1917 /**
|
yading@10
|
1918 * Audio channel layout.
|
yading@10
|
1919 * - encoding: set by user.
|
yading@10
|
1920 * - decoding: set by user, may be overwritten by libavcodec.
|
yading@10
|
1921 */
|
yading@10
|
1922 uint64_t channel_layout;
|
yading@10
|
1923
|
yading@10
|
1924 /**
|
yading@10
|
1925 * Request decoder to use this channel layout if it can (0 for default)
|
yading@10
|
1926 * - encoding: unused
|
yading@10
|
1927 * - decoding: Set by user.
|
yading@10
|
1928 */
|
yading@10
|
1929 uint64_t request_channel_layout;
|
yading@10
|
1930
|
yading@10
|
1931 /**
|
yading@10
|
1932 * Type of service that the audio stream conveys.
|
yading@10
|
1933 * - encoding: Set by user.
|
yading@10
|
1934 * - decoding: Set by libavcodec.
|
yading@10
|
1935 */
|
yading@10
|
1936 enum AVAudioServiceType audio_service_type;
|
yading@10
|
1937
|
yading@10
|
1938 /**
|
yading@10
|
1939 * desired sample format
|
yading@10
|
1940 * - encoding: Not used.
|
yading@10
|
1941 * - decoding: Set by user.
|
yading@10
|
1942 * Decoder will decode to this format if it can.
|
yading@10
|
1943 */
|
yading@10
|
1944 enum AVSampleFormat request_sample_fmt;
|
yading@10
|
1945
|
yading@10
|
1946 #if FF_API_GET_BUFFER
|
yading@10
|
1947 /**
|
yading@10
|
1948 * Called at the beginning of each frame to get a buffer for it.
|
yading@10
|
1949 *
|
yading@10
|
1950 * The function will set AVFrame.data[], AVFrame.linesize[].
|
yading@10
|
1951 * AVFrame.extended_data[] must also be set, but it should be the same as
|
yading@10
|
1952 * AVFrame.data[] except for planar audio with more channels than can fit
|
yading@10
|
1953 * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
|
yading@10
|
1954 * many data pointers as it can hold.
|
yading@10
|
1955 *
|
yading@10
|
1956 * if CODEC_CAP_DR1 is not set then get_buffer() must call
|
yading@10
|
1957 * avcodec_default_get_buffer() instead of providing buffers allocated by
|
yading@10
|
1958 * some other means.
|
yading@10
|
1959 *
|
yading@10
|
1960 * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
|
yading@10
|
1961 * need it. avcodec_default_get_buffer() aligns the output buffer properly,
|
yading@10
|
1962 * but if get_buffer() is overridden then alignment considerations should
|
yading@10
|
1963 * be taken into account.
|
yading@10
|
1964 *
|
yading@10
|
1965 * @see avcodec_default_get_buffer()
|
yading@10
|
1966 *
|
yading@10
|
1967 * Video:
|
yading@10
|
1968 *
|
yading@10
|
1969 * If pic.reference is set then the frame will be read later by libavcodec.
|
yading@10
|
1970 * avcodec_align_dimensions2() should be used to find the required width and
|
yading@10
|
1971 * height, as they normally need to be rounded up to the next multiple of 16.
|
yading@10
|
1972 *
|
yading@10
|
1973 * If frame multithreading is used and thread_safe_callbacks is set,
|
yading@10
|
1974 * it may be called from a different thread, but not from more than one at
|
yading@10
|
1975 * once. Does not need to be reentrant.
|
yading@10
|
1976 *
|
yading@10
|
1977 * @see release_buffer(), reget_buffer()
|
yading@10
|
1978 * @see avcodec_align_dimensions2()
|
yading@10
|
1979 *
|
yading@10
|
1980 * Audio:
|
yading@10
|
1981 *
|
yading@10
|
1982 * Decoders request a buffer of a particular size by setting
|
yading@10
|
1983 * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
|
yading@10
|
1984 * however, utilize only part of the buffer by setting AVFrame.nb_samples
|
yading@10
|
1985 * to a smaller value in the output frame.
|
yading@10
|
1986 *
|
yading@10
|
1987 * Decoders cannot use the buffer after returning from
|
yading@10
|
1988 * avcodec_decode_audio4(), so they will not call release_buffer(), as it
|
yading@10
|
1989 * is assumed to be released immediately upon return. In some rare cases,
|
yading@10
|
1990 * a decoder may need to call get_buffer() more than once in a single
|
yading@10
|
1991 * call to avcodec_decode_audio4(). In that case, when get_buffer() is
|
yading@10
|
1992 * called again after it has already been called once, the previously
|
yading@10
|
1993 * acquired buffer is assumed to be released at that time and may not be
|
yading@10
|
1994 * reused by the decoder.
|
yading@10
|
1995 *
|
yading@10
|
1996 * As a convenience, av_samples_get_buffer_size() and
|
yading@10
|
1997 * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
|
yading@10
|
1998 * functions to find the required data size and to fill data pointers and
|
yading@10
|
1999 * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
|
yading@10
|
2000 * since all planes must be the same size.
|
yading@10
|
2001 *
|
yading@10
|
2002 * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
|
yading@10
|
2003 *
|
yading@10
|
2004 * - encoding: unused
|
yading@10
|
2005 * - decoding: Set by libavcodec, user can override.
|
yading@10
|
2006 *
|
yading@10
|
2007 * @deprecated use get_buffer2()
|
yading@10
|
2008 */
|
yading@10
|
2009 attribute_deprecated
|
yading@10
|
2010 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
|
yading@10
|
2011
|
yading@10
|
2012 /**
|
yading@10
|
2013 * Called to release buffers which were allocated with get_buffer.
|
yading@10
|
2014 * A released buffer can be reused in get_buffer().
|
yading@10
|
2015 * pic.data[*] must be set to NULL.
|
yading@10
|
2016 * May be called from a different thread if frame multithreading is used,
|
yading@10
|
2017 * but not by more than one thread at once, so does not need to be reentrant.
|
yading@10
|
2018 * - encoding: unused
|
yading@10
|
2019 * - decoding: Set by libavcodec, user can override.
|
yading@10
|
2020 *
|
yading@10
|
2021 * @deprecated custom freeing callbacks should be set from get_buffer2()
|
yading@10
|
2022 */
|
yading@10
|
2023 attribute_deprecated
|
yading@10
|
2024 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
|
yading@10
|
2025
|
yading@10
|
2026 /**
|
yading@10
|
2027 * Called at the beginning of a frame to get cr buffer for it.
|
yading@10
|
2028 * Buffer type (size, hints) must be the same. libavcodec won't check it.
|
yading@10
|
2029 * libavcodec will pass previous buffer in pic, function should return
|
yading@10
|
2030 * same buffer or new buffer with old frame "painted" into it.
|
yading@10
|
2031 * If pic.data[0] == NULL must behave like get_buffer().
|
yading@10
|
2032 * if CODEC_CAP_DR1 is not set then reget_buffer() must call
|
yading@10
|
2033 * avcodec_default_reget_buffer() instead of providing buffers allocated by
|
yading@10
|
2034 * some other means.
|
yading@10
|
2035 * - encoding: unused
|
yading@10
|
2036 * - decoding: Set by libavcodec, user can override.
|
yading@10
|
2037 */
|
yading@10
|
2038 attribute_deprecated
|
yading@10
|
2039 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
|
yading@10
|
2040 #endif
|
yading@10
|
2041
|
yading@10
|
2042 /**
|
yading@10
|
2043 * This callback is called at the beginning of each frame to get data
|
yading@10
|
2044 * buffer(s) for it. There may be one contiguous buffer for all the data or
|
yading@10
|
2045 * there may be a buffer per each data plane or anything in between. Each
|
yading@10
|
2046 * buffer must be reference-counted using the AVBuffer API.
|
yading@10
|
2047 *
|
yading@10
|
2048 * The following fields will be set in the frame before this callback is
|
yading@10
|
2049 * called:
|
yading@10
|
2050 * - format
|
yading@10
|
2051 * - width, height (video only)
|
yading@10
|
2052 * - sample_rate, channel_layout, nb_samples (audio only)
|
yading@10
|
2053 * Their values may differ from the corresponding values in
|
yading@10
|
2054 * AVCodecContext. This callback must use the frame values, not the codec
|
yading@10
|
2055 * context values, to calculate the required buffer size.
|
yading@10
|
2056 *
|
yading@10
|
2057 * This callback must fill the following fields in the frame:
|
yading@10
|
2058 * - data[]
|
yading@10
|
2059 * - linesize[]
|
yading@10
|
2060 * - extended_data:
|
yading@10
|
2061 * * if the data is planar audio with more than 8 channels, then this
|
yading@10
|
2062 * callback must allocate and fill extended_data to contain all pointers
|
yading@10
|
2063 * to all data planes. data[] must hold as many pointers as it can.
|
yading@10
|
2064 * extended_data must be allocated with av_malloc() and will be freed in
|
yading@10
|
2065 * av_frame_unref().
|
yading@10
|
2066 * * otherwise exended_data must point to data
|
yading@10
|
2067 * - buf[] must contain references to the buffers that contain the frame
|
yading@10
|
2068 * data.
|
yading@10
|
2069 * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
|
yading@10
|
2070 * this callback and filled with the extra buffers if there are more
|
yading@10
|
2071 * buffers than buf[] can hold. extended_buf will be freed in
|
yading@10
|
2072 * av_frame_unref().
|
yading@10
|
2073 *
|
yading@10
|
2074 * If CODEC_CAP_DR1 is not set then get_buffer2() must call
|
yading@10
|
2075 * avcodec_default_get_buffer2() instead of providing buffers allocated by
|
yading@10
|
2076 * some other means.
|
yading@10
|
2077 *
|
yading@10
|
2078 * Each data plane must be aligned to the maximum required by the target
|
yading@10
|
2079 * CPU.
|
yading@10
|
2080 *
|
yading@10
|
2081 * @see avcodec_default_get_buffer2()
|
yading@10
|
2082 *
|
yading@10
|
2083 * Video:
|
yading@10
|
2084 *
|
yading@10
|
2085 * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
|
yading@10
|
2086 * (read and/or written to if it is writable) later by libavcodec.
|
yading@10
|
2087 *
|
yading@10
|
2088 * If CODEC_FLAG_EMU_EDGE is not set in s->flags, the buffer must contain an
|
yading@10
|
2089 * edge of the size returned by avcodec_get_edge_width() on all sides.
|
yading@10
|
2090 *
|
yading@10
|
2091 * avcodec_align_dimensions2() should be used to find the required width and
|
yading@10
|
2092 * height, as they normally need to be rounded up to the next multiple of 16.
|
yading@10
|
2093 *
|
yading@10
|
2094 * If frame multithreading is used and thread_safe_callbacks is set,
|
yading@10
|
2095 * this callback may be called from a different thread, but not from more
|
yading@10
|
2096 * than one at once. Does not need to be reentrant.
|
yading@10
|
2097 *
|
yading@10
|
2098 * @see avcodec_align_dimensions2()
|
yading@10
|
2099 *
|
yading@10
|
2100 * Audio:
|
yading@10
|
2101 *
|
yading@10
|
2102 * Decoders request a buffer of a particular size by setting
|
yading@10
|
2103 * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
|
yading@10
|
2104 * however, utilize only part of the buffer by setting AVFrame.nb_samples
|
yading@10
|
2105 * to a smaller value in the output frame.
|
yading@10
|
2106 *
|
yading@10
|
2107 * As a convenience, av_samples_get_buffer_size() and
|
yading@10
|
2108 * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
|
yading@10
|
2109 * functions to find the required data size and to fill data pointers and
|
yading@10
|
2110 * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
|
yading@10
|
2111 * since all planes must be the same size.
|
yading@10
|
2112 *
|
yading@10
|
2113 * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
|
yading@10
|
2114 *
|
yading@10
|
2115 * - encoding: unused
|
yading@10
|
2116 * - decoding: Set by libavcodec, user can override.
|
yading@10
|
2117 */
|
yading@10
|
2118 int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
|
yading@10
|
2119
|
yading@10
|
2120 /**
|
yading@10
|
2121 * If non-zero, the decoded audio and video frames returned from
|
yading@10
|
2122 * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
|
yading@10
|
2123 * and are valid indefinitely. The caller must free them with
|
yading@10
|
2124 * av_frame_unref() when they are not needed anymore.
|
yading@10
|
2125 * Otherwise, the decoded frames must not be freed by the caller and are
|
yading@10
|
2126 * only valid until the next decode call.
|
yading@10
|
2127 *
|
yading@10
|
2128 * - encoding: unused
|
yading@10
|
2129 * - decoding: set by the caller before avcodec_open2().
|
yading@10
|
2130 */
|
yading@10
|
2131 int refcounted_frames;
|
yading@10
|
2132
|
yading@10
|
2133 /* - encoding parameters */
|
yading@10
|
2134 float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
|
yading@10
|
2135 float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
|
yading@10
|
2136
|
yading@10
|
2137 /**
|
yading@10
|
2138 * minimum quantizer
|
yading@10
|
2139 * - encoding: Set by user.
|
yading@10
|
2140 * - decoding: unused
|
yading@10
|
2141 */
|
yading@10
|
2142 int qmin;
|
yading@10
|
2143
|
yading@10
|
2144 /**
|
yading@10
|
2145 * maximum quantizer
|
yading@10
|
2146 * - encoding: Set by user.
|
yading@10
|
2147 * - decoding: unused
|
yading@10
|
2148 */
|
yading@10
|
2149 int qmax;
|
yading@10
|
2150
|
yading@10
|
2151 /**
|
yading@10
|
2152 * maximum quantizer difference between frames
|
yading@10
|
2153 * - encoding: Set by user.
|
yading@10
|
2154 * - decoding: unused
|
yading@10
|
2155 */
|
yading@10
|
2156 int max_qdiff;
|
yading@10
|
2157
|
yading@10
|
2158 /**
|
yading@10
|
2159 * ratecontrol qmin qmax limiting method
|
yading@10
|
2160 * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax.
|
yading@10
|
2161 * - encoding: Set by user.
|
yading@10
|
2162 * - decoding: unused
|
yading@10
|
2163 */
|
yading@10
|
2164 float rc_qsquish;
|
yading@10
|
2165
|
yading@10
|
2166 float rc_qmod_amp;
|
yading@10
|
2167 int rc_qmod_freq;
|
yading@10
|
2168
|
yading@10
|
2169 /**
|
yading@10
|
2170 * decoder bitstream buffer size
|
yading@10
|
2171 * - encoding: Set by user.
|
yading@10
|
2172 * - decoding: unused
|
yading@10
|
2173 */
|
yading@10
|
2174 int rc_buffer_size;
|
yading@10
|
2175
|
yading@10
|
2176 /**
|
yading@10
|
2177 * ratecontrol override, see RcOverride
|
yading@10
|
2178 * - encoding: Allocated/set/freed by user.
|
yading@10
|
2179 * - decoding: unused
|
yading@10
|
2180 */
|
yading@10
|
2181 int rc_override_count;
|
yading@10
|
2182 RcOverride *rc_override;
|
yading@10
|
2183
|
yading@10
|
2184 /**
|
yading@10
|
2185 * rate control equation
|
yading@10
|
2186 * - encoding: Set by user
|
yading@10
|
2187 * - decoding: unused
|
yading@10
|
2188 */
|
yading@10
|
2189 const char *rc_eq;
|
yading@10
|
2190
|
yading@10
|
2191 /**
|
yading@10
|
2192 * maximum bitrate
|
yading@10
|
2193 * - encoding: Set by user.
|
yading@10
|
2194 * - decoding: unused
|
yading@10
|
2195 */
|
yading@10
|
2196 int rc_max_rate;
|
yading@10
|
2197
|
yading@10
|
2198 /**
|
yading@10
|
2199 * minimum bitrate
|
yading@10
|
2200 * - encoding: Set by user.
|
yading@10
|
2201 * - decoding: unused
|
yading@10
|
2202 */
|
yading@10
|
2203 int rc_min_rate;
|
yading@10
|
2204
|
yading@10
|
2205 float rc_buffer_aggressivity;
|
yading@10
|
2206
|
yading@10
|
2207 /**
|
yading@10
|
2208 * initial complexity for pass1 ratecontrol
|
yading@10
|
2209 * - encoding: Set by user.
|
yading@10
|
2210 * - decoding: unused
|
yading@10
|
2211 */
|
yading@10
|
2212 float rc_initial_cplx;
|
yading@10
|
2213
|
yading@10
|
2214 /**
|
yading@10
|
2215 * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
|
yading@10
|
2216 * - encoding: Set by user.
|
yading@10
|
2217 * - decoding: unused.
|
yading@10
|
2218 */
|
yading@10
|
2219 float rc_max_available_vbv_use;
|
yading@10
|
2220
|
yading@10
|
2221 /**
|
yading@10
|
2222 * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
|
yading@10
|
2223 * - encoding: Set by user.
|
yading@10
|
2224 * - decoding: unused.
|
yading@10
|
2225 */
|
yading@10
|
2226 float rc_min_vbv_overflow_use;
|
yading@10
|
2227
|
yading@10
|
2228 /**
|
yading@10
|
2229 * Number of bits which should be loaded into the rc buffer before decoding starts.
|
yading@10
|
2230 * - encoding: Set by user.
|
yading@10
|
2231 * - decoding: unused
|
yading@10
|
2232 */
|
yading@10
|
2233 int rc_initial_buffer_occupancy;
|
yading@10
|
2234
|
yading@10
|
2235 #define FF_CODER_TYPE_VLC 0
|
yading@10
|
2236 #define FF_CODER_TYPE_AC 1
|
yading@10
|
2237 #define FF_CODER_TYPE_RAW 2
|
yading@10
|
2238 #define FF_CODER_TYPE_RLE 3
|
yading@10
|
2239 #define FF_CODER_TYPE_DEFLATE 4
|
yading@10
|
2240 /**
|
yading@10
|
2241 * coder type
|
yading@10
|
2242 * - encoding: Set by user.
|
yading@10
|
2243 * - decoding: unused
|
yading@10
|
2244 */
|
yading@10
|
2245 int coder_type;
|
yading@10
|
2246
|
yading@10
|
2247 /**
|
yading@10
|
2248 * context model
|
yading@10
|
2249 * - encoding: Set by user.
|
yading@10
|
2250 * - decoding: unused
|
yading@10
|
2251 */
|
yading@10
|
2252 int context_model;
|
yading@10
|
2253
|
yading@10
|
2254 /**
|
yading@10
|
2255 * minimum Lagrange multipler
|
yading@10
|
2256 * - encoding: Set by user.
|
yading@10
|
2257 * - decoding: unused
|
yading@10
|
2258 */
|
yading@10
|
2259 int lmin;
|
yading@10
|
2260
|
yading@10
|
2261 /**
|
yading@10
|
2262 * maximum Lagrange multipler
|
yading@10
|
2263 * - encoding: Set by user.
|
yading@10
|
2264 * - decoding: unused
|
yading@10
|
2265 */
|
yading@10
|
2266 int lmax;
|
yading@10
|
2267
|
yading@10
|
2268 /**
|
yading@10
|
2269 * frame skip threshold
|
yading@10
|
2270 * - encoding: Set by user.
|
yading@10
|
2271 * - decoding: unused
|
yading@10
|
2272 */
|
yading@10
|
2273 int frame_skip_threshold;
|
yading@10
|
2274
|
yading@10
|
2275 /**
|
yading@10
|
2276 * frame skip factor
|
yading@10
|
2277 * - encoding: Set by user.
|
yading@10
|
2278 * - decoding: unused
|
yading@10
|
2279 */
|
yading@10
|
2280 int frame_skip_factor;
|
yading@10
|
2281
|
yading@10
|
2282 /**
|
yading@10
|
2283 * frame skip exponent
|
yading@10
|
2284 * - encoding: Set by user.
|
yading@10
|
2285 * - decoding: unused
|
yading@10
|
2286 */
|
yading@10
|
2287 int frame_skip_exp;
|
yading@10
|
2288
|
yading@10
|
2289 /**
|
yading@10
|
2290 * frame skip comparison function
|
yading@10
|
2291 * - encoding: Set by user.
|
yading@10
|
2292 * - decoding: unused
|
yading@10
|
2293 */
|
yading@10
|
2294 int frame_skip_cmp;
|
yading@10
|
2295
|
yading@10
|
2296 /**
|
yading@10
|
2297 * trellis RD quantization
|
yading@10
|
2298 * - encoding: Set by user.
|
yading@10
|
2299 * - decoding: unused
|
yading@10
|
2300 */
|
yading@10
|
2301 int trellis;
|
yading@10
|
2302
|
yading@10
|
2303 /**
|
yading@10
|
2304 * - encoding: Set by user.
|
yading@10
|
2305 * - decoding: unused
|
yading@10
|
2306 */
|
yading@10
|
2307 int min_prediction_order;
|
yading@10
|
2308
|
yading@10
|
2309 /**
|
yading@10
|
2310 * - encoding: Set by user.
|
yading@10
|
2311 * - decoding: unused
|
yading@10
|
2312 */
|
yading@10
|
2313 int max_prediction_order;
|
yading@10
|
2314
|
yading@10
|
2315 /**
|
yading@10
|
2316 * GOP timecode frame start number
|
yading@10
|
2317 * - encoding: Set by user, in non drop frame format
|
yading@10
|
2318 * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset)
|
yading@10
|
2319 */
|
yading@10
|
2320 int64_t timecode_frame_start;
|
yading@10
|
2321
|
yading@10
|
2322 /* The RTP callback: This function is called */
|
yading@10
|
2323 /* every time the encoder has a packet to send. */
|
yading@10
|
2324 /* It depends on the encoder if the data starts */
|
yading@10
|
2325 /* with a Start Code (it should). H.263 does. */
|
yading@10
|
2326 /* mb_nb contains the number of macroblocks */
|
yading@10
|
2327 /* encoded in the RTP payload. */
|
yading@10
|
2328 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
|
yading@10
|
2329
|
yading@10
|
2330 int rtp_payload_size; /* The size of the RTP payload: the coder will */
|
yading@10
|
2331 /* do its best to deliver a chunk with size */
|
yading@10
|
2332 /* below rtp_payload_size, the chunk will start */
|
yading@10
|
2333 /* with a start code on some codecs like H.263. */
|
yading@10
|
2334 /* This doesn't take account of any particular */
|
yading@10
|
2335 /* headers inside the transmitted RTP payload. */
|
yading@10
|
2336
|
yading@10
|
2337 /* statistics, used for 2-pass encoding */
|
yading@10
|
2338 int mv_bits;
|
yading@10
|
2339 int header_bits;
|
yading@10
|
2340 int i_tex_bits;
|
yading@10
|
2341 int p_tex_bits;
|
yading@10
|
2342 int i_count;
|
yading@10
|
2343 int p_count;
|
yading@10
|
2344 int skip_count;
|
yading@10
|
2345 int misc_bits;
|
yading@10
|
2346
|
yading@10
|
2347 /**
|
yading@10
|
2348 * number of bits used for the previously encoded frame
|
yading@10
|
2349 * - encoding: Set by libavcodec.
|
yading@10
|
2350 * - decoding: unused
|
yading@10
|
2351 */
|
yading@10
|
2352 int frame_bits;
|
yading@10
|
2353
|
yading@10
|
2354 /**
|
yading@10
|
2355 * pass1 encoding statistics output buffer
|
yading@10
|
2356 * - encoding: Set by libavcodec.
|
yading@10
|
2357 * - decoding: unused
|
yading@10
|
2358 */
|
yading@10
|
2359 char *stats_out;
|
yading@10
|
2360
|
yading@10
|
2361 /**
|
yading@10
|
2362 * pass2 encoding statistics input buffer
|
yading@10
|
2363 * Concatenated stuff from stats_out of pass1 should be placed here.
|
yading@10
|
2364 * - encoding: Allocated/set/freed by user.
|
yading@10
|
2365 * - decoding: unused
|
yading@10
|
2366 */
|
yading@10
|
2367 char *stats_in;
|
yading@10
|
2368
|
yading@10
|
2369 /**
|
yading@10
|
2370 * Work around bugs in encoders which sometimes cannot be detected automatically.
|
yading@10
|
2371 * - encoding: Set by user
|
yading@10
|
2372 * - decoding: Set by user
|
yading@10
|
2373 */
|
yading@10
|
2374 int workaround_bugs;
|
yading@10
|
2375 #define FF_BUG_AUTODETECT 1 ///< autodetection
|
yading@10
|
2376 #define FF_BUG_OLD_MSMPEG4 2
|
yading@10
|
2377 #define FF_BUG_XVID_ILACE 4
|
yading@10
|
2378 #define FF_BUG_UMP4 8
|
yading@10
|
2379 #define FF_BUG_NO_PADDING 16
|
yading@10
|
2380 #define FF_BUG_AMV 32
|
yading@10
|
2381 #define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
|
yading@10
|
2382 #define FF_BUG_QPEL_CHROMA 64
|
yading@10
|
2383 #define FF_BUG_STD_QPEL 128
|
yading@10
|
2384 #define FF_BUG_QPEL_CHROMA2 256
|
yading@10
|
2385 #define FF_BUG_DIRECT_BLOCKSIZE 512
|
yading@10
|
2386 #define FF_BUG_EDGE 1024
|
yading@10
|
2387 #define FF_BUG_HPEL_CHROMA 2048
|
yading@10
|
2388 #define FF_BUG_DC_CLIP 4096
|
yading@10
|
2389 #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
|
yading@10
|
2390 #define FF_BUG_TRUNCATED 16384
|
yading@10
|
2391
|
yading@10
|
2392 /**
|
yading@10
|
2393 * strictly follow the standard (MPEG4, ...).
|
yading@10
|
2394 * - encoding: Set by user.
|
yading@10
|
2395 * - decoding: Set by user.
|
yading@10
|
2396 * Setting this to STRICT or higher means the encoder and decoder will
|
yading@10
|
2397 * generally do stupid things, whereas setting it to unofficial or lower
|
yading@10
|
2398 * will mean the encoder might produce output that is not supported by all
|
yading@10
|
2399 * spec-compliant decoders. Decoders don't differentiate between normal,
|
yading@10
|
2400 * unofficial and experimental (that is, they always try to decode things
|
yading@10
|
2401 * when they can) unless they are explicitly asked to behave stupidly
|
yading@10
|
2402 * (=strictly conform to the specs)
|
yading@10
|
2403 */
|
yading@10
|
2404 int strict_std_compliance;
|
yading@10
|
2405 #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
|
yading@10
|
2406 #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
|
yading@10
|
2407 #define FF_COMPLIANCE_NORMAL 0
|
yading@10
|
2408 #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
|
yading@10
|
2409 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
|
yading@10
|
2410
|
yading@10
|
2411 /**
|
yading@10
|
2412 * error concealment flags
|
yading@10
|
2413 * - encoding: unused
|
yading@10
|
2414 * - decoding: Set by user.
|
yading@10
|
2415 */
|
yading@10
|
2416 int error_concealment;
|
yading@10
|
2417 #define FF_EC_GUESS_MVS 1
|
yading@10
|
2418 #define FF_EC_DEBLOCK 2
|
yading@10
|
2419
|
yading@10
|
2420 /**
|
yading@10
|
2421 * debug
|
yading@10
|
2422 * - encoding: Set by user.
|
yading@10
|
2423 * - decoding: Set by user.
|
yading@10
|
2424 */
|
yading@10
|
2425 int debug;
|
yading@10
|
2426 #define FF_DEBUG_PICT_INFO 1
|
yading@10
|
2427 #define FF_DEBUG_RC 2
|
yading@10
|
2428 #define FF_DEBUG_BITSTREAM 4
|
yading@10
|
2429 #define FF_DEBUG_MB_TYPE 8
|
yading@10
|
2430 #define FF_DEBUG_QP 16
|
yading@10
|
2431 #define FF_DEBUG_MV 32
|
yading@10
|
2432 #define FF_DEBUG_DCT_COEFF 0x00000040
|
yading@10
|
2433 #define FF_DEBUG_SKIP 0x00000080
|
yading@10
|
2434 #define FF_DEBUG_STARTCODE 0x00000100
|
yading@10
|
2435 #define FF_DEBUG_PTS 0x00000200
|
yading@10
|
2436 #define FF_DEBUG_ER 0x00000400
|
yading@10
|
2437 #define FF_DEBUG_MMCO 0x00000800
|
yading@10
|
2438 #define FF_DEBUG_BUGS 0x00001000
|
yading@10
|
2439 #define FF_DEBUG_VIS_QP 0x00002000
|
yading@10
|
2440 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
|
yading@10
|
2441 #define FF_DEBUG_BUFFERS 0x00008000
|
yading@10
|
2442 #define FF_DEBUG_THREADS 0x00010000
|
yading@10
|
2443
|
yading@10
|
2444 /**
|
yading@10
|
2445 * debug
|
yading@10
|
2446 * - encoding: Set by user.
|
yading@10
|
2447 * - decoding: Set by user.
|
yading@10
|
2448 */
|
yading@10
|
2449 int debug_mv;
|
yading@10
|
2450 #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
|
yading@10
|
2451 #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
|
yading@10
|
2452 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
|
yading@10
|
2453
|
yading@10
|
2454 /**
|
yading@10
|
2455 * Error recognition; may misdetect some more or less valid parts as errors.
|
yading@10
|
2456 * - encoding: unused
|
yading@10
|
2457 * - decoding: Set by user.
|
yading@10
|
2458 */
|
yading@10
|
2459 int err_recognition;
|
yading@10
|
2460 #define AV_EF_CRCCHECK (1<<0)
|
yading@10
|
2461 #define AV_EF_BITSTREAM (1<<1)
|
yading@10
|
2462 #define AV_EF_BUFFER (1<<2)
|
yading@10
|
2463 #define AV_EF_EXPLODE (1<<3)
|
yading@10
|
2464
|
yading@10
|
2465 #define AV_EF_CAREFUL (1<<16)
|
yading@10
|
2466 #define AV_EF_COMPLIANT (1<<17)
|
yading@10
|
2467 #define AV_EF_AGGRESSIVE (1<<18)
|
yading@10
|
2468
|
yading@10
|
2469
|
yading@10
|
2470 /**
|
yading@10
|
2471 * opaque 64bit number (generally a PTS) that will be reordered and
|
yading@10
|
2472 * output in AVFrame.reordered_opaque
|
yading@10
|
2473 * @deprecated in favor of pkt_pts
|
yading@10
|
2474 * - encoding: unused
|
yading@10
|
2475 * - decoding: Set by user.
|
yading@10
|
2476 */
|
yading@10
|
2477 int64_t reordered_opaque;
|
yading@10
|
2478
|
yading@10
|
2479 /**
|
yading@10
|
2480 * Hardware accelerator in use
|
yading@10
|
2481 * - encoding: unused.
|
yading@10
|
2482 * - decoding: Set by libavcodec
|
yading@10
|
2483 */
|
yading@10
|
2484 struct AVHWAccel *hwaccel;
|
yading@10
|
2485
|
yading@10
|
2486 /**
|
yading@10
|
2487 * Hardware accelerator context.
|
yading@10
|
2488 * For some hardware accelerators, a global context needs to be
|
yading@10
|
2489 * provided by the user. In that case, this holds display-dependent
|
yading@10
|
2490 * data FFmpeg cannot instantiate itself. Please refer to the
|
yading@10
|
2491 * FFmpeg HW accelerator documentation to know how to fill this
|
yading@10
|
2492 * is. e.g. for VA API, this is a struct vaapi_context.
|
yading@10
|
2493 * - encoding: unused
|
yading@10
|
2494 * - decoding: Set by user
|
yading@10
|
2495 */
|
yading@10
|
2496 void *hwaccel_context;
|
yading@10
|
2497
|
yading@10
|
2498 /**
|
yading@10
|
2499 * error
|
yading@10
|
2500 * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
|
yading@10
|
2501 * - decoding: unused
|
yading@10
|
2502 */
|
yading@10
|
2503 uint64_t error[AV_NUM_DATA_POINTERS];
|
yading@10
|
2504
|
yading@10
|
2505 /**
|
yading@10
|
2506 * DCT algorithm, see FF_DCT_* below
|
yading@10
|
2507 * - encoding: Set by user.
|
yading@10
|
2508 * - decoding: unused
|
yading@10
|
2509 */
|
yading@10
|
2510 int dct_algo;
|
yading@10
|
2511 #define FF_DCT_AUTO 0
|
yading@10
|
2512 #define FF_DCT_FASTINT 1
|
yading@10
|
2513 #define FF_DCT_INT 2
|
yading@10
|
2514 #define FF_DCT_MMX 3
|
yading@10
|
2515 #define FF_DCT_ALTIVEC 5
|
yading@10
|
2516 #define FF_DCT_FAAN 6
|
yading@10
|
2517
|
yading@10
|
2518 /**
|
yading@10
|
2519 * IDCT algorithm, see FF_IDCT_* below.
|
yading@10
|
2520 * - encoding: Set by user.
|
yading@10
|
2521 * - decoding: Set by user.
|
yading@10
|
2522 */
|
yading@10
|
2523 int idct_algo;
|
yading@10
|
2524 #define FF_IDCT_AUTO 0
|
yading@10
|
2525 #define FF_IDCT_INT 1
|
yading@10
|
2526 #define FF_IDCT_SIMPLE 2
|
yading@10
|
2527 #define FF_IDCT_SIMPLEMMX 3
|
yading@10
|
2528 #define FF_IDCT_ARM 7
|
yading@10
|
2529 #define FF_IDCT_ALTIVEC 8
|
yading@10
|
2530 #define FF_IDCT_SH4 9
|
yading@10
|
2531 #define FF_IDCT_SIMPLEARM 10
|
yading@10
|
2532 #define FF_IDCT_IPP 13
|
yading@10
|
2533 #define FF_IDCT_XVIDMMX 14
|
yading@10
|
2534 #define FF_IDCT_SIMPLEARMV5TE 16
|
yading@10
|
2535 #define FF_IDCT_SIMPLEARMV6 17
|
yading@10
|
2536 #define FF_IDCT_SIMPLEVIS 18
|
yading@10
|
2537 #define FF_IDCT_FAAN 20
|
yading@10
|
2538 #define FF_IDCT_SIMPLENEON 22
|
yading@10
|
2539 #define FF_IDCT_SIMPLEALPHA 23
|
yading@10
|
2540
|
yading@10
|
2541 /**
|
yading@10
|
2542 * bits per sample/pixel from the demuxer (needed for huffyuv).
|
yading@10
|
2543 * - encoding: Set by libavcodec.
|
yading@10
|
2544 * - decoding: Set by user.
|
yading@10
|
2545 */
|
yading@10
|
2546 int bits_per_coded_sample;
|
yading@10
|
2547
|
yading@10
|
2548 /**
|
yading@10
|
2549 * Bits per sample/pixel of internal libavcodec pixel/sample format.
|
yading@10
|
2550 * - encoding: set by user.
|
yading@10
|
2551 * - decoding: set by libavcodec.
|
yading@10
|
2552 */
|
yading@10
|
2553 int bits_per_raw_sample;
|
yading@10
|
2554
|
yading@10
|
2555 /**
|
yading@10
|
2556 * low resolution decoding, 1-> 1/2 size, 2->1/4 size
|
yading@10
|
2557 * - encoding: unused
|
yading@10
|
2558 * - decoding: Set by user.
|
yading@10
|
2559 */
|
yading@10
|
2560 int lowres;
|
yading@10
|
2561
|
yading@10
|
2562 /**
|
yading@10
|
2563 * the picture in the bitstream
|
yading@10
|
2564 * - encoding: Set by libavcodec.
|
yading@10
|
2565 * - decoding: Set by libavcodec.
|
yading@10
|
2566 */
|
yading@10
|
2567 AVFrame *coded_frame;
|
yading@10
|
2568
|
yading@10
|
2569 /**
|
yading@10
|
2570 * thread count
|
yading@10
|
2571 * is used to decide how many independent tasks should be passed to execute()
|
yading@10
|
2572 * - encoding: Set by user.
|
yading@10
|
2573 * - decoding: Set by user.
|
yading@10
|
2574 */
|
yading@10
|
2575 int thread_count;
|
yading@10
|
2576
|
yading@10
|
2577 /**
|
yading@10
|
2578 * Which multithreading methods to use.
|
yading@10
|
2579 * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
|
yading@10
|
2580 * so clients which cannot provide future frames should not use it.
|
yading@10
|
2581 *
|
yading@10
|
2582 * - encoding: Set by user, otherwise the default is used.
|
yading@10
|
2583 * - decoding: Set by user, otherwise the default is used.
|
yading@10
|
2584 */
|
yading@10
|
2585 int thread_type;
|
yading@10
|
2586 #define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
|
yading@10
|
2587 #define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
|
yading@10
|
2588
|
yading@10
|
2589 /**
|
yading@10
|
2590 * Which multithreading methods are in use by the codec.
|
yading@10
|
2591 * - encoding: Set by libavcodec.
|
yading@10
|
2592 * - decoding: Set by libavcodec.
|
yading@10
|
2593 */
|
yading@10
|
2594 int active_thread_type;
|
yading@10
|
2595
|
yading@10
|
2596 /**
|
yading@10
|
2597 * Set by the client if its custom get_buffer() callback can be called
|
yading@10
|
2598 * synchronously from another thread, which allows faster multithreaded decoding.
|
yading@10
|
2599 * draw_horiz_band() will be called from other threads regardless of this setting.
|
yading@10
|
2600 * Ignored if the default get_buffer() is used.
|
yading@10
|
2601 * - encoding: Set by user.
|
yading@10
|
2602 * - decoding: Set by user.
|
yading@10
|
2603 */
|
yading@10
|
2604 int thread_safe_callbacks;
|
yading@10
|
2605
|
yading@10
|
2606 /**
|
yading@10
|
2607 * The codec may call this to execute several independent things.
|
yading@10
|
2608 * It will return only after finishing all tasks.
|
yading@10
|
2609 * The user may replace this with some multithreaded implementation,
|
yading@10
|
2610 * the default implementation will execute the parts serially.
|
yading@10
|
2611 * @param count the number of things to execute
|
yading@10
|
2612 * - encoding: Set by libavcodec, user can override.
|
yading@10
|
2613 * - decoding: Set by libavcodec, user can override.
|
yading@10
|
2614 */
|
yading@10
|
2615 int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
|
yading@10
|
2616
|
yading@10
|
2617 /**
|
yading@10
|
2618 * The codec may call this to execute several independent things.
|
yading@10
|
2619 * It will return only after finishing all tasks.
|
yading@10
|
2620 * The user may replace this with some multithreaded implementation,
|
yading@10
|
2621 * the default implementation will execute the parts serially.
|
yading@10
|
2622 * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
|
yading@10
|
2623 * @param c context passed also to func
|
yading@10
|
2624 * @param count the number of things to execute
|
yading@10
|
2625 * @param arg2 argument passed unchanged to func
|
yading@10
|
2626 * @param ret return values of executed functions, must have space for "count" values. May be NULL.
|
yading@10
|
2627 * @param func function that will be called count times, with jobnr from 0 to count-1.
|
yading@10
|
2628 * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
|
yading@10
|
2629 * two instances of func executing at the same time will have the same threadnr.
|
yading@10
|
2630 * @return always 0 currently, but code should handle a future improvement where when any call to func
|
yading@10
|
2631 * returns < 0 no further calls to func may be done and < 0 is returned.
|
yading@10
|
2632 * - encoding: Set by libavcodec, user can override.
|
yading@10
|
2633 * - decoding: Set by libavcodec, user can override.
|
yading@10
|
2634 */
|
yading@10
|
2635 int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
|
yading@10
|
2636
|
yading@10
|
2637 /**
|
yading@10
|
2638 * thread opaque
|
yading@10
|
2639 * Can be used by execute() to store some per AVCodecContext stuff.
|
yading@10
|
2640 * - encoding: set by execute()
|
yading@10
|
2641 * - decoding: set by execute()
|
yading@10
|
2642 */
|
yading@10
|
2643 void *thread_opaque;
|
yading@10
|
2644
|
yading@10
|
2645 /**
|
yading@10
|
2646 * noise vs. sse weight for the nsse comparsion function
|
yading@10
|
2647 * - encoding: Set by user.
|
yading@10
|
2648 * - decoding: unused
|
yading@10
|
2649 */
|
yading@10
|
2650 int nsse_weight;
|
yading@10
|
2651
|
yading@10
|
2652 /**
|
yading@10
|
2653 * profile
|
yading@10
|
2654 * - encoding: Set by user.
|
yading@10
|
2655 * - decoding: Set by libavcodec.
|
yading@10
|
2656 */
|
yading@10
|
2657 int profile;
|
yading@10
|
2658 #define FF_PROFILE_UNKNOWN -99
|
yading@10
|
2659 #define FF_PROFILE_RESERVED -100
|
yading@10
|
2660
|
yading@10
|
2661 #define FF_PROFILE_AAC_MAIN 0
|
yading@10
|
2662 #define FF_PROFILE_AAC_LOW 1
|
yading@10
|
2663 #define FF_PROFILE_AAC_SSR 2
|
yading@10
|
2664 #define FF_PROFILE_AAC_LTP 3
|
yading@10
|
2665 #define FF_PROFILE_AAC_HE 4
|
yading@10
|
2666 #define FF_PROFILE_AAC_HE_V2 28
|
yading@10
|
2667 #define FF_PROFILE_AAC_LD 22
|
yading@10
|
2668 #define FF_PROFILE_AAC_ELD 38
|
yading@10
|
2669
|
yading@10
|
2670 #define FF_PROFILE_DTS 20
|
yading@10
|
2671 #define FF_PROFILE_DTS_ES 30
|
yading@10
|
2672 #define FF_PROFILE_DTS_96_24 40
|
yading@10
|
2673 #define FF_PROFILE_DTS_HD_HRA 50
|
yading@10
|
2674 #define FF_PROFILE_DTS_HD_MA 60
|
yading@10
|
2675
|
yading@10
|
2676 #define FF_PROFILE_MPEG2_422 0
|
yading@10
|
2677 #define FF_PROFILE_MPEG2_HIGH 1
|
yading@10
|
2678 #define FF_PROFILE_MPEG2_SS 2
|
yading@10
|
2679 #define FF_PROFILE_MPEG2_SNR_SCALABLE 3
|
yading@10
|
2680 #define FF_PROFILE_MPEG2_MAIN 4
|
yading@10
|
2681 #define FF_PROFILE_MPEG2_SIMPLE 5
|
yading@10
|
2682
|
yading@10
|
2683 #define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
|
yading@10
|
2684 #define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
|
yading@10
|
2685
|
yading@10
|
2686 #define FF_PROFILE_H264_BASELINE 66
|
yading@10
|
2687 #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
|
yading@10
|
2688 #define FF_PROFILE_H264_MAIN 77
|
yading@10
|
2689 #define FF_PROFILE_H264_EXTENDED 88
|
yading@10
|
2690 #define FF_PROFILE_H264_HIGH 100
|
yading@10
|
2691 #define FF_PROFILE_H264_HIGH_10 110
|
yading@10
|
2692 #define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
|
yading@10
|
2693 #define FF_PROFILE_H264_HIGH_422 122
|
yading@10
|
2694 #define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
|
yading@10
|
2695 #define FF_PROFILE_H264_HIGH_444 144
|
yading@10
|
2696 #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
|
yading@10
|
2697 #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
|
yading@10
|
2698 #define FF_PROFILE_H264_CAVLC_444 44
|
yading@10
|
2699
|
yading@10
|
2700 #define FF_PROFILE_VC1_SIMPLE 0
|
yading@10
|
2701 #define FF_PROFILE_VC1_MAIN 1
|
yading@10
|
2702 #define FF_PROFILE_VC1_COMPLEX 2
|
yading@10
|
2703 #define FF_PROFILE_VC1_ADVANCED 3
|
yading@10
|
2704
|
yading@10
|
2705 #define FF_PROFILE_MPEG4_SIMPLE 0
|
yading@10
|
2706 #define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
|
yading@10
|
2707 #define FF_PROFILE_MPEG4_CORE 2
|
yading@10
|
2708 #define FF_PROFILE_MPEG4_MAIN 3
|
yading@10
|
2709 #define FF_PROFILE_MPEG4_N_BIT 4
|
yading@10
|
2710 #define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
|
yading@10
|
2711 #define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
|
yading@10
|
2712 #define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
|
yading@10
|
2713 #define FF_PROFILE_MPEG4_HYBRID 8
|
yading@10
|
2714 #define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
|
yading@10
|
2715 #define FF_PROFILE_MPEG4_CORE_SCALABLE 10
|
yading@10
|
2716 #define FF_PROFILE_MPEG4_ADVANCED_CODING 11
|
yading@10
|
2717 #define FF_PROFILE_MPEG4_ADVANCED_CORE 12
|
yading@10
|
2718 #define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
|
yading@10
|
2719 #define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
|
yading@10
|
2720 #define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
|
yading@10
|
2721
|
yading@10
|
2722 /**
|
yading@10
|
2723 * level
|
yading@10
|
2724 * - encoding: Set by user.
|
yading@10
|
2725 * - decoding: Set by libavcodec.
|
yading@10
|
2726 */
|
yading@10
|
2727 int level;
|
yading@10
|
2728 #define FF_LEVEL_UNKNOWN -99
|
yading@10
|
2729
|
yading@10
|
2730 /**
|
yading@10
|
2731 * Skip loop filtering for selected frames.
|
yading@10
|
2732 * - encoding: unused
|
yading@10
|
2733 * - decoding: Set by user.
|
yading@10
|
2734 */
|
yading@10
|
2735 enum AVDiscard skip_loop_filter;
|
yading@10
|
2736
|
yading@10
|
2737 /**
|
yading@10
|
2738 * Skip IDCT/dequantization for selected frames.
|
yading@10
|
2739 * - encoding: unused
|
yading@10
|
2740 * - decoding: Set by user.
|
yading@10
|
2741 */
|
yading@10
|
2742 enum AVDiscard skip_idct;
|
yading@10
|
2743
|
yading@10
|
2744 /**
|
yading@10
|
2745 * Skip decoding for selected frames.
|
yading@10
|
2746 * - encoding: unused
|
yading@10
|
2747 * - decoding: Set by user.
|
yading@10
|
2748 */
|
yading@10
|
2749 enum AVDiscard skip_frame;
|
yading@10
|
2750
|
yading@10
|
2751 /**
|
yading@10
|
2752 * Header containing style information for text subtitles.
|
yading@10
|
2753 * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
|
yading@10
|
2754 * [Script Info] and [V4+ Styles] section, plus the [Events] line and
|
yading@10
|
2755 * the Format line following. It shouldn't include any Dialogue line.
|
yading@10
|
2756 * - encoding: Set/allocated/freed by user (before avcodec_open2())
|
yading@10
|
2757 * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
|
yading@10
|
2758 */
|
yading@10
|
2759 uint8_t *subtitle_header;
|
yading@10
|
2760 int subtitle_header_size;
|
yading@10
|
2761
|
yading@10
|
2762 /**
|
yading@10
|
2763 * Simulates errors in the bitstream to test error concealment.
|
yading@10
|
2764 * - encoding: Set by user.
|
yading@10
|
2765 * - decoding: unused
|
yading@10
|
2766 */
|
yading@10
|
2767 int error_rate;
|
yading@10
|
2768
|
yading@10
|
2769 /**
|
yading@10
|
2770 * Current packet as passed into the decoder, to avoid having
|
yading@10
|
2771 * to pass the packet into every function. Currently only valid
|
yading@10
|
2772 * inside lavc and get/release_buffer callbacks.
|
yading@10
|
2773 * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
|
yading@10
|
2774 * - encoding: unused
|
yading@10
|
2775 */
|
yading@10
|
2776 AVPacket *pkt;
|
yading@10
|
2777
|
yading@10
|
2778 /**
|
yading@10
|
2779 * VBV delay coded in the last frame (in periods of a 27 MHz clock).
|
yading@10
|
2780 * Used for compliant TS muxing.
|
yading@10
|
2781 * - encoding: Set by libavcodec.
|
yading@10
|
2782 * - decoding: unused.
|
yading@10
|
2783 */
|
yading@10
|
2784 uint64_t vbv_delay;
|
yading@10
|
2785
|
yading@10
|
2786 /**
|
yading@10
|
2787 * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
|
yading@10
|
2788 * Code outside libavcodec should access this field using:
|
yading@10
|
2789 * av_codec_{get,set}_pkt_timebase(avctx)
|
yading@10
|
2790 * - encoding unused.
|
yading@10
|
2791 * - decodimg set by user
|
yading@10
|
2792 */
|
yading@10
|
2793 AVRational pkt_timebase;
|
yading@10
|
2794
|
yading@10
|
2795 /**
|
yading@10
|
2796 * AVCodecDescriptor
|
yading@10
|
2797 * Code outside libavcodec should access this field using:
|
yading@10
|
2798 * av_codec_{get,set}_codec_descriptor(avctx)
|
yading@10
|
2799 * - encoding: unused.
|
yading@10
|
2800 * - decoding: set by libavcodec.
|
yading@10
|
2801 */
|
yading@10
|
2802 const AVCodecDescriptor *codec_descriptor;
|
yading@10
|
2803
|
yading@10
|
2804 /**
|
yading@10
|
2805 * Current statistics for PTS correction.
|
yading@10
|
2806 * - decoding: maintained and used by libavcodec, not intended to be used by user apps
|
yading@10
|
2807 * - encoding: unused
|
yading@10
|
2808 */
|
yading@10
|
2809 int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
|
yading@10
|
2810 int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
|
yading@10
|
2811 int64_t pts_correction_last_pts; /// PTS of the last frame
|
yading@10
|
2812 int64_t pts_correction_last_dts; /// DTS of the last frame
|
yading@10
|
2813
|
yading@10
|
2814 /**
|
yading@10
|
2815 * Character encoding of the input subtitles file.
|
yading@10
|
2816 * - decoding: set by user
|
yading@10
|
2817 * - encoding: unused
|
yading@10
|
2818 */
|
yading@10
|
2819 char *sub_charenc;
|
yading@10
|
2820
|
yading@10
|
2821 /**
|
yading@10
|
2822 * Subtitles character encoding mode. Formats or codecs might be adjusting
|
yading@10
|
2823 * this setting (if they are doing the conversion themselves for instance).
|
yading@10
|
2824 * - decoding: set by libavcodec
|
yading@10
|
2825 * - encoding: unused
|
yading@10
|
2826 */
|
yading@10
|
2827 int sub_charenc_mode;
|
yading@10
|
2828 #define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
|
yading@10
|
2829 #define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself
|
yading@10
|
2830 #define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
|
yading@10
|
2831 } AVCodecContext;
|
yading@10
|
2832
|
yading@10
|
2833 AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
|
yading@10
|
2834 void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val);
|
yading@10
|
2835
|
yading@10
|
2836 const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
|
yading@10
|
2837 void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
|
yading@10
|
2838
|
yading@10
|
2839 /**
|
yading@10
|
2840 * AVProfile.
|
yading@10
|
2841 */
|
yading@10
|
2842 typedef struct AVProfile {
|
yading@10
|
2843 int profile;
|
yading@10
|
2844 const char *name; ///< short name for the profile
|
yading@10
|
2845 } AVProfile;
|
yading@10
|
2846
|
yading@10
|
2847 typedef struct AVCodecDefault AVCodecDefault;
|
yading@10
|
2848
|
yading@10
|
2849 struct AVSubtitle;
|
yading@10
|
2850
|
yading@10
|
2851 /**
|
yading@10
|
2852 * AVCodec.
|
yading@10
|
2853 */
|
yading@10
|
2854 typedef struct AVCodec {
|
yading@10
|
2855 /**
|
yading@10
|
2856 * Name of the codec implementation.
|
yading@10
|
2857 * The name is globally unique among encoders and among decoders (but an
|
yading@10
|
2858 * encoder and a decoder can share the same name).
|
yading@10
|
2859 * This is the primary way to find a codec from the user perspective.
|
yading@10
|
2860 */
|
yading@10
|
2861 const char *name;
|
yading@10
|
2862 /**
|
yading@10
|
2863 * Descriptive name for the codec, meant to be more human readable than name.
|
yading@10
|
2864 * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
|
yading@10
|
2865 */
|
yading@10
|
2866 const char *long_name;
|
yading@10
|
2867 enum AVMediaType type;
|
yading@10
|
2868 enum AVCodecID id;
|
yading@10
|
2869 /**
|
yading@10
|
2870 * Codec capabilities.
|
yading@10
|
2871 * see CODEC_CAP_*
|
yading@10
|
2872 */
|
yading@10
|
2873 int capabilities;
|
yading@10
|
2874 const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
|
yading@10
|
2875 const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
|
yading@10
|
2876 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
|
yading@10
|
2877 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
|
yading@10
|
2878 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
|
yading@10
|
2879 uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
|
yading@10
|
2880 const AVClass *priv_class; ///< AVClass for the private context
|
yading@10
|
2881 const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
|
yading@10
|
2882
|
yading@10
|
2883 /*****************************************************************
|
yading@10
|
2884 * No fields below this line are part of the public API. They
|
yading@10
|
2885 * may not be used outside of libavcodec and can be changed and
|
yading@10
|
2886 * removed at will.
|
yading@10
|
2887 * New public fields should be added right above.
|
yading@10
|
2888 *****************************************************************
|
yading@10
|
2889 */
|
yading@10
|
2890 int priv_data_size;
|
yading@10
|
2891 struct AVCodec *next;
|
yading@10
|
2892 /**
|
yading@10
|
2893 * @name Frame-level threading support functions
|
yading@10
|
2894 * @{
|
yading@10
|
2895 */
|
yading@10
|
2896 /**
|
yading@10
|
2897 * If defined, called on thread contexts when they are created.
|
yading@10
|
2898 * If the codec allocates writable tables in init(), re-allocate them here.
|
yading@10
|
2899 * priv_data will be set to a copy of the original.
|
yading@10
|
2900 */
|
yading@10
|
2901 int (*init_thread_copy)(AVCodecContext *);
|
yading@10
|
2902 /**
|
yading@10
|
2903 * Copy necessary context variables from a previous thread context to the current one.
|
yading@10
|
2904 * If not defined, the next thread will start automatically; otherwise, the codec
|
yading@10
|
2905 * must call ff_thread_finish_setup().
|
yading@10
|
2906 *
|
yading@10
|
2907 * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
|
yading@10
|
2908 */
|
yading@10
|
2909 int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
|
yading@10
|
2910 /** @} */
|
yading@10
|
2911
|
yading@10
|
2912 /**
|
yading@10
|
2913 * Private codec-specific defaults.
|
yading@10
|
2914 */
|
yading@10
|
2915 const AVCodecDefault *defaults;
|
yading@10
|
2916
|
yading@10
|
2917 /**
|
yading@10
|
2918 * Initialize codec static data, called from avcodec_register().
|
yading@10
|
2919 */
|
yading@10
|
2920 void (*init_static_data)(struct AVCodec *codec);
|
yading@10
|
2921
|
yading@10
|
2922 int (*init)(AVCodecContext *);
|
yading@10
|
2923 int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
|
yading@10
|
2924 const struct AVSubtitle *sub);
|
yading@10
|
2925 /**
|
yading@10
|
2926 * Encode data to an AVPacket.
|
yading@10
|
2927 *
|
yading@10
|
2928 * @param avctx codec context
|
yading@10
|
2929 * @param avpkt output AVPacket (may contain a user-provided buffer)
|
yading@10
|
2930 * @param[in] frame AVFrame containing the raw data to be encoded
|
yading@10
|
2931 * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
|
yading@10
|
2932 * non-empty packet was returned in avpkt.
|
yading@10
|
2933 * @return 0 on success, negative error code on failure
|
yading@10
|
2934 */
|
yading@10
|
2935 int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
|
yading@10
|
2936 int *got_packet_ptr);
|
yading@10
|
2937 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
|
yading@10
|
2938 int (*close)(AVCodecContext *);
|
yading@10
|
2939 /**
|
yading@10
|
2940 * Flush buffers.
|
yading@10
|
2941 * Will be called when seeking
|
yading@10
|
2942 */
|
yading@10
|
2943 void (*flush)(AVCodecContext *);
|
yading@10
|
2944 } AVCodec;
|
yading@10
|
2945
|
yading@10
|
2946 /**
|
yading@10
|
2947 * AVHWAccel.
|
yading@10
|
2948 */
|
yading@10
|
2949 typedef struct AVHWAccel {
|
yading@10
|
2950 /**
|
yading@10
|
2951 * Name of the hardware accelerated codec.
|
yading@10
|
2952 * The name is globally unique among encoders and among decoders (but an
|
yading@10
|
2953 * encoder and a decoder can share the same name).
|
yading@10
|
2954 */
|
yading@10
|
2955 const char *name;
|
yading@10
|
2956
|
yading@10
|
2957 /**
|
yading@10
|
2958 * Type of codec implemented by the hardware accelerator.
|
yading@10
|
2959 *
|
yading@10
|
2960 * See AVMEDIA_TYPE_xxx
|
yading@10
|
2961 */
|
yading@10
|
2962 enum AVMediaType type;
|
yading@10
|
2963
|
yading@10
|
2964 /**
|
yading@10
|
2965 * Codec implemented by the hardware accelerator.
|
yading@10
|
2966 *
|
yading@10
|
2967 * See AV_CODEC_ID_xxx
|
yading@10
|
2968 */
|
yading@10
|
2969 enum AVCodecID id;
|
yading@10
|
2970
|
yading@10
|
2971 /**
|
yading@10
|
2972 * Supported pixel format.
|
yading@10
|
2973 *
|
yading@10
|
2974 * Only hardware accelerated formats are supported here.
|
yading@10
|
2975 */
|
yading@10
|
2976 enum AVPixelFormat pix_fmt;
|
yading@10
|
2977
|
yading@10
|
2978 /**
|
yading@10
|
2979 * Hardware accelerated codec capabilities.
|
yading@10
|
2980 * see FF_HWACCEL_CODEC_CAP_*
|
yading@10
|
2981 */
|
yading@10
|
2982 int capabilities;
|
yading@10
|
2983
|
yading@10
|
2984 struct AVHWAccel *next;
|
yading@10
|
2985
|
yading@10
|
2986 /**
|
yading@10
|
2987 * Called at the beginning of each frame or field picture.
|
yading@10
|
2988 *
|
yading@10
|
2989 * Meaningful frame information (codec specific) is guaranteed to
|
yading@10
|
2990 * be parsed at this point. This function is mandatory.
|
yading@10
|
2991 *
|
yading@10
|
2992 * Note that buf can be NULL along with buf_size set to 0.
|
yading@10
|
2993 * Otherwise, this means the whole frame is available at this point.
|
yading@10
|
2994 *
|
yading@10
|
2995 * @param avctx the codec context
|
yading@10
|
2996 * @param buf the frame data buffer base
|
yading@10
|
2997 * @param buf_size the size of the frame in bytes
|
yading@10
|
2998 * @return zero if successful, a negative value otherwise
|
yading@10
|
2999 */
|
yading@10
|
3000 int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
|
yading@10
|
3001
|
yading@10
|
3002 /**
|
yading@10
|
3003 * Callback for each slice.
|
yading@10
|
3004 *
|
yading@10
|
3005 * Meaningful slice information (codec specific) is guaranteed to
|
yading@10
|
3006 * be parsed at this point. This function is mandatory.
|
yading@10
|
3007 *
|
yading@10
|
3008 * @param avctx the codec context
|
yading@10
|
3009 * @param buf the slice data buffer base
|
yading@10
|
3010 * @param buf_size the size of the slice in bytes
|
yading@10
|
3011 * @return zero if successful, a negative value otherwise
|
yading@10
|
3012 */
|
yading@10
|
3013 int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
|
yading@10
|
3014
|
yading@10
|
3015 /**
|
yading@10
|
3016 * Called at the end of each frame or field picture.
|
yading@10
|
3017 *
|
yading@10
|
3018 * The whole picture is parsed at this point and can now be sent
|
yading@10
|
3019 * to the hardware accelerator. This function is mandatory.
|
yading@10
|
3020 *
|
yading@10
|
3021 * @param avctx the codec context
|
yading@10
|
3022 * @return zero if successful, a negative value otherwise
|
yading@10
|
3023 */
|
yading@10
|
3024 int (*end_frame)(AVCodecContext *avctx);
|
yading@10
|
3025
|
yading@10
|
3026 /**
|
yading@10
|
3027 * Size of HW accelerator private data.
|
yading@10
|
3028 *
|
yading@10
|
3029 * Private data is allocated with av_mallocz() before
|
yading@10
|
3030 * AVCodecContext.get_buffer() and deallocated after
|
yading@10
|
3031 * AVCodecContext.release_buffer().
|
yading@10
|
3032 */
|
yading@10
|
3033 int priv_data_size;
|
yading@10
|
3034 } AVHWAccel;
|
yading@10
|
3035
|
yading@10
|
3036 /**
|
yading@10
|
3037 * @defgroup lavc_picture AVPicture
|
yading@10
|
3038 *
|
yading@10
|
3039 * Functions for working with AVPicture
|
yading@10
|
3040 * @{
|
yading@10
|
3041 */
|
yading@10
|
3042
|
yading@10
|
3043 /**
|
yading@10
|
3044 * four components are given, that's all.
|
yading@10
|
3045 * the last component is alpha
|
yading@10
|
3046 */
|
yading@10
|
3047 typedef struct AVPicture {
|
yading@10
|
3048 uint8_t *data[AV_NUM_DATA_POINTERS];
|
yading@10
|
3049 int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
|
yading@10
|
3050 } AVPicture;
|
yading@10
|
3051
|
yading@10
|
3052 /**
|
yading@10
|
3053 * @}
|
yading@10
|
3054 */
|
yading@10
|
3055
|
yading@10
|
3056 enum AVSubtitleType {
|
yading@10
|
3057 SUBTITLE_NONE,
|
yading@10
|
3058
|
yading@10
|
3059 SUBTITLE_BITMAP, ///< A bitmap, pict will be set
|
yading@10
|
3060
|
yading@10
|
3061 /**
|
yading@10
|
3062 * Plain text, the text field must be set by the decoder and is
|
yading@10
|
3063 * authoritative. ass and pict fields may contain approximations.
|
yading@10
|
3064 */
|
yading@10
|
3065 SUBTITLE_TEXT,
|
yading@10
|
3066
|
yading@10
|
3067 /**
|
yading@10
|
3068 * Formatted text, the ass field must be set by the decoder and is
|
yading@10
|
3069 * authoritative. pict and text fields may contain approximations.
|
yading@10
|
3070 */
|
yading@10
|
3071 SUBTITLE_ASS,
|
yading@10
|
3072 };
|
yading@10
|
3073
|
yading@10
|
3074 #define AV_SUBTITLE_FLAG_FORCED 0x00000001
|
yading@10
|
3075
|
yading@10
|
3076 typedef struct AVSubtitleRect {
|
yading@10
|
3077 int x; ///< top left corner of pict, undefined when pict is not set
|
yading@10
|
3078 int y; ///< top left corner of pict, undefined when pict is not set
|
yading@10
|
3079 int w; ///< width of pict, undefined when pict is not set
|
yading@10
|
3080 int h; ///< height of pict, undefined when pict is not set
|
yading@10
|
3081 int nb_colors; ///< number of colors in pict, undefined when pict is not set
|
yading@10
|
3082
|
yading@10
|
3083 /**
|
yading@10
|
3084 * data+linesize for the bitmap of this subtitle.
|
yading@10
|
3085 * can be set for text/ass as well once they where rendered
|
yading@10
|
3086 */
|
yading@10
|
3087 AVPicture pict;
|
yading@10
|
3088 enum AVSubtitleType type;
|
yading@10
|
3089
|
yading@10
|
3090 char *text; ///< 0 terminated plain UTF-8 text
|
yading@10
|
3091
|
yading@10
|
3092 /**
|
yading@10
|
3093 * 0 terminated ASS/SSA compatible event line.
|
yading@10
|
3094 * The presentation of this is unaffected by the other values in this
|
yading@10
|
3095 * struct.
|
yading@10
|
3096 */
|
yading@10
|
3097 char *ass;
|
yading@10
|
3098
|
yading@10
|
3099 int flags;
|
yading@10
|
3100 } AVSubtitleRect;
|
yading@10
|
3101
|
yading@10
|
3102 typedef struct AVSubtitle {
|
yading@10
|
3103 uint16_t format; /* 0 = graphics */
|
yading@10
|
3104 uint32_t start_display_time; /* relative to packet pts, in ms */
|
yading@10
|
3105 uint32_t end_display_time; /* relative to packet pts, in ms */
|
yading@10
|
3106 unsigned num_rects;
|
yading@10
|
3107 AVSubtitleRect **rects;
|
yading@10
|
3108 int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
|
yading@10
|
3109 } AVSubtitle;
|
yading@10
|
3110
|
yading@10
|
3111 /**
|
yading@10
|
3112 * If c is NULL, returns the first registered codec,
|
yading@10
|
3113 * if c is non-NULL, returns the next registered codec after c,
|
yading@10
|
3114 * or NULL if c is the last one.
|
yading@10
|
3115 */
|
yading@10
|
3116 AVCodec *av_codec_next(const AVCodec *c);
|
yading@10
|
3117
|
yading@10
|
3118 /**
|
yading@10
|
3119 * Return the LIBAVCODEC_VERSION_INT constant.
|
yading@10
|
3120 */
|
yading@10
|
3121 unsigned avcodec_version(void);
|
yading@10
|
3122
|
yading@10
|
3123 /**
|
yading@10
|
3124 * Return the libavcodec build-time configuration.
|
yading@10
|
3125 */
|
yading@10
|
3126 const char *avcodec_configuration(void);
|
yading@10
|
3127
|
yading@10
|
3128 /**
|
yading@10
|
3129 * Return the libavcodec license.
|
yading@10
|
3130 */
|
yading@10
|
3131 const char *avcodec_license(void);
|
yading@10
|
3132
|
yading@10
|
3133 /**
|
yading@10
|
3134 * Register the codec codec and initialize libavcodec.
|
yading@10
|
3135 *
|
yading@10
|
3136 * @warning either this function or avcodec_register_all() must be called
|
yading@10
|
3137 * before any other libavcodec functions.
|
yading@10
|
3138 *
|
yading@10
|
3139 * @see avcodec_register_all()
|
yading@10
|
3140 */
|
yading@10
|
3141 void avcodec_register(AVCodec *codec);
|
yading@10
|
3142
|
yading@10
|
3143 /**
|
yading@10
|
3144 * Register all the codecs, parsers and bitstream filters which were enabled at
|
yading@10
|
3145 * configuration time. If you do not call this function you can select exactly
|
yading@10
|
3146 * which formats you want to support, by using the individual registration
|
yading@10
|
3147 * functions.
|
yading@10
|
3148 *
|
yading@10
|
3149 * @see avcodec_register
|
yading@10
|
3150 * @see av_register_codec_parser
|
yading@10
|
3151 * @see av_register_bitstream_filter
|
yading@10
|
3152 */
|
yading@10
|
3153 void avcodec_register_all(void);
|
yading@10
|
3154
|
yading@10
|
3155
|
yading@10
|
3156 #if FF_API_ALLOC_CONTEXT
|
yading@10
|
3157 /**
|
yading@10
|
3158 * Allocate an AVCodecContext and set its fields to default values. The
|
yading@10
|
3159 * resulting struct can be deallocated by simply calling av_free().
|
yading@10
|
3160 *
|
yading@10
|
3161 * @return An AVCodecContext filled with default values or NULL on failure.
|
yading@10
|
3162 * @see avcodec_get_context_defaults
|
yading@10
|
3163 *
|
yading@10
|
3164 * @deprecated use avcodec_alloc_context3()
|
yading@10
|
3165 */
|
yading@10
|
3166 attribute_deprecated
|
yading@10
|
3167 AVCodecContext *avcodec_alloc_context(void);
|
yading@10
|
3168
|
yading@10
|
3169 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
|
yading@10
|
3170 * we WILL change its arguments and name a few times! */
|
yading@10
|
3171 attribute_deprecated
|
yading@10
|
3172 AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
|
yading@10
|
3173
|
yading@10
|
3174 /**
|
yading@10
|
3175 * Set the fields of the given AVCodecContext to default values.
|
yading@10
|
3176 *
|
yading@10
|
3177 * @param s The AVCodecContext of which the fields should be set to default values.
|
yading@10
|
3178 * @deprecated use avcodec_get_context_defaults3
|
yading@10
|
3179 */
|
yading@10
|
3180 attribute_deprecated
|
yading@10
|
3181 void avcodec_get_context_defaults(AVCodecContext *s);
|
yading@10
|
3182
|
yading@10
|
3183 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
|
yading@10
|
3184 * we WILL change its arguments and name a few times! */
|
yading@10
|
3185 attribute_deprecated
|
yading@10
|
3186 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
|
yading@10
|
3187 #endif
|
yading@10
|
3188
|
yading@10
|
3189 /**
|
yading@10
|
3190 * Allocate an AVCodecContext and set its fields to default values. The
|
yading@10
|
3191 * resulting struct can be deallocated by calling avcodec_close() on it followed
|
yading@10
|
3192 * by av_free().
|
yading@10
|
3193 *
|
yading@10
|
3194 * @param codec if non-NULL, allocate private data and initialize defaults
|
yading@10
|
3195 * for the given codec. It is illegal to then call avcodec_open2()
|
yading@10
|
3196 * with a different codec.
|
yading@10
|
3197 * If NULL, then the codec-specific defaults won't be initialized,
|
yading@10
|
3198 * which may result in suboptimal default settings (this is
|
yading@10
|
3199 * important mainly for encoders, e.g. libx264).
|
yading@10
|
3200 *
|
yading@10
|
3201 * @return An AVCodecContext filled with default values or NULL on failure.
|
yading@10
|
3202 * @see avcodec_get_context_defaults
|
yading@10
|
3203 */
|
yading@10
|
3204 AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
|
yading@10
|
3205
|
yading@10
|
3206 /**
|
yading@10
|
3207 * Set the fields of the given AVCodecContext to default values corresponding
|
yading@10
|
3208 * to the given codec (defaults may be codec-dependent).
|
yading@10
|
3209 *
|
yading@10
|
3210 * Do not call this function if a non-NULL codec has been passed
|
yading@10
|
3211 * to avcodec_alloc_context3() that allocated this AVCodecContext.
|
yading@10
|
3212 * If codec is non-NULL, it is illegal to call avcodec_open2() with a
|
yading@10
|
3213 * different codec on this AVCodecContext.
|
yading@10
|
3214 */
|
yading@10
|
3215 int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
|
yading@10
|
3216
|
yading@10
|
3217 /**
|
yading@10
|
3218 * Get the AVClass for AVCodecContext. It can be used in combination with
|
yading@10
|
3219 * AV_OPT_SEARCH_FAKE_OBJ for examining options.
|
yading@10
|
3220 *
|
yading@10
|
3221 * @see av_opt_find().
|
yading@10
|
3222 */
|
yading@10
|
3223 const AVClass *avcodec_get_class(void);
|
yading@10
|
3224
|
yading@10
|
3225 /**
|
yading@10
|
3226 * Get the AVClass for AVFrame. It can be used in combination with
|
yading@10
|
3227 * AV_OPT_SEARCH_FAKE_OBJ for examining options.
|
yading@10
|
3228 *
|
yading@10
|
3229 * @see av_opt_find().
|
yading@10
|
3230 */
|
yading@10
|
3231 const AVClass *avcodec_get_frame_class(void);
|
yading@10
|
3232
|
yading@10
|
3233 /**
|
yading@10
|
3234 * Get the AVClass for AVSubtitleRect. It can be used in combination with
|
yading@10
|
3235 * AV_OPT_SEARCH_FAKE_OBJ for examining options.
|
yading@10
|
3236 *
|
yading@10
|
3237 * @see av_opt_find().
|
yading@10
|
3238 */
|
yading@10
|
3239 const AVClass *avcodec_get_subtitle_rect_class(void);
|
yading@10
|
3240
|
yading@10
|
3241 /**
|
yading@10
|
3242 * Copy the settings of the source AVCodecContext into the destination
|
yading@10
|
3243 * AVCodecContext. The resulting destination codec context will be
|
yading@10
|
3244 * unopened, i.e. you are required to call avcodec_open2() before you
|
yading@10
|
3245 * can use this AVCodecContext to decode/encode video/audio data.
|
yading@10
|
3246 *
|
yading@10
|
3247 * @param dest target codec context, should be initialized with
|
yading@10
|
3248 * avcodec_alloc_context3(), but otherwise uninitialized
|
yading@10
|
3249 * @param src source codec context
|
yading@10
|
3250 * @return AVERROR() on error (e.g. memory allocation error), 0 on success
|
yading@10
|
3251 */
|
yading@10
|
3252 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
|
yading@10
|
3253
|
yading@10
|
3254 /**
|
yading@10
|
3255 * Allocate an AVFrame and set its fields to default values. The resulting
|
yading@10
|
3256 * struct must be freed using avcodec_free_frame().
|
yading@10
|
3257 *
|
yading@10
|
3258 * @return An AVFrame filled with default values or NULL on failure.
|
yading@10
|
3259 * @see avcodec_get_frame_defaults
|
yading@10
|
3260 */
|
yading@10
|
3261 AVFrame *avcodec_alloc_frame(void);
|
yading@10
|
3262
|
yading@10
|
3263 /**
|
yading@10
|
3264 * Set the fields of the given AVFrame to default values.
|
yading@10
|
3265 *
|
yading@10
|
3266 * @param frame The AVFrame of which the fields should be set to default values.
|
yading@10
|
3267 */
|
yading@10
|
3268 void avcodec_get_frame_defaults(AVFrame *frame);
|
yading@10
|
3269
|
yading@10
|
3270 /**
|
yading@10
|
3271 * Free the frame and any dynamically allocated objects in it,
|
yading@10
|
3272 * e.g. extended_data.
|
yading@10
|
3273 *
|
yading@10
|
3274 * @param frame frame to be freed. The pointer will be set to NULL.
|
yading@10
|
3275 *
|
yading@10
|
3276 * @warning this function does NOT free the data buffers themselves
|
yading@10
|
3277 * (it does not know how, since they might have been allocated with
|
yading@10
|
3278 * a custom get_buffer()).
|
yading@10
|
3279 */
|
yading@10
|
3280 void avcodec_free_frame(AVFrame **frame);
|
yading@10
|
3281
|
yading@10
|
3282 #if FF_API_AVCODEC_OPEN
|
yading@10
|
3283 /**
|
yading@10
|
3284 * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
|
yading@10
|
3285 * function the context has to be allocated.
|
yading@10
|
3286 *
|
yading@10
|
3287 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
|
yading@10
|
3288 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
|
yading@10
|
3289 * retrieving a codec.
|
yading@10
|
3290 *
|
yading@10
|
3291 * @warning This function is not thread safe!
|
yading@10
|
3292 *
|
yading@10
|
3293 * @code
|
yading@10
|
3294 * avcodec_register_all();
|
yading@10
|
3295 * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
|
yading@10
|
3296 * if (!codec)
|
yading@10
|
3297 * exit(1);
|
yading@10
|
3298 *
|
yading@10
|
3299 * context = avcodec_alloc_context3(codec);
|
yading@10
|
3300 *
|
yading@10
|
3301 * if (avcodec_open(context, codec) < 0)
|
yading@10
|
3302 * exit(1);
|
yading@10
|
3303 * @endcode
|
yading@10
|
3304 *
|
yading@10
|
3305 * @param avctx The context which will be set up to use the given codec.
|
yading@10
|
3306 * @param codec The codec to use within the context.
|
yading@10
|
3307 * @return zero on success, a negative value on error
|
yading@10
|
3308 * @see avcodec_alloc_context3, avcodec_find_decoder, avcodec_find_encoder, avcodec_close
|
yading@10
|
3309 *
|
yading@10
|
3310 * @deprecated use avcodec_open2
|
yading@10
|
3311 */
|
yading@10
|
3312 attribute_deprecated
|
yading@10
|
3313 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
|
yading@10
|
3314 #endif
|
yading@10
|
3315
|
yading@10
|
3316 /**
|
yading@10
|
3317 * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
|
yading@10
|
3318 * function the context has to be allocated with avcodec_alloc_context3().
|
yading@10
|
3319 *
|
yading@10
|
3320 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
|
yading@10
|
3321 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
|
yading@10
|
3322 * retrieving a codec.
|
yading@10
|
3323 *
|
yading@10
|
3324 * @warning This function is not thread safe!
|
yading@10
|
3325 *
|
yading@10
|
3326 * @code
|
yading@10
|
3327 * avcodec_register_all();
|
yading@10
|
3328 * av_dict_set(&opts, "b", "2.5M", 0);
|
yading@10
|
3329 * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
|
yading@10
|
3330 * if (!codec)
|
yading@10
|
3331 * exit(1);
|
yading@10
|
3332 *
|
yading@10
|
3333 * context = avcodec_alloc_context3(codec);
|
yading@10
|
3334 *
|
yading@10
|
3335 * if (avcodec_open2(context, codec, opts) < 0)
|
yading@10
|
3336 * exit(1);
|
yading@10
|
3337 * @endcode
|
yading@10
|
3338 *
|
yading@10
|
3339 * @param avctx The context to initialize.
|
yading@10
|
3340 * @param codec The codec to open this context for. If a non-NULL codec has been
|
yading@10
|
3341 * previously passed to avcodec_alloc_context3() or
|
yading@10
|
3342 * avcodec_get_context_defaults3() for this context, then this
|
yading@10
|
3343 * parameter MUST be either NULL or equal to the previously passed
|
yading@10
|
3344 * codec.
|
yading@10
|
3345 * @param options A dictionary filled with AVCodecContext and codec-private options.
|
yading@10
|
3346 * On return this object will be filled with options that were not found.
|
yading@10
|
3347 *
|
yading@10
|
3348 * @return zero on success, a negative value on error
|
yading@10
|
3349 * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
|
yading@10
|
3350 * av_dict_set(), av_opt_find().
|
yading@10
|
3351 */
|
yading@10
|
3352 int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
|
yading@10
|
3353
|
yading@10
|
3354 /**
|
yading@10
|
3355 * Close a given AVCodecContext and free all the data associated with it
|
yading@10
|
3356 * (but not the AVCodecContext itself).
|
yading@10
|
3357 *
|
yading@10
|
3358 * Calling this function on an AVCodecContext that hasn't been opened will free
|
yading@10
|
3359 * the codec-specific data allocated in avcodec_alloc_context3() /
|
yading@10
|
3360 * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
|
yading@10
|
3361 * do nothing.
|
yading@10
|
3362 */
|
yading@10
|
3363 int avcodec_close(AVCodecContext *avctx);
|
yading@10
|
3364
|
yading@10
|
3365 /**
|
yading@10
|
3366 * Free all allocated data in the given subtitle struct.
|
yading@10
|
3367 *
|
yading@10
|
3368 * @param sub AVSubtitle to free.
|
yading@10
|
3369 */
|
yading@10
|
3370 void avsubtitle_free(AVSubtitle *sub);
|
yading@10
|
3371
|
yading@10
|
3372 /**
|
yading@10
|
3373 * @}
|
yading@10
|
3374 */
|
yading@10
|
3375
|
yading@10
|
3376 /**
|
yading@10
|
3377 * @addtogroup lavc_packet
|
yading@10
|
3378 * @{
|
yading@10
|
3379 */
|
yading@10
|
3380
|
yading@10
|
3381 #if FF_API_DESTRUCT_PACKET
|
yading@10
|
3382 /**
|
yading@10
|
3383 * Default packet destructor.
|
yading@10
|
3384 * @deprecated use the AVBuffer API instead
|
yading@10
|
3385 */
|
yading@10
|
3386 attribute_deprecated
|
yading@10
|
3387 void av_destruct_packet(AVPacket *pkt);
|
yading@10
|
3388 #endif
|
yading@10
|
3389
|
yading@10
|
3390 /**
|
yading@10
|
3391 * Initialize optional fields of a packet with default values.
|
yading@10
|
3392 *
|
yading@10
|
3393 * Note, this does not touch the data and size members, which have to be
|
yading@10
|
3394 * initialized separately.
|
yading@10
|
3395 *
|
yading@10
|
3396 * @param pkt packet
|
yading@10
|
3397 */
|
yading@10
|
3398 void av_init_packet(AVPacket *pkt);
|
yading@10
|
3399
|
yading@10
|
3400 /**
|
yading@10
|
3401 * Allocate the payload of a packet and initialize its fields with
|
yading@10
|
3402 * default values.
|
yading@10
|
3403 *
|
yading@10
|
3404 * @param pkt packet
|
yading@10
|
3405 * @param size wanted payload size
|
yading@10
|
3406 * @return 0 if OK, AVERROR_xxx otherwise
|
yading@10
|
3407 */
|
yading@10
|
3408 int av_new_packet(AVPacket *pkt, int size);
|
yading@10
|
3409
|
yading@10
|
3410 /**
|
yading@10
|
3411 * Reduce packet size, correctly zeroing padding
|
yading@10
|
3412 *
|
yading@10
|
3413 * @param pkt packet
|
yading@10
|
3414 * @param size new size
|
yading@10
|
3415 */
|
yading@10
|
3416 void av_shrink_packet(AVPacket *pkt, int size);
|
yading@10
|
3417
|
yading@10
|
3418 /**
|
yading@10
|
3419 * Increase packet size, correctly zeroing padding
|
yading@10
|
3420 *
|
yading@10
|
3421 * @param pkt packet
|
yading@10
|
3422 * @param grow_by number of bytes by which to increase the size of the packet
|
yading@10
|
3423 */
|
yading@10
|
3424 int av_grow_packet(AVPacket *pkt, int grow_by);
|
yading@10
|
3425
|
yading@10
|
3426 /**
|
yading@10
|
3427 * Initialize a reference-counted packet from av_malloc()ed data.
|
yading@10
|
3428 *
|
yading@10
|
3429 * @param pkt packet to be initialized. This function will set the data, size,
|
yading@10
|
3430 * buf and destruct fields, all others are left untouched.
|
yading@10
|
3431 * @param data Data allocated by av_malloc() to be used as packet data. If this
|
yading@10
|
3432 * function returns successfully, the data is owned by the underlying AVBuffer.
|
yading@10
|
3433 * The caller may not access the data through other means.
|
yading@10
|
3434 * @param size size of data in bytes, without the padding. I.e. the full buffer
|
yading@10
|
3435 * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE.
|
yading@10
|
3436 *
|
yading@10
|
3437 * @return 0 on success, a negative AVERROR on error
|
yading@10
|
3438 */
|
yading@10
|
3439 int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
|
yading@10
|
3440
|
yading@10
|
3441 /**
|
yading@10
|
3442 * @warning This is a hack - the packet memory allocation stuff is broken. The
|
yading@10
|
3443 * packet is allocated if it was not really allocated.
|
yading@10
|
3444 */
|
yading@10
|
3445 int av_dup_packet(AVPacket *pkt);
|
yading@10
|
3446
|
yading@10
|
3447 /**
|
yading@10
|
3448 * Copy packet, including contents
|
yading@10
|
3449 *
|
yading@10
|
3450 * @return 0 on success, negative AVERROR on fail
|
yading@10
|
3451 */
|
yading@10
|
3452 int av_copy_packet(AVPacket *dst, AVPacket *src);
|
yading@10
|
3453
|
yading@10
|
3454 /**
|
yading@10
|
3455 * Free a packet.
|
yading@10
|
3456 *
|
yading@10
|
3457 * @param pkt packet to free
|
yading@10
|
3458 */
|
yading@10
|
3459 void av_free_packet(AVPacket *pkt);
|
yading@10
|
3460
|
yading@10
|
3461 /**
|
yading@10
|
3462 * Allocate new information of a packet.
|
yading@10
|
3463 *
|
yading@10
|
3464 * @param pkt packet
|
yading@10
|
3465 * @param type side information type
|
yading@10
|
3466 * @param size side information size
|
yading@10
|
3467 * @return pointer to fresh allocated data or NULL otherwise
|
yading@10
|
3468 */
|
yading@10
|
3469 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
yading@10
|
3470 int size);
|
yading@10
|
3471
|
yading@10
|
3472 /**
|
yading@10
|
3473 * Shrink the already allocated side data buffer
|
yading@10
|
3474 *
|
yading@10
|
3475 * @param pkt packet
|
yading@10
|
3476 * @param type side information type
|
yading@10
|
3477 * @param size new side information size
|
yading@10
|
3478 * @return 0 on success, < 0 on failure
|
yading@10
|
3479 */
|
yading@10
|
3480 int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
yading@10
|
3481 int size);
|
yading@10
|
3482
|
yading@10
|
3483 /**
|
yading@10
|
3484 * Get side information from packet.
|
yading@10
|
3485 *
|
yading@10
|
3486 * @param pkt packet
|
yading@10
|
3487 * @param type desired side information type
|
yading@10
|
3488 * @param size pointer for side information size to store (optional)
|
yading@10
|
3489 * @return pointer to data if present or NULL otherwise
|
yading@10
|
3490 */
|
yading@10
|
3491 uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
yading@10
|
3492 int *size);
|
yading@10
|
3493
|
yading@10
|
3494 int av_packet_merge_side_data(AVPacket *pkt);
|
yading@10
|
3495
|
yading@10
|
3496 int av_packet_split_side_data(AVPacket *pkt);
|
yading@10
|
3497
|
yading@10
|
3498
|
yading@10
|
3499 /**
|
yading@10
|
3500 * @}
|
yading@10
|
3501 */
|
yading@10
|
3502
|
yading@10
|
3503 /**
|
yading@10
|
3504 * @addtogroup lavc_decoding
|
yading@10
|
3505 * @{
|
yading@10
|
3506 */
|
yading@10
|
3507
|
yading@10
|
3508 /**
|
yading@10
|
3509 * Find a registered decoder with a matching codec ID.
|
yading@10
|
3510 *
|
yading@10
|
3511 * @param id AVCodecID of the requested decoder
|
yading@10
|
3512 * @return A decoder if one was found, NULL otherwise.
|
yading@10
|
3513 */
|
yading@10
|
3514 AVCodec *avcodec_find_decoder(enum AVCodecID id);
|
yading@10
|
3515
|
yading@10
|
3516 /**
|
yading@10
|
3517 * Find a registered decoder with the specified name.
|
yading@10
|
3518 *
|
yading@10
|
3519 * @param name name of the requested decoder
|
yading@10
|
3520 * @return A decoder if one was found, NULL otherwise.
|
yading@10
|
3521 */
|
yading@10
|
3522 AVCodec *avcodec_find_decoder_by_name(const char *name);
|
yading@10
|
3523
|
yading@10
|
3524 #if FF_API_GET_BUFFER
|
yading@10
|
3525 attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
|
yading@10
|
3526 attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
|
yading@10
|
3527 attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
|
yading@10
|
3528 #endif
|
yading@10
|
3529
|
yading@10
|
3530 /**
|
yading@10
|
3531 * The default callback for AVCodecContext.get_buffer2(). It is made public so
|
yading@10
|
3532 * it can be called by custom get_buffer2() implementations for decoders without
|
yading@10
|
3533 * CODEC_CAP_DR1 set.
|
yading@10
|
3534 */
|
yading@10
|
3535 int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
|
yading@10
|
3536
|
yading@10
|
3537 /**
|
yading@10
|
3538 * Return the amount of padding in pixels which the get_buffer callback must
|
yading@10
|
3539 * provide around the edge of the image for codecs which do not have the
|
yading@10
|
3540 * CODEC_FLAG_EMU_EDGE flag.
|
yading@10
|
3541 *
|
yading@10
|
3542 * @return Required padding in pixels.
|
yading@10
|
3543 */
|
yading@10
|
3544 unsigned avcodec_get_edge_width(void);
|
yading@10
|
3545
|
yading@10
|
3546 /**
|
yading@10
|
3547 * Modify width and height values so that they will result in a memory
|
yading@10
|
3548 * buffer that is acceptable for the codec if you do not use any horizontal
|
yading@10
|
3549 * padding.
|
yading@10
|
3550 *
|
yading@10
|
3551 * May only be used if a codec with CODEC_CAP_DR1 has been opened.
|
yading@10
|
3552 * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
|
yading@10
|
3553 * according to avcodec_get_edge_width() before.
|
yading@10
|
3554 */
|
yading@10
|
3555 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
|
yading@10
|
3556
|
yading@10
|
3557 /**
|
yading@10
|
3558 * Modify width and height values so that they will result in a memory
|
yading@10
|
3559 * buffer that is acceptable for the codec if you also ensure that all
|
yading@10
|
3560 * line sizes are a multiple of the respective linesize_align[i].
|
yading@10
|
3561 *
|
yading@10
|
3562 * May only be used if a codec with CODEC_CAP_DR1 has been opened.
|
yading@10
|
3563 * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
|
yading@10
|
3564 * according to avcodec_get_edge_width() before.
|
yading@10
|
3565 */
|
yading@10
|
3566 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
yading@10
|
3567 int linesize_align[AV_NUM_DATA_POINTERS]);
|
yading@10
|
3568
|
yading@10
|
3569 #if FF_API_OLD_DECODE_AUDIO
|
yading@10
|
3570 /**
|
yading@10
|
3571 * Wrapper function which calls avcodec_decode_audio4.
|
yading@10
|
3572 *
|
yading@10
|
3573 * @deprecated Use avcodec_decode_audio4 instead.
|
yading@10
|
3574 *
|
yading@10
|
3575 * Decode the audio frame of size avpkt->size from avpkt->data into samples.
|
yading@10
|
3576 * Some decoders may support multiple frames in a single AVPacket, such
|
yading@10
|
3577 * decoders would then just decode the first frame. In this case,
|
yading@10
|
3578 * avcodec_decode_audio3 has to be called again with an AVPacket that contains
|
yading@10
|
3579 * the remaining data in order to decode the second frame etc.
|
yading@10
|
3580 * If no frame
|
yading@10
|
3581 * could be outputted, frame_size_ptr is zero. Otherwise, it is the
|
yading@10
|
3582 * decompressed frame size in bytes.
|
yading@10
|
3583 *
|
yading@10
|
3584 * @warning You must set frame_size_ptr to the allocated size of the
|
yading@10
|
3585 * output buffer before calling avcodec_decode_audio3().
|
yading@10
|
3586 *
|
yading@10
|
3587 * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
|
yading@10
|
3588 * the actual read bytes because some optimized bitstream readers read 32 or 64
|
yading@10
|
3589 * bits at once and could read over the end.
|
yading@10
|
3590 *
|
yading@10
|
3591 * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that
|
yading@10
|
3592 * no overreading happens for damaged MPEG streams.
|
yading@10
|
3593 *
|
yading@10
|
3594 * @warning You must not provide a custom get_buffer() when using
|
yading@10
|
3595 * avcodec_decode_audio3(). Doing so will override it with
|
yading@10
|
3596 * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead,
|
yading@10
|
3597 * which does allow the application to provide a custom get_buffer().
|
yading@10
|
3598 *
|
yading@10
|
3599 * @note You might have to align the input buffer avpkt->data and output buffer
|
yading@10
|
3600 * samples. The alignment requirements depend on the CPU: On some CPUs it isn't
|
yading@10
|
3601 * necessary at all, on others it won't work at all if not aligned and on others
|
yading@10
|
3602 * it will work but it will have an impact on performance.
|
yading@10
|
3603 *
|
yading@10
|
3604 * In practice, avpkt->data should have 4 byte alignment at minimum and
|
yading@10
|
3605 * samples should be 16 byte aligned unless the CPU doesn't need it
|
yading@10
|
3606 * (AltiVec and SSE do).
|
yading@10
|
3607 *
|
yading@10
|
3608 * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
|
yading@10
|
3609 * between input and output, these need to be fed with avpkt->data=NULL,
|
yading@10
|
3610 * avpkt->size=0 at the end to return the remaining frames.
|
yading@10
|
3611 *
|
yading@10
|
3612 * @param avctx the codec context
|
yading@10
|
3613 * @param[out] samples the output buffer, sample type in avctx->sample_fmt
|
yading@10
|
3614 * If the sample format is planar, each channel plane will
|
yading@10
|
3615 * be the same size, with no padding between channels.
|
yading@10
|
3616 * @param[in,out] frame_size_ptr the output buffer size in bytes
|
yading@10
|
3617 * @param[in] avpkt The input AVPacket containing the input buffer.
|
yading@10
|
3618 * You can create such packet with av_init_packet() and by then setting
|
yading@10
|
3619 * data and size, some decoders might in addition need other fields.
|
yading@10
|
3620 * All decoders are designed to use the least fields possible though.
|
yading@10
|
3621 * @return On error a negative value is returned, otherwise the number of bytes
|
yading@10
|
3622 * used or zero if no frame data was decompressed (used) from the input AVPacket.
|
yading@10
|
3623 */
|
yading@10
|
3624 attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
|
yading@10
|
3625 int *frame_size_ptr,
|
yading@10
|
3626 AVPacket *avpkt);
|
yading@10
|
3627 #endif
|
yading@10
|
3628
|
yading@10
|
3629 /**
|
yading@10
|
3630 * Decode the audio frame of size avpkt->size from avpkt->data into frame.
|
yading@10
|
3631 *
|
yading@10
|
3632 * Some decoders may support multiple frames in a single AVPacket. Such
|
yading@10
|
3633 * decoders would then just decode the first frame. In this case,
|
yading@10
|
3634 * avcodec_decode_audio4 has to be called again with an AVPacket containing
|
yading@10
|
3635 * the remaining data in order to decode the second frame, etc...
|
yading@10
|
3636 * Even if no frames are returned, the packet needs to be fed to the decoder
|
yading@10
|
3637 * with remaining data until it is completely consumed or an error occurs.
|
yading@10
|
3638 *
|
yading@10
|
3639 * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE
|
yading@10
|
3640 * larger than the actual read bytes because some optimized bitstream
|
yading@10
|
3641 * readers read 32 or 64 bits at once and could read over the end.
|
yading@10
|
3642 *
|
yading@10
|
3643 * @note You might have to align the input buffer. The alignment requirements
|
yading@10
|
3644 * depend on the CPU and the decoder.
|
yading@10
|
3645 *
|
yading@10
|
3646 * @param avctx the codec context
|
yading@10
|
3647 * @param[out] frame The AVFrame in which to store decoded audio samples.
|
yading@10
|
3648 * The decoder will allocate a buffer for the decoded frame by
|
yading@10
|
3649 * calling the AVCodecContext.get_buffer2() callback.
|
yading@10
|
3650 * When AVCodecContext.refcounted_frames is set to 1, the frame is
|
yading@10
|
3651 * reference counted and the returned reference belongs to the
|
yading@10
|
3652 * caller. The caller must release the frame using av_frame_unref()
|
yading@10
|
3653 * when the frame is no longer needed. The caller may safely write
|
yading@10
|
3654 * to the frame if av_frame_is_writable() returns 1.
|
yading@10
|
3655 * When AVCodecContext.refcounted_frames is set to 0, the returned
|
yading@10
|
3656 * reference belongs to the decoder and is valid only until the
|
yading@10
|
3657 * next call to this function or until closing the decoder.
|
yading@10
|
3658 * The caller may not write to it.
|
yading@10
|
3659 * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
|
yading@10
|
3660 * non-zero.
|
yading@10
|
3661 * @param[in] avpkt The input AVPacket containing the input buffer.
|
yading@10
|
3662 * At least avpkt->data and avpkt->size should be set. Some
|
yading@10
|
3663 * decoders might also require additional fields to be set.
|
yading@10
|
3664 * @return A negative error code is returned if an error occurred during
|
yading@10
|
3665 * decoding, otherwise the number of bytes consumed from the input
|
yading@10
|
3666 * AVPacket is returned.
|
yading@10
|
3667 */
|
yading@10
|
3668 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
|
yading@10
|
3669 int *got_frame_ptr, const AVPacket *avpkt);
|
yading@10
|
3670
|
yading@10
|
3671 /**
|
yading@10
|
3672 * Decode the video frame of size avpkt->size from avpkt->data into picture.
|
yading@10
|
3673 * Some decoders may support multiple frames in a single AVPacket, such
|
yading@10
|
3674 * decoders would then just decode the first frame.
|
yading@10
|
3675 *
|
yading@10
|
3676 * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
|
yading@10
|
3677 * the actual read bytes because some optimized bitstream readers read 32 or 64
|
yading@10
|
3678 * bits at once and could read over the end.
|
yading@10
|
3679 *
|
yading@10
|
3680 * @warning The end of the input buffer buf should be set to 0 to ensure that
|
yading@10
|
3681 * no overreading happens for damaged MPEG streams.
|
yading@10
|
3682 *
|
yading@10
|
3683 * @note You might have to align the input buffer avpkt->data.
|
yading@10
|
3684 * The alignment requirements depend on the CPU: on some CPUs it isn't
|
yading@10
|
3685 * necessary at all, on others it won't work at all if not aligned and on others
|
yading@10
|
3686 * it will work but it will have an impact on performance.
|
yading@10
|
3687 *
|
yading@10
|
3688 * In practice, avpkt->data should have 4 byte alignment at minimum.
|
yading@10
|
3689 *
|
yading@10
|
3690 * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
|
yading@10
|
3691 * between input and output, these need to be fed with avpkt->data=NULL,
|
yading@10
|
3692 * avpkt->size=0 at the end to return the remaining frames.
|
yading@10
|
3693 *
|
yading@10
|
3694 * @param avctx the codec context
|
yading@10
|
3695 * @param[out] picture The AVFrame in which the decoded video frame will be stored.
|
yading@10
|
3696 * Use av_frame_alloc() to get an AVFrame. The codec will
|
yading@10
|
3697 * allocate memory for the actual bitmap by calling the
|
yading@10
|
3698 * AVCodecContext.get_buffer2() callback.
|
yading@10
|
3699 * When AVCodecContext.refcounted_frames is set to 1, the frame is
|
yading@10
|
3700 * reference counted and the returned reference belongs to the
|
yading@10
|
3701 * caller. The caller must release the frame using av_frame_unref()
|
yading@10
|
3702 * when the frame is no longer needed. The caller may safely write
|
yading@10
|
3703 * to the frame if av_frame_is_writable() returns 1.
|
yading@10
|
3704 * When AVCodecContext.refcounted_frames is set to 0, the returned
|
yading@10
|
3705 * reference belongs to the decoder and is valid only until the
|
yading@10
|
3706 * next call to this function or until closing the decoder. The
|
yading@10
|
3707 * caller may not write to it.
|
yading@10
|
3708 *
|
yading@10
|
3709 * @param[in] avpkt The input AVpacket containing the input buffer.
|
yading@10
|
3710 * You can create such packet with av_init_packet() and by then setting
|
yading@10
|
3711 * data and size, some decoders might in addition need other fields like
|
yading@10
|
3712 * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
|
yading@10
|
3713 * fields possible.
|
yading@10
|
3714 * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
|
yading@10
|
3715 * @return On error a negative value is returned, otherwise the number of bytes
|
yading@10
|
3716 * used or zero if no frame could be decompressed.
|
yading@10
|
3717 */
|
yading@10
|
3718 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
yading@10
|
3719 int *got_picture_ptr,
|
yading@10
|
3720 const AVPacket *avpkt);
|
yading@10
|
3721
|
yading@10
|
3722 /**
|
yading@10
|
3723 * Decode a subtitle message.
|
yading@10
|
3724 * Return a negative value on error, otherwise return the number of bytes used.
|
yading@10
|
3725 * If no subtitle could be decompressed, got_sub_ptr is zero.
|
yading@10
|
3726 * Otherwise, the subtitle is stored in *sub.
|
yading@10
|
3727 * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for
|
yading@10
|
3728 * simplicity, because the performance difference is expect to be negligible
|
yading@10
|
3729 * and reusing a get_buffer written for video codecs would probably perform badly
|
yading@10
|
3730 * due to a potentially very different allocation pattern.
|
yading@10
|
3731 *
|
yading@10
|
3732 * @param avctx the codec context
|
yading@10
|
3733 * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be
|
yading@10
|
3734 freed with avsubtitle_free if *got_sub_ptr is set.
|
yading@10
|
3735 * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
|
yading@10
|
3736 * @param[in] avpkt The input AVPacket containing the input buffer.
|
yading@10
|
3737 */
|
yading@10
|
3738 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
yading@10
|
3739 int *got_sub_ptr,
|
yading@10
|
3740 AVPacket *avpkt);
|
yading@10
|
3741
|
yading@10
|
3742 /**
|
yading@10
|
3743 * @defgroup lavc_parsing Frame parsing
|
yading@10
|
3744 * @{
|
yading@10
|
3745 */
|
yading@10
|
3746
|
yading@10
|
3747 typedef struct AVCodecParserContext {
|
yading@10
|
3748 void *priv_data;
|
yading@10
|
3749 struct AVCodecParser *parser;
|
yading@10
|
3750 int64_t frame_offset; /* offset of the current frame */
|
yading@10
|
3751 int64_t cur_offset; /* current offset
|
yading@10
|
3752 (incremented by each av_parser_parse()) */
|
yading@10
|
3753 int64_t next_frame_offset; /* offset of the next frame */
|
yading@10
|
3754 /* video info */
|
yading@10
|
3755 int pict_type; /* XXX: Put it back in AVCodecContext. */
|
yading@10
|
3756 /**
|
yading@10
|
3757 * This field is used for proper frame duration computation in lavf.
|
yading@10
|
3758 * It signals, how much longer the frame duration of the current frame
|
yading@10
|
3759 * is compared to normal frame duration.
|
yading@10
|
3760 *
|
yading@10
|
3761 * frame_duration = (1 + repeat_pict) * time_base
|
yading@10
|
3762 *
|
yading@10
|
3763 * It is used by codecs like H.264 to display telecined material.
|
yading@10
|
3764 */
|
yading@10
|
3765 int repeat_pict; /* XXX: Put it back in AVCodecContext. */
|
yading@10
|
3766 int64_t pts; /* pts of the current frame */
|
yading@10
|
3767 int64_t dts; /* dts of the current frame */
|
yading@10
|
3768
|
yading@10
|
3769 /* private data */
|
yading@10
|
3770 int64_t last_pts;
|
yading@10
|
3771 int64_t last_dts;
|
yading@10
|
3772 int fetch_timestamp;
|
yading@10
|
3773
|
yading@10
|
3774 #define AV_PARSER_PTS_NB 4
|
yading@10
|
3775 int cur_frame_start_index;
|
yading@10
|
3776 int64_t cur_frame_offset[AV_PARSER_PTS_NB];
|
yading@10
|
3777 int64_t cur_frame_pts[AV_PARSER_PTS_NB];
|
yading@10
|
3778 int64_t cur_frame_dts[AV_PARSER_PTS_NB];
|
yading@10
|
3779
|
yading@10
|
3780 int flags;
|
yading@10
|
3781 #define PARSER_FLAG_COMPLETE_FRAMES 0x0001
|
yading@10
|
3782 #define PARSER_FLAG_ONCE 0x0002
|
yading@10
|
3783 /// Set if the parser has a valid file offset
|
yading@10
|
3784 #define PARSER_FLAG_FETCHED_OFFSET 0x0004
|
yading@10
|
3785 #define PARSER_FLAG_USE_CODEC_TS 0x1000
|
yading@10
|
3786
|
yading@10
|
3787 int64_t offset; ///< byte offset from starting packet start
|
yading@10
|
3788 int64_t cur_frame_end[AV_PARSER_PTS_NB];
|
yading@10
|
3789
|
yading@10
|
3790 /**
|
yading@10
|
3791 * Set by parser to 1 for key frames and 0 for non-key frames.
|
yading@10
|
3792 * It is initialized to -1, so if the parser doesn't set this flag,
|
yading@10
|
3793 * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
|
yading@10
|
3794 * will be used.
|
yading@10
|
3795 */
|
yading@10
|
3796 int key_frame;
|
yading@10
|
3797
|
yading@10
|
3798 /**
|
yading@10
|
3799 * Time difference in stream time base units from the pts of this
|
yading@10
|
3800 * packet to the point at which the output from the decoder has converged
|
yading@10
|
3801 * independent from the availability of previous frames. That is, the
|
yading@10
|
3802 * frames are virtually identical no matter if decoding started from
|
yading@10
|
3803 * the very first frame or from this keyframe.
|
yading@10
|
3804 * Is AV_NOPTS_VALUE if unknown.
|
yading@10
|
3805 * This field is not the display duration of the current frame.
|
yading@10
|
3806 * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
|
yading@10
|
3807 * set.
|
yading@10
|
3808 *
|
yading@10
|
3809 * The purpose of this field is to allow seeking in streams that have no
|
yading@10
|
3810 * keyframes in the conventional sense. It corresponds to the
|
yading@10
|
3811 * recovery point SEI in H.264 and match_time_delta in NUT. It is also
|
yading@10
|
3812 * essential for some types of subtitle streams to ensure that all
|
yading@10
|
3813 * subtitles are correctly displayed after seeking.
|
yading@10
|
3814 */
|
yading@10
|
3815 int64_t convergence_duration;
|
yading@10
|
3816
|
yading@10
|
3817 // Timestamp generation support:
|
yading@10
|
3818 /**
|
yading@10
|
3819 * Synchronization point for start of timestamp generation.
|
yading@10
|
3820 *
|
yading@10
|
3821 * Set to >0 for sync point, 0 for no sync point and <0 for undefined
|
yading@10
|
3822 * (default).
|
yading@10
|
3823 *
|
yading@10
|
3824 * For example, this corresponds to presence of H.264 buffering period
|
yading@10
|
3825 * SEI message.
|
yading@10
|
3826 */
|
yading@10
|
3827 int dts_sync_point;
|
yading@10
|
3828
|
yading@10
|
3829 /**
|
yading@10
|
3830 * Offset of the current timestamp against last timestamp sync point in
|
yading@10
|
3831 * units of AVCodecContext.time_base.
|
yading@10
|
3832 *
|
yading@10
|
3833 * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
|
yading@10
|
3834 * contain a valid timestamp offset.
|
yading@10
|
3835 *
|
yading@10
|
3836 * Note that the timestamp of sync point has usually a nonzero
|
yading@10
|
3837 * dts_ref_dts_delta, which refers to the previous sync point. Offset of
|
yading@10
|
3838 * the next frame after timestamp sync point will be usually 1.
|
yading@10
|
3839 *
|
yading@10
|
3840 * For example, this corresponds to H.264 cpb_removal_delay.
|
yading@10
|
3841 */
|
yading@10
|
3842 int dts_ref_dts_delta;
|
yading@10
|
3843
|
yading@10
|
3844 /**
|
yading@10
|
3845 * Presentation delay of current frame in units of AVCodecContext.time_base.
|
yading@10
|
3846 *
|
yading@10
|
3847 * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
|
yading@10
|
3848 * contain valid non-negative timestamp delta (presentation time of a frame
|
yading@10
|
3849 * must not lie in the past).
|
yading@10
|
3850 *
|
yading@10
|
3851 * This delay represents the difference between decoding and presentation
|
yading@10
|
3852 * time of the frame.
|
yading@10
|
3853 *
|
yading@10
|
3854 * For example, this corresponds to H.264 dpb_output_delay.
|
yading@10
|
3855 */
|
yading@10
|
3856 int pts_dts_delta;
|
yading@10
|
3857
|
yading@10
|
3858 /**
|
yading@10
|
3859 * Position of the packet in file.
|
yading@10
|
3860 *
|
yading@10
|
3861 * Analogous to cur_frame_pts/dts
|
yading@10
|
3862 */
|
yading@10
|
3863 int64_t cur_frame_pos[AV_PARSER_PTS_NB];
|
yading@10
|
3864
|
yading@10
|
3865 /**
|
yading@10
|
3866 * Byte position of currently parsed frame in stream.
|
yading@10
|
3867 */
|
yading@10
|
3868 int64_t pos;
|
yading@10
|
3869
|
yading@10
|
3870 /**
|
yading@10
|
3871 * Previous frame byte position.
|
yading@10
|
3872 */
|
yading@10
|
3873 int64_t last_pos;
|
yading@10
|
3874
|
yading@10
|
3875 /**
|
yading@10
|
3876 * Duration of the current frame.
|
yading@10
|
3877 * For audio, this is in units of 1 / AVCodecContext.sample_rate.
|
yading@10
|
3878 * For all other types, this is in units of AVCodecContext.time_base.
|
yading@10
|
3879 */
|
yading@10
|
3880 int duration;
|
yading@10
|
3881 } AVCodecParserContext;
|
yading@10
|
3882
|
yading@10
|
3883 typedef struct AVCodecParser {
|
yading@10
|
3884 int codec_ids[5]; /* several codec IDs are permitted */
|
yading@10
|
3885 int priv_data_size;
|
yading@10
|
3886 int (*parser_init)(AVCodecParserContext *s);
|
yading@10
|
3887 int (*parser_parse)(AVCodecParserContext *s,
|
yading@10
|
3888 AVCodecContext *avctx,
|
yading@10
|
3889 const uint8_t **poutbuf, int *poutbuf_size,
|
yading@10
|
3890 const uint8_t *buf, int buf_size);
|
yading@10
|
3891 void (*parser_close)(AVCodecParserContext *s);
|
yading@10
|
3892 int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
|
yading@10
|
3893 struct AVCodecParser *next;
|
yading@10
|
3894 } AVCodecParser;
|
yading@10
|
3895
|
yading@10
|
3896 AVCodecParser *av_parser_next(AVCodecParser *c);
|
yading@10
|
3897
|
yading@10
|
3898 void av_register_codec_parser(AVCodecParser *parser);
|
yading@10
|
3899 AVCodecParserContext *av_parser_init(int codec_id);
|
yading@10
|
3900
|
yading@10
|
3901 /**
|
yading@10
|
3902 * Parse a packet.
|
yading@10
|
3903 *
|
yading@10
|
3904 * @param s parser context.
|
yading@10
|
3905 * @param avctx codec context.
|
yading@10
|
3906 * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
|
yading@10
|
3907 * @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
|
yading@10
|
3908 * @param buf input buffer.
|
yading@10
|
3909 * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output).
|
yading@10
|
3910 * @param pts input presentation timestamp.
|
yading@10
|
3911 * @param dts input decoding timestamp.
|
yading@10
|
3912 * @param pos input byte position in stream.
|
yading@10
|
3913 * @return the number of bytes of the input bitstream used.
|
yading@10
|
3914 *
|
yading@10
|
3915 * Example:
|
yading@10
|
3916 * @code
|
yading@10
|
3917 * while(in_len){
|
yading@10
|
3918 * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
|
yading@10
|
3919 * in_data, in_len,
|
yading@10
|
3920 * pts, dts, pos);
|
yading@10
|
3921 * in_data += len;
|
yading@10
|
3922 * in_len -= len;
|
yading@10
|
3923 *
|
yading@10
|
3924 * if(size)
|
yading@10
|
3925 * decode_frame(data, size);
|
yading@10
|
3926 * }
|
yading@10
|
3927 * @endcode
|
yading@10
|
3928 */
|
yading@10
|
3929 int av_parser_parse2(AVCodecParserContext *s,
|
yading@10
|
3930 AVCodecContext *avctx,
|
yading@10
|
3931 uint8_t **poutbuf, int *poutbuf_size,
|
yading@10
|
3932 const uint8_t *buf, int buf_size,
|
yading@10
|
3933 int64_t pts, int64_t dts,
|
yading@10
|
3934 int64_t pos);
|
yading@10
|
3935
|
yading@10
|
3936 /**
|
yading@10
|
3937 * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
|
yading@10
|
3938 * @deprecated use AVBitStreamFilter
|
yading@10
|
3939 */
|
yading@10
|
3940 int av_parser_change(AVCodecParserContext *s,
|
yading@10
|
3941 AVCodecContext *avctx,
|
yading@10
|
3942 uint8_t **poutbuf, int *poutbuf_size,
|
yading@10
|
3943 const uint8_t *buf, int buf_size, int keyframe);
|
yading@10
|
3944 void av_parser_close(AVCodecParserContext *s);
|
yading@10
|
3945
|
yading@10
|
3946 /**
|
yading@10
|
3947 * @}
|
yading@10
|
3948 * @}
|
yading@10
|
3949 */
|
yading@10
|
3950
|
yading@10
|
3951 /**
|
yading@10
|
3952 * @addtogroup lavc_encoding
|
yading@10
|
3953 * @{
|
yading@10
|
3954 */
|
yading@10
|
3955
|
yading@10
|
3956 /**
|
yading@10
|
3957 * Find a registered encoder with a matching codec ID.
|
yading@10
|
3958 *
|
yading@10
|
3959 * @param id AVCodecID of the requested encoder
|
yading@10
|
3960 * @return An encoder if one was found, NULL otherwise.
|
yading@10
|
3961 */
|
yading@10
|
3962 AVCodec *avcodec_find_encoder(enum AVCodecID id);
|
yading@10
|
3963
|
yading@10
|
3964 /**
|
yading@10
|
3965 * Find a registered encoder with the specified name.
|
yading@10
|
3966 *
|
yading@10
|
3967 * @param name name of the requested encoder
|
yading@10
|
3968 * @return An encoder if one was found, NULL otherwise.
|
yading@10
|
3969 */
|
yading@10
|
3970 AVCodec *avcodec_find_encoder_by_name(const char *name);
|
yading@10
|
3971
|
yading@10
|
3972 #if FF_API_OLD_ENCODE_AUDIO
|
yading@10
|
3973 /**
|
yading@10
|
3974 * Encode an audio frame from samples into buf.
|
yading@10
|
3975 *
|
yading@10
|
3976 * @deprecated Use avcodec_encode_audio2 instead.
|
yading@10
|
3977 *
|
yading@10
|
3978 * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
|
yading@10
|
3979 * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user
|
yading@10
|
3980 * will know how much space is needed because it depends on the value passed
|
yading@10
|
3981 * in buf_size as described below. In that case a lower value can be used.
|
yading@10
|
3982 *
|
yading@10
|
3983 * @param avctx the codec context
|
yading@10
|
3984 * @param[out] buf the output buffer
|
yading@10
|
3985 * @param[in] buf_size the output buffer size
|
yading@10
|
3986 * @param[in] samples the input buffer containing the samples
|
yading@10
|
3987 * The number of samples read from this buffer is frame_size*channels,
|
yading@10
|
3988 * both of which are defined in avctx.
|
yading@10
|
3989 * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of
|
yading@10
|
3990 * samples read from samples is equal to:
|
yading@10
|
3991 * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id))
|
yading@10
|
3992 * This also implies that av_get_bits_per_sample() must not return 0 for these
|
yading@10
|
3993 * codecs.
|
yading@10
|
3994 * @return On error a negative value is returned, on success zero or the number
|
yading@10
|
3995 * of bytes used to encode the data read from the input buffer.
|
yading@10
|
3996 */
|
yading@10
|
3997 int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
|
yading@10
|
3998 uint8_t *buf, int buf_size,
|
yading@10
|
3999 const short *samples);
|
yading@10
|
4000 #endif
|
yading@10
|
4001
|
yading@10
|
4002 /**
|
yading@10
|
4003 * Encode a frame of audio.
|
yading@10
|
4004 *
|
yading@10
|
4005 * Takes input samples from frame and writes the next output packet, if
|
yading@10
|
4006 * available, to avpkt. The output packet does not necessarily contain data for
|
yading@10
|
4007 * the most recent frame, as encoders can delay, split, and combine input frames
|
yading@10
|
4008 * internally as needed.
|
yading@10
|
4009 *
|
yading@10
|
4010 * @param avctx codec context
|
yading@10
|
4011 * @param avpkt output AVPacket.
|
yading@10
|
4012 * The user can supply an output buffer by setting
|
yading@10
|
4013 * avpkt->data and avpkt->size prior to calling the
|
yading@10
|
4014 * function, but if the size of the user-provided data is not
|
yading@10
|
4015 * large enough, encoding will fail. If avpkt->data and
|
yading@10
|
4016 * avpkt->size are set, avpkt->destruct must also be set. All
|
yading@10
|
4017 * other AVPacket fields will be reset by the encoder using
|
yading@10
|
4018 * av_init_packet(). If avpkt->data is NULL, the encoder will
|
yading@10
|
4019 * allocate it. The encoder will set avpkt->size to the size
|
yading@10
|
4020 * of the output packet.
|
yading@10
|
4021 *
|
yading@10
|
4022 * If this function fails or produces no output, avpkt will be
|
yading@10
|
4023 * freed using av_free_packet() (i.e. avpkt->destruct will be
|
yading@10
|
4024 * called to free the user supplied buffer).
|
yading@10
|
4025 * @param[in] frame AVFrame containing the raw audio data to be encoded.
|
yading@10
|
4026 * May be NULL when flushing an encoder that has the
|
yading@10
|
4027 * CODEC_CAP_DELAY capability set.
|
yading@10
|
4028 * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
|
yading@10
|
4029 * can have any number of samples.
|
yading@10
|
4030 * If it is not set, frame->nb_samples must be equal to
|
yading@10
|
4031 * avctx->frame_size for all frames except the last.
|
yading@10
|
4032 * The final frame may be smaller than avctx->frame_size.
|
yading@10
|
4033 * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
|
yading@10
|
4034 * output packet is non-empty, and to 0 if it is
|
yading@10
|
4035 * empty. If the function returns an error, the
|
yading@10
|
4036 * packet can be assumed to be invalid, and the
|
yading@10
|
4037 * value of got_packet_ptr is undefined and should
|
yading@10
|
4038 * not be used.
|
yading@10
|
4039 * @return 0 on success, negative error code on failure
|
yading@10
|
4040 */
|
yading@10
|
4041 int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
|
yading@10
|
4042 const AVFrame *frame, int *got_packet_ptr);
|
yading@10
|
4043
|
yading@10
|
4044 #if FF_API_OLD_ENCODE_VIDEO
|
yading@10
|
4045 /**
|
yading@10
|
4046 * @deprecated use avcodec_encode_video2() instead.
|
yading@10
|
4047 *
|
yading@10
|
4048 * Encode a video frame from pict into buf.
|
yading@10
|
4049 * The input picture should be
|
yading@10
|
4050 * stored using a specific format, namely avctx.pix_fmt.
|
yading@10
|
4051 *
|
yading@10
|
4052 * @param avctx the codec context
|
yading@10
|
4053 * @param[out] buf the output buffer for the bitstream of encoded frame
|
yading@10
|
4054 * @param[in] buf_size the size of the output buffer in bytes
|
yading@10
|
4055 * @param[in] pict the input picture to encode
|
yading@10
|
4056 * @return On error a negative value is returned, on success zero or the number
|
yading@10
|
4057 * of bytes used from the output buffer.
|
yading@10
|
4058 */
|
yading@10
|
4059 attribute_deprecated
|
yading@10
|
4060 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
|
yading@10
|
4061 const AVFrame *pict);
|
yading@10
|
4062 #endif
|
yading@10
|
4063
|
yading@10
|
4064 /**
|
yading@10
|
4065 * Encode a frame of video.
|
yading@10
|
4066 *
|
yading@10
|
4067 * Takes input raw video data from frame and writes the next output packet, if
|
yading@10
|
4068 * available, to avpkt. The output packet does not necessarily contain data for
|
yading@10
|
4069 * the most recent frame, as encoders can delay and reorder input frames
|
yading@10
|
4070 * internally as needed.
|
yading@10
|
4071 *
|
yading@10
|
4072 * @param avctx codec context
|
yading@10
|
4073 * @param avpkt output AVPacket.
|
yading@10
|
4074 * The user can supply an output buffer by setting
|
yading@10
|
4075 * avpkt->data and avpkt->size prior to calling the
|
yading@10
|
4076 * function, but if the size of the user-provided data is not
|
yading@10
|
4077 * large enough, encoding will fail. All other AVPacket fields
|
yading@10
|
4078 * will be reset by the encoder using av_init_packet(). If
|
yading@10
|
4079 * avpkt->data is NULL, the encoder will allocate it.
|
yading@10
|
4080 * The encoder will set avpkt->size to the size of the
|
yading@10
|
4081 * output packet. The returned data (if any) belongs to the
|
yading@10
|
4082 * caller, he is responsible for freeing it.
|
yading@10
|
4083 *
|
yading@10
|
4084 * If this function fails or produces no output, avpkt will be
|
yading@10
|
4085 * freed using av_free_packet() (i.e. avpkt->destruct will be
|
yading@10
|
4086 * called to free the user supplied buffer).
|
yading@10
|
4087 * @param[in] frame AVFrame containing the raw video data to be encoded.
|
yading@10
|
4088 * May be NULL when flushing an encoder that has the
|
yading@10
|
4089 * CODEC_CAP_DELAY capability set.
|
yading@10
|
4090 * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
|
yading@10
|
4091 * output packet is non-empty, and to 0 if it is
|
yading@10
|
4092 * empty. If the function returns an error, the
|
yading@10
|
4093 * packet can be assumed to be invalid, and the
|
yading@10
|
4094 * value of got_packet_ptr is undefined and should
|
yading@10
|
4095 * not be used.
|
yading@10
|
4096 * @return 0 on success, negative error code on failure
|
yading@10
|
4097 */
|
yading@10
|
4098 int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
|
yading@10
|
4099 const AVFrame *frame, int *got_packet_ptr);
|
yading@10
|
4100
|
yading@10
|
4101 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
|
yading@10
|
4102 const AVSubtitle *sub);
|
yading@10
|
4103
|
yading@10
|
4104
|
yading@10
|
4105 /**
|
yading@10
|
4106 * @}
|
yading@10
|
4107 */
|
yading@10
|
4108
|
yading@10
|
4109 #if FF_API_AVCODEC_RESAMPLE
|
yading@10
|
4110 /**
|
yading@10
|
4111 * @defgroup lavc_resample Audio resampling
|
yading@10
|
4112 * @ingroup libavc
|
yading@10
|
4113 * @deprecated use libswresample instead
|
yading@10
|
4114 *
|
yading@10
|
4115 * @{
|
yading@10
|
4116 */
|
yading@10
|
4117 struct ReSampleContext;
|
yading@10
|
4118 struct AVResampleContext;
|
yading@10
|
4119
|
yading@10
|
4120 typedef struct ReSampleContext ReSampleContext;
|
yading@10
|
4121
|
yading@10
|
4122 /**
|
yading@10
|
4123 * Initialize audio resampling context.
|
yading@10
|
4124 *
|
yading@10
|
4125 * @param output_channels number of output channels
|
yading@10
|
4126 * @param input_channels number of input channels
|
yading@10
|
4127 * @param output_rate output sample rate
|
yading@10
|
4128 * @param input_rate input sample rate
|
yading@10
|
4129 * @param sample_fmt_out requested output sample format
|
yading@10
|
4130 * @param sample_fmt_in input sample format
|
yading@10
|
4131 * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
|
yading@10
|
4132 * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
|
yading@10
|
4133 * @param linear if 1 then the used FIR filter will be linearly interpolated
|
yading@10
|
4134 between the 2 closest, if 0 the closest will be used
|
yading@10
|
4135 * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
|
yading@10
|
4136 * @return allocated ReSampleContext, NULL if error occurred
|
yading@10
|
4137 */
|
yading@10
|
4138 attribute_deprecated
|
yading@10
|
4139 ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
yading@10
|
4140 int output_rate, int input_rate,
|
yading@10
|
4141 enum AVSampleFormat sample_fmt_out,
|
yading@10
|
4142 enum AVSampleFormat sample_fmt_in,
|
yading@10
|
4143 int filter_length, int log2_phase_count,
|
yading@10
|
4144 int linear, double cutoff);
|
yading@10
|
4145
|
yading@10
|
4146 attribute_deprecated
|
yading@10
|
4147 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
|
yading@10
|
4148
|
yading@10
|
4149 /**
|
yading@10
|
4150 * Free resample context.
|
yading@10
|
4151 *
|
yading@10
|
4152 * @param s a non-NULL pointer to a resample context previously
|
yading@10
|
4153 * created with av_audio_resample_init()
|
yading@10
|
4154 */
|
yading@10
|
4155 attribute_deprecated
|
yading@10
|
4156 void audio_resample_close(ReSampleContext *s);
|
yading@10
|
4157
|
yading@10
|
4158
|
yading@10
|
4159 /**
|
yading@10
|
4160 * Initialize an audio resampler.
|
yading@10
|
4161 * Note, if either rate is not an integer then simply scale both rates up so they are.
|
yading@10
|
4162 * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
|
yading@10
|
4163 * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
|
yading@10
|
4164 * @param linear If 1 then the used FIR filter will be linearly interpolated
|
yading@10
|
4165 between the 2 closest, if 0 the closest will be used
|
yading@10
|
4166 * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
|
yading@10
|
4167 */
|
yading@10
|
4168 attribute_deprecated
|
yading@10
|
4169 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
|
yading@10
|
4170
|
yading@10
|
4171 /**
|
yading@10
|
4172 * Resample an array of samples using a previously configured context.
|
yading@10
|
4173 * @param src an array of unconsumed samples
|
yading@10
|
4174 * @param consumed the number of samples of src which have been consumed are returned here
|
yading@10
|
4175 * @param src_size the number of unconsumed samples available
|
yading@10
|
4176 * @param dst_size the amount of space in samples available in dst
|
yading@10
|
4177 * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
|
yading@10
|
4178 * @return the number of samples written in dst or -1 if an error occurred
|
yading@10
|
4179 */
|
yading@10
|
4180 attribute_deprecated
|
yading@10
|
4181 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
|
yading@10
|
4182
|
yading@10
|
4183
|
yading@10
|
4184 /**
|
yading@10
|
4185 * Compensate samplerate/timestamp drift. The compensation is done by changing
|
yading@10
|
4186 * the resampler parameters, so no audible clicks or similar distortions occur
|
yading@10
|
4187 * @param compensation_distance distance in output samples over which the compensation should be performed
|
yading@10
|
4188 * @param sample_delta number of output samples which should be output less
|
yading@10
|
4189 *
|
yading@10
|
4190 * example: av_resample_compensate(c, 10, 500)
|
yading@10
|
4191 * here instead of 510 samples only 500 samples would be output
|
yading@10
|
4192 *
|
yading@10
|
4193 * note, due to rounding the actual compensation might be slightly different,
|
yading@10
|
4194 * especially if the compensation_distance is large and the in_rate used during init is small
|
yading@10
|
4195 */
|
yading@10
|
4196 attribute_deprecated
|
yading@10
|
4197 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
|
yading@10
|
4198 attribute_deprecated
|
yading@10
|
4199 void av_resample_close(struct AVResampleContext *c);
|
yading@10
|
4200
|
yading@10
|
4201 /**
|
yading@10
|
4202 * @}
|
yading@10
|
4203 */
|
yading@10
|
4204 #endif
|
yading@10
|
4205
|
yading@10
|
4206 /**
|
yading@10
|
4207 * @addtogroup lavc_picture
|
yading@10
|
4208 * @{
|
yading@10
|
4209 */
|
yading@10
|
4210
|
yading@10
|
4211 /**
|
yading@10
|
4212 * Allocate memory for a picture. Call avpicture_free() to free it.
|
yading@10
|
4213 *
|
yading@10
|
4214 * @see avpicture_fill()
|
yading@10
|
4215 *
|
yading@10
|
4216 * @param picture the picture to be filled in
|
yading@10
|
4217 * @param pix_fmt the format of the picture
|
yading@10
|
4218 * @param width the width of the picture
|
yading@10
|
4219 * @param height the height of the picture
|
yading@10
|
4220 * @return zero if successful, a negative value if not
|
yading@10
|
4221 */
|
yading@10
|
4222 int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
|
yading@10
|
4223
|
yading@10
|
4224 /**
|
yading@10
|
4225 * Free a picture previously allocated by avpicture_alloc().
|
yading@10
|
4226 * The data buffer used by the AVPicture is freed, but the AVPicture structure
|
yading@10
|
4227 * itself is not.
|
yading@10
|
4228 *
|
yading@10
|
4229 * @param picture the AVPicture to be freed
|
yading@10
|
4230 */
|
yading@10
|
4231 void avpicture_free(AVPicture *picture);
|
yading@10
|
4232
|
yading@10
|
4233 /**
|
yading@10
|
4234 * Fill in the AVPicture fields, always assume a linesize alignment of
|
yading@10
|
4235 * 1.
|
yading@10
|
4236 *
|
yading@10
|
4237 * @see av_image_fill_arrays()
|
yading@10
|
4238 */
|
yading@10
|
4239 int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
|
yading@10
|
4240 enum AVPixelFormat pix_fmt, int width, int height);
|
yading@10
|
4241
|
yading@10
|
4242 /**
|
yading@10
|
4243 * Copy pixel data from an AVPicture into a buffer, always assume a
|
yading@10
|
4244 * linesize alignment of 1.
|
yading@10
|
4245 *
|
yading@10
|
4246 * @see av_image_copy_to_buffer()
|
yading@10
|
4247 */
|
yading@10
|
4248 int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt,
|
yading@10
|
4249 int width, int height,
|
yading@10
|
4250 unsigned char *dest, int dest_size);
|
yading@10
|
4251
|
yading@10
|
4252 /**
|
yading@10
|
4253 * Calculate the size in bytes that a picture of the given width and height
|
yading@10
|
4254 * would occupy if stored in the given picture format.
|
yading@10
|
4255 * Always assume a linesize alignment of 1.
|
yading@10
|
4256 *
|
yading@10
|
4257 * @see av_image_get_buffer_size().
|
yading@10
|
4258 */
|
yading@10
|
4259 int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
|
yading@10
|
4260
|
yading@10
|
4261 #if FF_API_DEINTERLACE
|
yading@10
|
4262 /**
|
yading@10
|
4263 * deinterlace - if not supported return -1
|
yading@10
|
4264 *
|
yading@10
|
4265 * @deprecated - use yadif (in libavfilter) instead
|
yading@10
|
4266 */
|
yading@10
|
4267 attribute_deprecated
|
yading@10
|
4268 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
|
yading@10
|
4269 enum AVPixelFormat pix_fmt, int width, int height);
|
yading@10
|
4270 #endif
|
yading@10
|
4271 /**
|
yading@10
|
4272 * Copy image src to dst. Wraps av_image_copy().
|
yading@10
|
4273 */
|
yading@10
|
4274 void av_picture_copy(AVPicture *dst, const AVPicture *src,
|
yading@10
|
4275 enum AVPixelFormat pix_fmt, int width, int height);
|
yading@10
|
4276
|
yading@10
|
4277 /**
|
yading@10
|
4278 * Crop image top and left side.
|
yading@10
|
4279 */
|
yading@10
|
4280 int av_picture_crop(AVPicture *dst, const AVPicture *src,
|
yading@10
|
4281 enum AVPixelFormat pix_fmt, int top_band, int left_band);
|
yading@10
|
4282
|
yading@10
|
4283 /**
|
yading@10
|
4284 * Pad image.
|
yading@10
|
4285 */
|
yading@10
|
4286 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
|
yading@10
|
4287 int padtop, int padbottom, int padleft, int padright, int *color);
|
yading@10
|
4288
|
yading@10
|
4289 /**
|
yading@10
|
4290 * @}
|
yading@10
|
4291 */
|
yading@10
|
4292
|
yading@10
|
4293 /**
|
yading@10
|
4294 * @defgroup lavc_misc Utility functions
|
yading@10
|
4295 * @ingroup libavc
|
yading@10
|
4296 *
|
yading@10
|
4297 * Miscellaneous utility functions related to both encoding and decoding
|
yading@10
|
4298 * (or neither).
|
yading@10
|
4299 * @{
|
yading@10
|
4300 */
|
yading@10
|
4301
|
yading@10
|
4302 /**
|
yading@10
|
4303 * @defgroup lavc_misc_pixfmt Pixel formats
|
yading@10
|
4304 *
|
yading@10
|
4305 * Functions for working with pixel formats.
|
yading@10
|
4306 * @{
|
yading@10
|
4307 */
|
yading@10
|
4308
|
yading@10
|
4309 /**
|
yading@10
|
4310 * Utility function to access log2_chroma_w log2_chroma_h from
|
yading@10
|
4311 * the pixel format AVPixFmtDescriptor.
|
yading@10
|
4312 *
|
yading@10
|
4313 * This function asserts that pix_fmt is valid. See av_pix_fmt_get_chroma_sub_sample
|
yading@10
|
4314 * for one that returns a failure code and continues in case of invalid
|
yading@10
|
4315 * pix_fmts.
|
yading@10
|
4316 *
|
yading@10
|
4317 * @param[in] pix_fmt the pixel format
|
yading@10
|
4318 * @param[out] h_shift store log2_chroma_w
|
yading@10
|
4319 * @param[out] v_shift store log2_chroma_h
|
yading@10
|
4320 *
|
yading@10
|
4321 * @see av_pix_fmt_get_chroma_sub_sample
|
yading@10
|
4322 */
|
yading@10
|
4323
|
yading@10
|
4324 void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
|
yading@10
|
4325
|
yading@10
|
4326 /**
|
yading@10
|
4327 * Return a value representing the fourCC code associated to the
|
yading@10
|
4328 * pixel format pix_fmt, or 0 if no associated fourCC code can be
|
yading@10
|
4329 * found.
|
yading@10
|
4330 */
|
yading@10
|
4331 unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
|
yading@10
|
4332
|
yading@10
|
4333 #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
|
yading@10
|
4334 #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
|
yading@10
|
4335 #define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
|
yading@10
|
4336 #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
|
yading@10
|
4337 #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
|
yading@10
|
4338 #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
|
yading@10
|
4339
|
yading@10
|
4340 /**
|
yading@10
|
4341 * Compute what kind of losses will occur when converting from one specific
|
yading@10
|
4342 * pixel format to another.
|
yading@10
|
4343 * When converting from one pixel format to another, information loss may occur.
|
yading@10
|
4344 * For example, when converting from RGB24 to GRAY, the color information will
|
yading@10
|
4345 * be lost. Similarly, other losses occur when converting from some formats to
|
yading@10
|
4346 * other formats. These losses can involve loss of chroma, but also loss of
|
yading@10
|
4347 * resolution, loss of color depth, loss due to the color space conversion, loss
|
yading@10
|
4348 * of the alpha bits or loss due to color quantization.
|
yading@10
|
4349 * avcodec_get_fix_fmt_loss() informs you about the various types of losses
|
yading@10
|
4350 * which will occur when converting from one pixel format to another.
|
yading@10
|
4351 *
|
yading@10
|
4352 * @param[in] dst_pix_fmt destination pixel format
|
yading@10
|
4353 * @param[in] src_pix_fmt source pixel format
|
yading@10
|
4354 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
|
yading@10
|
4355 * @return Combination of flags informing you what kind of losses will occur
|
yading@10
|
4356 * (maximum loss for an invalid dst_pix_fmt).
|
yading@10
|
4357 */
|
yading@10
|
4358 int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
|
yading@10
|
4359 int has_alpha);
|
yading@10
|
4360
|
yading@10
|
4361 /**
|
yading@10
|
4362 * Find the best pixel format to convert to given a certain source pixel
|
yading@10
|
4363 * format. When converting from one pixel format to another, information loss
|
yading@10
|
4364 * may occur. For example, when converting from RGB24 to GRAY, the color
|
yading@10
|
4365 * information will be lost. Similarly, other losses occur when converting from
|
yading@10
|
4366 * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
|
yading@10
|
4367 * the given pixel formats should be used to suffer the least amount of loss.
|
yading@10
|
4368 * The pixel formats from which it chooses one, are determined by the
|
yading@10
|
4369 * pix_fmt_list parameter.
|
yading@10
|
4370 *
|
yading@10
|
4371 *
|
yading@10
|
4372 * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
|
yading@10
|
4373 * @param[in] src_pix_fmt source pixel format
|
yading@10
|
4374 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
|
yading@10
|
4375 * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
|
yading@10
|
4376 * @return The best pixel format to convert to or -1 if none was found.
|
yading@10
|
4377 */
|
yading@10
|
4378 enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(enum AVPixelFormat *pix_fmt_list,
|
yading@10
|
4379 enum AVPixelFormat src_pix_fmt,
|
yading@10
|
4380 int has_alpha, int *loss_ptr);
|
yading@10
|
4381
|
yading@10
|
4382 /**
|
yading@10
|
4383 * Find the best pixel format to convert to given a certain source pixel
|
yading@10
|
4384 * format and a selection of two destination pixel formats. When converting from
|
yading@10
|
4385 * one pixel format to another, information loss may occur. For example, when converting
|
yading@10
|
4386 * from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when
|
yading@10
|
4387 * converting from some formats to other formats. avcodec_find_best_pix_fmt_of_2() selects which of
|
yading@10
|
4388 * the given pixel formats should be used to suffer the least amount of loss.
|
yading@10
|
4389 *
|
yading@10
|
4390 * If one of the destination formats is AV_PIX_FMT_NONE the other pixel format (if valid) will be
|
yading@10
|
4391 * returned.
|
yading@10
|
4392 *
|
yading@10
|
4393 * @code
|
yading@10
|
4394 * src_pix_fmt = AV_PIX_FMT_YUV420P;
|
yading@10
|
4395 * dst_pix_fmt1= AV_PIX_FMT_RGB24;
|
yading@10
|
4396 * dst_pix_fmt2= AV_PIX_FMT_GRAY8;
|
yading@10
|
4397 * dst_pix_fmt3= AV_PIX_FMT_RGB8;
|
yading@10
|
4398 * loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored.
|
yading@10
|
4399 * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss);
|
yading@10
|
4400 * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss);
|
yading@10
|
4401 * @endcode
|
yading@10
|
4402 *
|
yading@10
|
4403 * @param[in] dst_pix_fmt1 One of the two destination pixel formats to choose from
|
yading@10
|
4404 * @param[in] dst_pix_fmt2 The other of the two destination pixel formats to choose from
|
yading@10
|
4405 * @param[in] src_pix_fmt Source pixel format
|
yading@10
|
4406 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
|
yading@10
|
4407 * @param[in, out] loss_ptr Combination of loss flags. In: selects which of the losses to ignore, i.e.
|
yading@10
|
4408 * NULL or value of zero means we care about all losses. Out: the loss
|
yading@10
|
4409 * that occurs when converting from src to selected dst pixel format.
|
yading@10
|
4410 * @return The best pixel format to convert to or -1 if none was found.
|
yading@10
|
4411 */
|
yading@10
|
4412 enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
|
yading@10
|
4413 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
|
yading@10
|
4414
|
yading@10
|
4415 attribute_deprecated
|
yading@10
|
4416 #if AV_HAVE_INCOMPATIBLE_FORK_ABI
|
yading@10
|
4417 enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list,
|
yading@10
|
4418 enum AVPixelFormat src_pix_fmt,
|
yading@10
|
4419 int has_alpha, int *loss_ptr);
|
yading@10
|
4420 #else
|
yading@10
|
4421 enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
|
yading@10
|
4422 enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
|
yading@10
|
4423 #endif
|
yading@10
|
4424
|
yading@10
|
4425
|
yading@10
|
4426 enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
|
yading@10
|
4427
|
yading@10
|
4428 /**
|
yading@10
|
4429 * @}
|
yading@10
|
4430 */
|
yading@10
|
4431
|
yading@10
|
4432 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
yading@10
|
4433
|
yading@10
|
4434 /**
|
yading@10
|
4435 * Put a string representing the codec tag codec_tag in buf.
|
yading@10
|
4436 *
|
yading@10
|
4437 * @param buf_size size in bytes of buf
|
yading@10
|
4438 * @return the length of the string that would have been generated if
|
yading@10
|
4439 * enough space had been available, excluding the trailing null
|
yading@10
|
4440 */
|
yading@10
|
4441 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
|
yading@10
|
4442
|
yading@10
|
4443 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
|
yading@10
|
4444
|
yading@10
|
4445 /**
|
yading@10
|
4446 * Return a name for the specified profile, if available.
|
yading@10
|
4447 *
|
yading@10
|
4448 * @param codec the codec that is searched for the given profile
|
yading@10
|
4449 * @param profile the profile value for which a name is requested
|
yading@10
|
4450 * @return A name for the profile if found, NULL otherwise.
|
yading@10
|
4451 */
|
yading@10
|
4452 const char *av_get_profile_name(const AVCodec *codec, int profile);
|
yading@10
|
4453
|
yading@10
|
4454 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
|
yading@10
|
4455 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
|
yading@10
|
4456 //FIXME func typedef
|
yading@10
|
4457
|
yading@10
|
4458 /**
|
yading@10
|
4459 * Fill AVFrame audio data and linesize pointers.
|
yading@10
|
4460 *
|
yading@10
|
4461 * The buffer buf must be a preallocated buffer with a size big enough
|
yading@10
|
4462 * to contain the specified samples amount. The filled AVFrame data
|
yading@10
|
4463 * pointers will point to this buffer.
|
yading@10
|
4464 *
|
yading@10
|
4465 * AVFrame extended_data channel pointers are allocated if necessary for
|
yading@10
|
4466 * planar audio.
|
yading@10
|
4467 *
|
yading@10
|
4468 * @param frame the AVFrame
|
yading@10
|
4469 * frame->nb_samples must be set prior to calling the
|
yading@10
|
4470 * function. This function fills in frame->data,
|
yading@10
|
4471 * frame->extended_data, frame->linesize[0].
|
yading@10
|
4472 * @param nb_channels channel count
|
yading@10
|
4473 * @param sample_fmt sample format
|
yading@10
|
4474 * @param buf buffer to use for frame data
|
yading@10
|
4475 * @param buf_size size of buffer
|
yading@10
|
4476 * @param align plane size sample alignment (0 = default)
|
yading@10
|
4477 * @return >=0 on success, negative error code on failure
|
yading@10
|
4478 * @todo return the size in bytes required to store the samples in
|
yading@10
|
4479 * case of success, at the next libavutil bump
|
yading@10
|
4480 */
|
yading@10
|
4481 int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
|
yading@10
|
4482 enum AVSampleFormat sample_fmt, const uint8_t *buf,
|
yading@10
|
4483 int buf_size, int align);
|
yading@10
|
4484
|
yading@10
|
4485 /**
|
yading@10
|
4486 * Flush buffers, should be called when seeking or when switching to a different stream.
|
yading@10
|
4487 */
|
yading@10
|
4488 void avcodec_flush_buffers(AVCodecContext *avctx);
|
yading@10
|
4489
|
yading@10
|
4490 /**
|
yading@10
|
4491 * Return codec bits per sample.
|
yading@10
|
4492 *
|
yading@10
|
4493 * @param[in] codec_id the codec
|
yading@10
|
4494 * @return Number of bits per sample or zero if unknown for the given codec.
|
yading@10
|
4495 */
|
yading@10
|
4496 int av_get_bits_per_sample(enum AVCodecID codec_id);
|
yading@10
|
4497
|
yading@10
|
4498 /**
|
yading@10
|
4499 * Return the PCM codec associated with a sample format.
|
yading@10
|
4500 * @param be endianness, 0 for little, 1 for big,
|
yading@10
|
4501 * -1 (or anything else) for native
|
yading@10
|
4502 * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
|
yading@10
|
4503 */
|
yading@10
|
4504 enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
|
yading@10
|
4505
|
yading@10
|
4506 /**
|
yading@10
|
4507 * Return codec bits per sample.
|
yading@10
|
4508 * Only return non-zero if the bits per sample is exactly correct, not an
|
yading@10
|
4509 * approximation.
|
yading@10
|
4510 *
|
yading@10
|
4511 * @param[in] codec_id the codec
|
yading@10
|
4512 * @return Number of bits per sample or zero if unknown for the given codec.
|
yading@10
|
4513 */
|
yading@10
|
4514 int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
|
yading@10
|
4515
|
yading@10
|
4516 /**
|
yading@10
|
4517 * Return audio frame duration.
|
yading@10
|
4518 *
|
yading@10
|
4519 * @param avctx codec context
|
yading@10
|
4520 * @param frame_bytes size of the frame, or 0 if unknown
|
yading@10
|
4521 * @return frame duration, in samples, if known. 0 if not able to
|
yading@10
|
4522 * determine.
|
yading@10
|
4523 */
|
yading@10
|
4524 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
|
yading@10
|
4525
|
yading@10
|
4526
|
yading@10
|
4527 typedef struct AVBitStreamFilterContext {
|
yading@10
|
4528 void *priv_data;
|
yading@10
|
4529 struct AVBitStreamFilter *filter;
|
yading@10
|
4530 AVCodecParserContext *parser;
|
yading@10
|
4531 struct AVBitStreamFilterContext *next;
|
yading@10
|
4532 } AVBitStreamFilterContext;
|
yading@10
|
4533
|
yading@10
|
4534
|
yading@10
|
4535 typedef struct AVBitStreamFilter {
|
yading@10
|
4536 const char *name;
|
yading@10
|
4537 int priv_data_size;
|
yading@10
|
4538 int (*filter)(AVBitStreamFilterContext *bsfc,
|
yading@10
|
4539 AVCodecContext *avctx, const char *args,
|
yading@10
|
4540 uint8_t **poutbuf, int *poutbuf_size,
|
yading@10
|
4541 const uint8_t *buf, int buf_size, int keyframe);
|
yading@10
|
4542 void (*close)(AVBitStreamFilterContext *bsfc);
|
yading@10
|
4543 struct AVBitStreamFilter *next;
|
yading@10
|
4544 } AVBitStreamFilter;
|
yading@10
|
4545
|
yading@10
|
4546 void av_register_bitstream_filter(AVBitStreamFilter *bsf);
|
yading@10
|
4547 AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
|
yading@10
|
4548 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
|
yading@10
|
4549 AVCodecContext *avctx, const char *args,
|
yading@10
|
4550 uint8_t **poutbuf, int *poutbuf_size,
|
yading@10
|
4551 const uint8_t *buf, int buf_size, int keyframe);
|
yading@10
|
4552 void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
|
yading@10
|
4553
|
yading@10
|
4554 AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
|
yading@10
|
4555
|
yading@10
|
4556 /* memory */
|
yading@10
|
4557
|
yading@10
|
4558 /**
|
yading@10
|
4559 * Reallocate the given block if it is not large enough, otherwise do nothing.
|
yading@10
|
4560 *
|
yading@10
|
4561 * @see av_realloc
|
yading@10
|
4562 */
|
yading@10
|
4563 void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
yading@10
|
4564
|
yading@10
|
4565 /**
|
yading@10
|
4566 * Allocate a buffer, reusing the given one if large enough.
|
yading@10
|
4567 *
|
yading@10
|
4568 * Contrary to av_fast_realloc the current buffer contents might not be
|
yading@10
|
4569 * preserved and on error the old buffer is freed, thus no special
|
yading@10
|
4570 * handling to avoid memleaks is necessary.
|
yading@10
|
4571 *
|
yading@10
|
4572 * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
|
yading@10
|
4573 * @param size size of the buffer *ptr points to
|
yading@10
|
4574 * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
yading@10
|
4575 * *size 0 if an error occurred.
|
yading@10
|
4576 */
|
yading@10
|
4577 void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
yading@10
|
4578
|
yading@10
|
4579 /**
|
yading@10
|
4580 * Same behaviour av_fast_malloc but the buffer has additional
|
yading@10
|
4581 * FF_INPUT_BUFFER_PADDING_SIZE at the end which will will always be 0.
|
yading@10
|
4582 *
|
yading@10
|
4583 * In addition the whole buffer will initially and after resizes
|
yading@10
|
4584 * be 0-initialized so that no uninitialized data will ever appear.
|
yading@10
|
4585 */
|
yading@10
|
4586 void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
|
yading@10
|
4587
|
yading@10
|
4588 /**
|
yading@10
|
4589 * Same behaviour av_fast_padded_malloc except that buffer will always
|
yading@10
|
4590 * be 0-initialized after call.
|
yading@10
|
4591 */
|
yading@10
|
4592 void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
|
yading@10
|
4593
|
yading@10
|
4594 /**
|
yading@10
|
4595 * Encode extradata length to a buffer. Used by xiph codecs.
|
yading@10
|
4596 *
|
yading@10
|
4597 * @param s buffer to write to; must be at least (v/255+1) bytes long
|
yading@10
|
4598 * @param v size of extradata in bytes
|
yading@10
|
4599 * @return number of bytes written to the buffer.
|
yading@10
|
4600 */
|
yading@10
|
4601 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
|
yading@10
|
4602
|
yading@10
|
4603 #if FF_API_MISSING_SAMPLE
|
yading@10
|
4604 /**
|
yading@10
|
4605 * Log a generic warning message about a missing feature. This function is
|
yading@10
|
4606 * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
|
yading@10
|
4607 * only, and would normally not be used by applications.
|
yading@10
|
4608 * @param[in] avc a pointer to an arbitrary struct of which the first field is
|
yading@10
|
4609 * a pointer to an AVClass struct
|
yading@10
|
4610 * @param[in] feature string containing the name of the missing feature
|
yading@10
|
4611 * @param[in] want_sample indicates if samples are wanted which exhibit this feature.
|
yading@10
|
4612 * If want_sample is non-zero, additional verbage will be added to the log
|
yading@10
|
4613 * message which tells the user how to report samples to the development
|
yading@10
|
4614 * mailing list.
|
yading@10
|
4615 * @deprecated Use avpriv_report_missing_feature() instead.
|
yading@10
|
4616 */
|
yading@10
|
4617 attribute_deprecated
|
yading@10
|
4618 void av_log_missing_feature(void *avc, const char *feature, int want_sample);
|
yading@10
|
4619
|
yading@10
|
4620 /**
|
yading@10
|
4621 * Log a generic warning message asking for a sample. This function is
|
yading@10
|
4622 * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
|
yading@10
|
4623 * only, and would normally not be used by applications.
|
yading@10
|
4624 * @param[in] avc a pointer to an arbitrary struct of which the first field is
|
yading@10
|
4625 * a pointer to an AVClass struct
|
yading@10
|
4626 * @param[in] msg string containing an optional message, or NULL if no message
|
yading@10
|
4627 * @deprecated Use avpriv_request_sample() instead.
|
yading@10
|
4628 */
|
yading@10
|
4629 attribute_deprecated
|
yading@10
|
4630 void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3);
|
yading@10
|
4631 #endif /* FF_API_MISSING_SAMPLE */
|
yading@10
|
4632
|
yading@10
|
4633 /**
|
yading@10
|
4634 * Register the hardware accelerator hwaccel.
|
yading@10
|
4635 */
|
yading@10
|
4636 void av_register_hwaccel(AVHWAccel *hwaccel);
|
yading@10
|
4637
|
yading@10
|
4638 /**
|
yading@10
|
4639 * If hwaccel is NULL, returns the first registered hardware accelerator,
|
yading@10
|
4640 * if hwaccel is non-NULL, returns the next registered hardware accelerator
|
yading@10
|
4641 * after hwaccel, or NULL if hwaccel is the last one.
|
yading@10
|
4642 */
|
yading@10
|
4643 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
|
yading@10
|
4644
|
yading@10
|
4645
|
yading@10
|
4646 /**
|
yading@10
|
4647 * Lock operation used by lockmgr
|
yading@10
|
4648 */
|
yading@10
|
4649 enum AVLockOp {
|
yading@10
|
4650 AV_LOCK_CREATE, ///< Create a mutex
|
yading@10
|
4651 AV_LOCK_OBTAIN, ///< Lock the mutex
|
yading@10
|
4652 AV_LOCK_RELEASE, ///< Unlock the mutex
|
yading@10
|
4653 AV_LOCK_DESTROY, ///< Free mutex resources
|
yading@10
|
4654 };
|
yading@10
|
4655
|
yading@10
|
4656 /**
|
yading@10
|
4657 * Register a user provided lock manager supporting the operations
|
yading@10
|
4658 * specified by AVLockOp. mutex points to a (void *) where the
|
yading@10
|
4659 * lockmgr should store/get a pointer to a user allocated mutex. It's
|
yading@10
|
4660 * NULL upon AV_LOCK_CREATE and != NULL for all other ops.
|
yading@10
|
4661 *
|
yading@10
|
4662 * @param cb User defined callback. Note: FFmpeg may invoke calls to this
|
yading@10
|
4663 * callback during the call to av_lockmgr_register().
|
yading@10
|
4664 * Thus, the application must be prepared to handle that.
|
yading@10
|
4665 * If cb is set to NULL the lockmgr will be unregistered.
|
yading@10
|
4666 * Also note that during unregistration the previously registered
|
yading@10
|
4667 * lockmgr callback may also be invoked.
|
yading@10
|
4668 */
|
yading@10
|
4669 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
|
yading@10
|
4670
|
yading@10
|
4671 /**
|
yading@10
|
4672 * Get the type of the given codec.
|
yading@10
|
4673 */
|
yading@10
|
4674 enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
|
yading@10
|
4675
|
yading@10
|
4676 /**
|
yading@10
|
4677 * Get the name of a codec.
|
yading@10
|
4678 * @return a static string identifying the codec; never NULL
|
yading@10
|
4679 */
|
yading@10
|
4680 const char *avcodec_get_name(enum AVCodecID id);
|
yading@10
|
4681
|
yading@10
|
4682 /**
|
yading@10
|
4683 * @return a positive value if s is open (i.e. avcodec_open2() was called on it
|
yading@10
|
4684 * with no corresponding avcodec_close()), 0 otherwise.
|
yading@10
|
4685 */
|
yading@10
|
4686 int avcodec_is_open(AVCodecContext *s);
|
yading@10
|
4687
|
yading@10
|
4688 /**
|
yading@10
|
4689 * @return a non-zero number if codec is an encoder, zero otherwise
|
yading@10
|
4690 */
|
yading@10
|
4691 int av_codec_is_encoder(const AVCodec *codec);
|
yading@10
|
4692
|
yading@10
|
4693 /**
|
yading@10
|
4694 * @return a non-zero number if codec is a decoder, zero otherwise
|
yading@10
|
4695 */
|
yading@10
|
4696 int av_codec_is_decoder(const AVCodec *codec);
|
yading@10
|
4697
|
yading@10
|
4698 /**
|
yading@10
|
4699 * @return descriptor for given codec ID or NULL if no descriptor exists.
|
yading@10
|
4700 */
|
yading@10
|
4701 const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
|
yading@10
|
4702
|
yading@10
|
4703 /**
|
yading@10
|
4704 * Iterate over all codec descriptors known to libavcodec.
|
yading@10
|
4705 *
|
yading@10
|
4706 * @param prev previous descriptor. NULL to get the first descriptor.
|
yading@10
|
4707 *
|
yading@10
|
4708 * @return next descriptor or NULL after the last descriptor
|
yading@10
|
4709 */
|
yading@10
|
4710 const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
|
yading@10
|
4711
|
yading@10
|
4712 /**
|
yading@10
|
4713 * @return codec descriptor with the given name or NULL if no such descriptor
|
yading@10
|
4714 * exists.
|
yading@10
|
4715 */
|
yading@10
|
4716 const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
|
yading@10
|
4717
|
yading@10
|
4718 /**
|
yading@10
|
4719 * @}
|
yading@10
|
4720 */
|
yading@10
|
4721
|
yading@10
|
4722 #endif /* AVCODEC_AVCODEC_H */
|