comparison avcodec.h @ 4794:2c9f06854306 libavcodec

spelling/wording/grammar
author diego
date Sat, 07 Apr 2007 14:07:33 +0000
parents 2b825cb391f2
children 12279b61177b
comparison
equal deleted inserted replaced
4793:e69d9ecaaf84 4794:2c9f06854306
21 #ifndef AVCODEC_H 21 #ifndef AVCODEC_H
22 #define AVCODEC_H 22 #define AVCODEC_H
23 23
24 /** 24 /**
25 * @file avcodec.h 25 * @file avcodec.h
26 * external api header. 26 * external API header
27 */ 27 */
28 28
29 29
30 #ifdef __cplusplus 30 #ifdef __cplusplus
31 extern "C" { 31 extern "C" {
47 #define AV_TIME_BASE 1000000 47 #define AV_TIME_BASE 1000000
48 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} 48 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
49 49
50 /** 50 /**
51 * 51 *
52 * if you add a codec id to this list add it so that 52 * If you add a codec ID to this list, add it so that
53 * 1. no value of a existing codec id changes (that would break ABI) 53 * 1. no value of a existing codec ID changes (that would break ABI),
54 * 2. closest to similar codecs 54 * 2. it is as close as possible to similar codecs.
55 */ 55 */
56 enum CodecID { 56 enum CodecID {
57 CODEC_ID_NONE, 57 CODEC_ID_NONE,
58 CODEC_ID_MPEG1VIDEO, 58 CODEC_ID_MPEG1VIDEO,
59 CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */ 59 CODEC_ID_MPEG2VIDEO, /* preferred ID for MPEG-1/2 video decoding */
60 CODEC_ID_MPEG2VIDEO_XVMC, 60 CODEC_ID_MPEG2VIDEO_XVMC,
61 CODEC_ID_H261, 61 CODEC_ID_H261,
62 CODEC_ID_H263, 62 CODEC_ID_H263,
63 CODEC_ID_RV10, 63 CODEC_ID_RV10,
64 CODEC_ID_RV20, 64 CODEC_ID_RV20,
159 CODEC_ID_DXA, 159 CODEC_ID_DXA,
160 CODEC_ID_DNXHD, 160 CODEC_ID_DNXHD,
161 CODEC_ID_THP, 161 CODEC_ID_THP,
162 CODEC_ID_SGI, 162 CODEC_ID_SGI,
163 163
164 /* various pcm "codecs" */ 164 /* various PCM "codecs" */
165 CODEC_ID_PCM_S16LE= 0x10000, 165 CODEC_ID_PCM_S16LE= 0x10000,
166 CODEC_ID_PCM_S16BE, 166 CODEC_ID_PCM_S16BE,
167 CODEC_ID_PCM_U16LE, 167 CODEC_ID_PCM_U16LE,
168 CODEC_ID_PCM_U16BE, 168 CODEC_ID_PCM_U16BE,
169 CODEC_ID_PCM_S8, 169 CODEC_ID_PCM_S8,
178 CODEC_ID_PCM_S24BE, 178 CODEC_ID_PCM_S24BE,
179 CODEC_ID_PCM_U24LE, 179 CODEC_ID_PCM_U24LE,
180 CODEC_ID_PCM_U24BE, 180 CODEC_ID_PCM_U24BE,
181 CODEC_ID_PCM_S24DAUD, 181 CODEC_ID_PCM_S24DAUD,
182 182
183 /* various adpcm codecs */ 183 /* various ADPCM codecs */
184 CODEC_ID_ADPCM_IMA_QT= 0x11000, 184 CODEC_ID_ADPCM_IMA_QT= 0x11000,
185 CODEC_ID_ADPCM_IMA_WAV, 185 CODEC_ID_ADPCM_IMA_WAV,
186 CODEC_ID_ADPCM_IMA_DK3, 186 CODEC_ID_ADPCM_IMA_DK3,
187 CODEC_ID_ADPCM_IMA_DK4, 187 CODEC_ID_ADPCM_IMA_DK4,
188 CODEC_ID_ADPCM_IMA_WS, 188 CODEC_ID_ADPCM_IMA_WS,
213 CODEC_ID_INTERPLAY_DPCM, 213 CODEC_ID_INTERPLAY_DPCM,
214 CODEC_ID_XAN_DPCM, 214 CODEC_ID_XAN_DPCM,
215 CODEC_ID_SOL_DPCM, 215 CODEC_ID_SOL_DPCM,
216 216
217 CODEC_ID_MP2= 0x15000, 217 CODEC_ID_MP2= 0x15000,
218 CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ 218 CODEC_ID_MP3, /* preferred ID for decoding MPEG audio layer 1, 2 or 3 */
219 CODEC_ID_AAC, 219 CODEC_ID_AAC,
220 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 220 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
221 CODEC_ID_MPEG4AAC, 221 CODEC_ID_MPEG4AAC,
222 #endif 222 #endif
223 CODEC_ID_AC3, 223 CODEC_ID_AC3,
235 CODEC_ID_MP3ADU, 235 CODEC_ID_MP3ADU,
236 CODEC_ID_MP3ON4, 236 CODEC_ID_MP3ON4,
237 CODEC_ID_SHORTEN, 237 CODEC_ID_SHORTEN,
238 CODEC_ID_ALAC, 238 CODEC_ID_ALAC,
239 CODEC_ID_WESTWOOD_SND1, 239 CODEC_ID_WESTWOOD_SND1,
240 CODEC_ID_GSM, /* As in Berlin toast format */ 240 CODEC_ID_GSM, /* as in Berlin toast format */
241 CODEC_ID_QDM2, 241 CODEC_ID_QDM2,
242 CODEC_ID_COOK, 242 CODEC_ID_COOK,
243 CODEC_ID_TRUESPEECH, 243 CODEC_ID_TRUESPEECH,
244 CODEC_ID_TTA, 244 CODEC_ID_TTA,
245 CODEC_ID_SMACKAUDIO, 245 CODEC_ID_SMACKAUDIO,
247 CODEC_ID_WAVPACK, 247 CODEC_ID_WAVPACK,
248 CODEC_ID_DSICINAUDIO, 248 CODEC_ID_DSICINAUDIO,
249 CODEC_ID_IMC, 249 CODEC_ID_IMC,
250 CODEC_ID_MUSEPACK7, 250 CODEC_ID_MUSEPACK7,
251 CODEC_ID_MLP, 251 CODEC_ID_MLP,
252 CODEC_ID_GSM_MS, /* As found in WAV */ 252 CODEC_ID_GSM_MS, /* as found in WAV */
253 253
254 /* subtitle codecs */ 254 /* subtitle codecs */
255 CODEC_ID_DVD_SUBTITLE= 0x17000, 255 CODEC_ID_DVD_SUBTITLE= 0x17000,
256 CODEC_ID_DVB_SUBTITLE, 256 CODEC_ID_DVB_SUBTITLE,
257 257
258 CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport 258 CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG-2 TS
259 stream (only used by libavformat) */ 259 * stream (only used by libavformat) */
260 }; 260 };
261 261
262 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 262 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
263 /* CODEC_ID_MP3LAME is absolete */ 263 /* CODEC_ID_MP3LAME is obsolete */
264 #define CODEC_ID_MP3LAME CODEC_ID_MP3 264 #define CODEC_ID_MP3LAME CODEC_ID_MP3
265 #define CODEC_ID_MPEG4AAC CODEC_ID_AAC 265 #define CODEC_ID_MPEG4AAC CODEC_ID_AAC
266 #endif 266 #endif
267 267
268 enum CodecType { 268 enum CodecType {
272 CODEC_TYPE_DATA, 272 CODEC_TYPE_DATA,
273 CODEC_TYPE_SUBTITLE, 273 CODEC_TYPE_SUBTITLE,
274 CODEC_TYPE_NB 274 CODEC_TYPE_NB
275 }; 275 };
276 276
277 /* currently unused, may be used if 24/32 bits samples ever supported */ 277 /* Currently unused, may be used if 24/32 bits samples are ever supported. */
278 /* all in native endian */ 278 /* all in native-endian format */
279 enum SampleFormat { 279 enum SampleFormat {
280 SAMPLE_FMT_NONE = -1, 280 SAMPLE_FMT_NONE = -1,
281 SAMPLE_FMT_U8, ///< unsigned 8 bits 281 SAMPLE_FMT_U8, ///< unsigned 8 bits
282 SAMPLE_FMT_S16, ///< signed 16 bits 282 SAMPLE_FMT_S16, ///< signed 16 bits
283 SAMPLE_FMT_S24, ///< signed 24 bits 283 SAMPLE_FMT_S24, ///< signed 24 bits
288 /* in bytes */ 288 /* in bytes */
289 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio 289 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
290 290
291 /** 291 /**
292 * Required number of additionally allocated bytes at the end of the input bitstream for decoding. 292 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
293 * this is mainly needed because some optimized bitstream readers read 293 * This is mainly needed because some optimized bitstream readers read
294 * 32 or 64 bit at once and could read over the end<br> 294 * 32 or 64 bit at once and could read over the end.<br>
295 * Note, if the first 23 bits of the additional bytes are not 0 then damaged 295 * Note: If the first 23 bits of the additional bytes are not 0, then damaged
296 * MPEG bitstreams could cause overread and segfault 296 * MPEG bitstreams could cause overread and segfault.
297 */ 297 */
298 #define FF_INPUT_BUFFER_PADDING_SIZE 8 298 #define FF_INPUT_BUFFER_PADDING_SIZE 8
299 299
300 /** 300 /**
301 * minimum encoding buffer size. 301 * minimum encoding buffer size
302 * used to avoid some checks during header writing 302 * Used to avoid some checks during header writing.
303 */ 303 */
304 #define FF_MIN_BUFFER_SIZE 16384 304 #define FF_MIN_BUFFER_SIZE 16384
305 305
306 /* motion estimation type, EPZS by default */ 306 /* motion estimation type, EPZS by default */
307 enum Motion_Est_ID { 307 enum Motion_Est_ID {
315 ME_UMH, 315 ME_UMH,
316 ME_ITER, 316 ME_ITER,
317 }; 317 };
318 318
319 enum AVDiscard{ 319 enum AVDiscard{
320 //we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) 320 /* We leave some space between them for extensions (drop some
321 * keyframes for intra-only or drop just some bidir frames). */
321 AVDISCARD_NONE =-16, ///< discard nothing 322 AVDISCARD_NONE =-16, ///< discard nothing
322 AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi 323 AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi
323 AVDISCARD_NONREF = 8, ///< discard all non reference 324 AVDISCARD_NONREF = 8, ///< discard all non reference
324 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames 325 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
325 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes 326 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
327 }; 328 };
328 329
329 typedef struct RcOverride{ 330 typedef struct RcOverride{
330 int start_frame; 331 int start_frame;
331 int end_frame; 332 int end_frame;
332 int qscale; // if this is 0 then quality_factor will be used instead 333 int qscale; // If this is 0 then quality_factor will be used instead.
333 float quality_factor; 334 float quality_factor;
334 } RcOverride; 335 } RcOverride;
335 336
336 #define FF_MAX_B_FRAMES 16 337 #define FF_MAX_B_FRAMES 16
337 338
338 /* encoding support 339 /* encoding support
339 these flags can be passed in AVCodecContext.flags before initing 340 These flags can be passed in AVCodecContext.flags before initialization.
340 Note: not everything is supported yet. 341 Note: Not everything is supported yet.
341 */ 342 */
342 343
343 #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale 344 #define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale.
344 #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / Advanced prediction for H263 345 #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263.
345 #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC 346 #define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC.
346 #define CODEC_FLAG_GMC 0x0020 ///< use GMC 347 #define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
347 #define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0> 348 #define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
348 #define CODEC_FLAG_PART 0x0080 ///< use data partitioning 349 #define CODEC_FLAG_PART 0x0080 ///< Use data partitioning.
349 /* parent program guarantees that the input for b-frame containing streams is not written to 350 /* The parent program guarantees that the input for B-frames containing
350 for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ 351 * streams is not written to for at least s->max_b_frames+1 frames, if
352 * this is not set the input will be copied. */
351 #define CODEC_FLAG_INPUT_PRESERVED 0x0100 353 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
352 #define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode 354 #define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.
353 #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode 355 #define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.
354 #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) 356 #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< Use external Huffman table (for MJPEG).
355 #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale 357 #define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
356 #define CODEC_FLAG_EMU_EDGE 0x4000///< don't draw edges 358 #define CODEC_FLAG_EMU_EDGE 0x4000///< Don't draw edges.
357 #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding 359 #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
358 #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead 360 #define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random location instead
359 of only at frame boundaries */ 361 of only at frame boundaries. */
360 #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization 362 #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
361 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct 363 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
362 #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay 364 #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
363 #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan 365 #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< Use alternate scan.
364 #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization 366 #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< Use trellis quantization.
365 #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe 367 #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
366 #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct) 368 #define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
367 /* Fx : Flag for h263+ extra options */ 369 /* Fx : Flag for h263+ extra options */
368 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 370 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
369 #define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) 371 #define CODEC_FLAG_H263P_AIC 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction (remove this)
370 #endif 372 #endif
371 #define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction 373 #define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
372 #define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector 374 #define CODEC_FLAG_H263P_UMV 0x02000000 ///< unlimited motion vector
373 #define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp 375 #define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
374 #define CODEC_FLAG_QP_RD 0x08000000 ///< use rate distortion optimization for qp selectioon 376 #define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
375 #define CODEC_FLAG_H263P_AIV 0x00000008 ///< H263 Alternative inter vlc 377 #define CODEC_FLAG_H263P_AIV 0x00000008 ///< H.263 alternative inter VLC
376 #define CODEC_FLAG_OBMC 0x00000001 ///< OBMC 378 #define CODEC_FLAG_OBMC 0x00000001 ///< OBMC
377 #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter 379 #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
378 #define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000 380 #define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
379 #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation 381 #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
380 #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< will reserve space for SVCD scan offset user data 382 #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data.
381 #define CODEC_FLAG_CLOSED_GOP ((int)0x80000000) 383 #define CODEC_FLAG_CLOSED_GOP ((int)0x80000000)
382 #define CODEC_FLAG2_FAST 0x00000001 ///< allow non spec compliant speedup tricks 384 #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks.
383 #define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< strictly enforce GOP size 385 #define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
384 #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< skip bitstream encoding 386 #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
385 #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< place global headers at every keyframe instead of in extradata 387 #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
386 #define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow b-frames to be used as references 388 #define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow B-frames to be used as references.
387 #define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for b-frames 389 #define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for B-frames
388 #define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock 390 #define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
389 #define CODEC_FLAG2_8X8DCT 0x00000080 ///< H.264 high profile 8x8 transform 391 #define CODEC_FLAG2_8X8DCT 0x00000080 ///< H.264 high profile 8x8 transform
390 #define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip 392 #define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip
391 #define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters 393 #define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters
392 #define CODEC_FLAG2_BRDO 0x00000400 ///< b-frame rate-distortion optimization 394 #define CODEC_FLAG2_BRDO 0x00000400 ///< B-frame rate-distortion optimization
393 #define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< use MPEG-2 intra VLC table 395 #define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table.
394 #define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) 396 #define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
395 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format 397 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
396 #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skiping 398 #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
397 #define CODEC_FLAG2_CHUNKS 0x00008000 ///< input bitstream might be truncated at a packet boundaries instead of only at frame boundaries 399 #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
398 #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< use MPEG-2 non linear quantizer 400 #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
399 401
400 /* Unsupported options : 402 /* Unsupported options :
401 * Syntax Arithmetic coding (SAC) 403 * Syntax Arithmetic coding (SAC)
402 * Reference Picture Selection 404 * Reference Picture Selection
403 * Independent Segment Decoding */ 405 * Independent Segment Decoding */
404 /* /Fx */ 406 /* /Fx */
405 /* codec capabilities */ 407 /* codec capabilities */
406 408
407 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback 409 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
408 /** 410 /**
409 * Codec uses get_buffer() for allocating buffers. 411 * Codec uses get_buffer() for allocating buffers.
410 * direct rendering method 1 412 * direct rendering method 1
411 */ 413 */
412 #define CODEC_CAP_DR1 0x0002 414 #define CODEC_CAP_DR1 0x0002
413 /* if 'parse_only' field is true, then avcodec_parse_frame() can be 415 /* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
414 used */
415 #define CODEC_CAP_PARSE_ONLY 0x0004 416 #define CODEC_CAP_PARSE_ONLY 0x0004
416 #define CODEC_CAP_TRUNCATED 0x0008 417 #define CODEC_CAP_TRUNCATED 0x0008
417 /* codec can export data for HW decoding (XvMC) */ 418 /* Codec can export data for HW decoding (XvMC). */
418 #define CODEC_CAP_HWACCEL 0x0010 419 #define CODEC_CAP_HWACCEL 0x0010
419 /** 420 /**
420 * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. 421 * Codec has a nonzero delay and needs to be fed with NULL at the end to get the delayed data.
421 * if this is not set, the codec is guaranteed to never be feeded with NULL data 422 * If this is not set, the codec is guaranteed to never be fed with NULL data.
422 */ 423 */
423 #define CODEC_CAP_DELAY 0x0020 424 #define CODEC_CAP_DELAY 0x0020
424 /** 425 /**
425 * Codec can be fed a final frame with a smaller size. 426 * Codec can be fed a final frame with a smaller size.
426 * This can be used to prevent truncation of the last audio samples. 427 * This can be used to prevent truncation of the last audio samples.
427 */ 428 */
428 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040 429 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
429 430
430 //the following defines may change, don't expect compatibility if you use them 431 //The following defines may change, don't expect compatibility if you use them.
431 #define MB_TYPE_INTRA4x4 0x0001 432 #define MB_TYPE_INTRA4x4 0x0001
432 #define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific 433 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
433 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME h264 specific 434 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific
434 #define MB_TYPE_16x16 0x0008 435 #define MB_TYPE_16x16 0x0008
435 #define MB_TYPE_16x8 0x0010 436 #define MB_TYPE_16x8 0x0010
436 #define MB_TYPE_8x16 0x0020 437 #define MB_TYPE_8x16 0x0020
437 #define MB_TYPE_8x8 0x0040 438 #define MB_TYPE_8x8 0x0040
438 #define MB_TYPE_INTERLACED 0x0080 439 #define MB_TYPE_INTERLACED 0x0080
451 #define MB_TYPE_CBP 0x00020000 452 #define MB_TYPE_CBP 0x00020000
452 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) 453 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
453 454
454 /** 455 /**
455 * Pan Scan area. 456 * Pan Scan area.
456 * this specifies the area which should be displayed. Note there may be multiple such areas for one frame 457 * This specifies the area which should be displayed.
458 * Note there may be multiple such areas for one frame.
457 */ 459 */
458 typedef struct AVPanScan{ 460 typedef struct AVPanScan{
459 /** 461 /**
460 * id. 462 * id
461 * - encoding: set by user. 463 * - encoding: Set by user.
462 * - decoding: set by lavc 464 * - decoding: Set by libavcodec.
463 */ 465 */
464 int id; 466 int id;
465 467
466 /** 468 /**
467 * width and height in 1/16 pel 469 * width and height in 1/16 pel
468 * - encoding: set by user. 470 * - encoding: Set by user.
469 * - decoding: set by lavc 471 * - decoding: Set by libavcodec.
470 */ 472 */
471 int width; 473 int width;
472 int height; 474 int height;
473 475
474 /** 476 /**
475 * position of the top left corner in 1/16 pel for up to 3 fields/frames. 477 * position of the top left corner in 1/16 pel for up to 3 fields/frames
476 * - encoding: set by user. 478 * - encoding: Set by user.
477 * - decoding: set by lavc 479 * - decoding: Set by libavcodec.
478 */ 480 */
479 int16_t position[3][2]; 481 int16_t position[3][2];
480 }AVPanScan; 482 }AVPanScan;
481 483
482 #define FF_COMMON_FRAME \ 484 #define FF_COMMON_FRAME \
483 /**\ 485 /**\
484 * pointer to the picture planes.\ 486 * pointer to the picture planes.\
485 * this might be different from the first allocated byte\ 487 * This might be different from the first allocated byte\
486 * - encoding: \ 488 * - encoding: \
487 * - decoding: \ 489 * - decoding: \
488 */\ 490 */\
489 uint8_t *data[4];\ 491 uint8_t *data[4];\
490 int linesize[4];\ 492 int linesize[4];\
491 /**\ 493 /**\
492 * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\ 494 * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.\
493 * this isn't used by lavc unless the default get/release_buffer() is used\ 495 * This isn't used by libavcodec unless the default get/release_buffer() is used.\
494 * - encoding: \ 496 * - encoding: \
495 * - decoding: \ 497 * - decoding: \
496 */\ 498 */\
497 uint8_t *base[4];\ 499 uint8_t *base[4];\
498 /**\ 500 /**\
499 * 1 -> keyframe, 0-> not\ 501 * 1 -> keyframe, 0-> not\
500 * - encoding: set by lavc\ 502 * - encoding: Set by libavcodec.\
501 * - decoding: set by lavc\ 503 * - decoding: Set by libavcodec.\
502 */\ 504 */\
503 int key_frame;\ 505 int key_frame;\
504 \ 506 \
505 /**\ 507 /**\
506 * picture type of the frame, see ?_TYPE below.\ 508 * Picture type of the frame, see ?_TYPE below.\
507 * - encoding: set by lavc for coded_picture (and set by user for input)\ 509 * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
508 * - decoding: set by lavc\ 510 * - decoding: Set by libavcodec.\
509 */\ 511 */\
510 int pict_type;\ 512 int pict_type;\
511 \ 513 \
512 /**\ 514 /**\
513 * presentation timestamp in time_base units (time when frame should be shown to user)\ 515 * presentation timestamp in time_base units (time when frame should be shown to user)\
514 * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed\ 516 * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
515 * - encoding: MUST be set by user\ 517 * - encoding: MUST be set by user.\
516 * - decoding: set by lavc\ 518 * - decoding: Set by libavcodec.\
517 */\ 519 */\
518 int64_t pts;\ 520 int64_t pts;\
519 \ 521 \
520 /**\ 522 /**\
521 * picture number in bitstream order.\ 523 * picture number in bitstream order\
522 * - encoding: set by\ 524 * - encoding: set by\
523 * - decoding: set by lavc\ 525 * - decoding: Set by libavcodec.\
524 */\ 526 */\
525 int coded_picture_number;\ 527 int coded_picture_number;\
526 /**\ 528 /**\
527 * picture number in display order.\ 529 * picture number in display order\
528 * - encoding: set by\ 530 * - encoding: set by\
529 * - decoding: set by lavc\ 531 * - decoding: Set by libavcodec.\
530 */\ 532 */\
531 int display_picture_number;\ 533 int display_picture_number;\
532 \ 534 \
533 /**\ 535 /**\
534 * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \ 536 * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \
535 * - encoding: set by lavc for coded_picture (and set by user for input)\ 537 * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
536 * - decoding: set by lavc\ 538 * - decoding: Set by libavcodec.\
537 */\ 539 */\
538 int quality; \ 540 int quality; \
539 \ 541 \
540 /**\ 542 /**\
541 * buffer age (1->was last buffer and dint change, 2->..., ...).\ 543 * buffer age (1->was last buffer and dint change, 2->..., ...).\
542 * set to INT_MAX if the buffer has not been used yet \ 544 * Set to INT_MAX if the buffer has not been used yet.\
543 * - encoding: unused\ 545 * - encoding: unused\
544 * - decoding: MUST be set by get_buffer()\ 546 * - decoding: MUST be set by get_buffer().\
545 */\ 547 */\
546 int age;\ 548 int age;\
547 \ 549 \
548 /**\ 550 /**\
549 * is this picture used as reference\ 551 * is this picture used as reference\
550 * - encoding: unused\ 552 * - encoding: unused\
551 * - decoding: set by lavc (before get_buffer() call))\ 553 * - decoding: Set by libavcodec. (before get_buffer() call)).\
552 */\ 554 */\
553 int reference;\ 555 int reference;\
554 \ 556 \
555 /**\ 557 /**\
556 * QP table\ 558 * QP table\
557 * - encoding: unused\ 559 * - encoding: unused\
558 * - decoding: set by lavc\ 560 * - decoding: Set by libavcodec.\
559 */\ 561 */\
560 int8_t *qscale_table;\ 562 int8_t *qscale_table;\
561 /**\ 563 /**\
562 * QP store stride\ 564 * QP store stride\
563 * - encoding: unused\ 565 * - encoding: unused\
564 * - decoding: set by lavc\ 566 * - decoding: Set by libavcodec.\
565 */\ 567 */\
566 int qstride;\ 568 int qstride;\
567 \ 569 \
568 /**\ 570 /**\
569 * mbskip_table[mb]>=1 if MB didnt change\ 571 * mbskip_table[mb]>=1 if MB didn't change\
570 * stride= mb_width = (width+15)>>4\ 572 * stride= mb_width = (width+15)>>4\
571 * - encoding: unused\ 573 * - encoding: unused\
572 * - decoding: set by lavc\ 574 * - decoding: Set by libavcodec.\
573 */\ 575 */\
574 uint8_t *mbskip_table;\ 576 uint8_t *mbskip_table;\
575 \ 577 \
576 /**\ 578 /**\
577 * Motion vector table.\ 579 * motion vector table\
578 * @code\ 580 * @code\
579 * example:\ 581 * example:\
580 * int mv_sample_log2= 4 - motion_subsample_log2;\ 582 * int mv_sample_log2= 4 - motion_subsample_log2;\
581 * int mb_width= (width+15)>>4;\ 583 * int mb_width= (width+15)>>4;\
582 * int mv_stride= (mb_width << mv_sample_log2) + 1;\ 584 * int mv_stride= (mb_width << mv_sample_log2) + 1;\
583 * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];\ 585 * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];\
584 * @endcode\ 586 * @endcode\
585 * - encoding: set by user\ 587 * - encoding: Set by user.\
586 * - decoding: set by lavc\ 588 * - decoding: Set by libavcodec.\
587 */\ 589 */\
588 int16_t (*motion_val[2])[2];\ 590 int16_t (*motion_val[2])[2];\
589 \ 591 \
590 /**\ 592 /**\
591 * Macroblock type table\ 593 * macroblock type table\
592 * mb_type_base + mb_width + 2\ 594 * mb_type_base + mb_width + 2\
593 * - encoding: set by user\ 595 * - encoding: Set by user.\
594 * - decoding: set by lavc\ 596 * - decoding: Set by libavcodec.\
595 */\ 597 */\
596 uint32_t *mb_type;\ 598 uint32_t *mb_type;\
597 \ 599 \
598 /**\ 600 /**\
599 * log2 of the size of the block which a single vector in motion_val represents: \ 601 * log2 of the size of the block which a single vector in motion_val represents: \
600 * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)\ 602 * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)\
601 * - encoding: unused\ 603 * - encoding: unused\
602 * - decoding: set by lavc\ 604 * - decoding: Set by libavcodec.\
603 */\ 605 */\
604 uint8_t motion_subsample_log2;\ 606 uint8_t motion_subsample_log2;\
605 \ 607 \
606 /**\ 608 /**\
607 * for some private data of the user\ 609 * for some private data of the user\
608 * - encoding: unused\ 610 * - encoding: unused\
609 * - decoding: set by user\ 611 * - decoding: Set by user.\
610 */\ 612 */\
611 void *opaque;\ 613 void *opaque;\
612 \ 614 \
613 /**\ 615 /**\
614 * error\ 616 * error\
615 * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\ 617 * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.\
616 * - decoding: unused\ 618 * - decoding: unused\
617 */\ 619 */\
618 uint64_t error[4];\ 620 uint64_t error[4];\
619 \ 621 \
620 /**\ 622 /**\
621 * type of the buffer (to keep track of who has to dealloc data[*])\ 623 * type of the buffer (to keep track of who has to deallocate data[*])\
622 * - encoding: set by the one who allocs it\ 624 * - encoding: Set by the one who allocates it.\
623 * - decoding: set by the one who allocs it\ 625 * - decoding: Set by the one who allocates it.\
624 * Note: user allocated (direct rendering) & internal buffers can not coexist currently\ 626 * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.\
625 */\ 627 */\
626 int type;\ 628 int type;\
627 \ 629 \
628 /**\ 630 /**\
629 * when decoding, this signal how much the picture must be delayed.\ 631 * When decoding, this signals how much the picture must be delayed.\
630 * extra_delay = repeat_pict / (2*fps)\ 632 * extra_delay = repeat_pict / (2*fps)\
631 * - encoding: unused\ 633 * - encoding: unused\
632 * - decoding: set by lavc\ 634 * - decoding: Set by libavcodec.\
633 */\ 635 */\
634 int repeat_pict;\ 636 int repeat_pict;\
635 \ 637 \
636 /**\ 638 /**\
637 * \ 639 * \
638 */\ 640 */\
639 int qscale_type;\ 641 int qscale_type;\
640 \ 642 \
641 /**\ 643 /**\
642 * The content of the picture is interlaced.\ 644 * The content of the picture is interlaced.\
643 * - encoding: set by user\ 645 * - encoding: Set by user.\
644 * - decoding: set by lavc (default 0)\ 646 * - decoding: Set by libavcodec. (default 0)\
645 */\ 647 */\
646 int interlaced_frame;\ 648 int interlaced_frame;\
647 \ 649 \
648 /**\ 650 /**\
649 * if the content is interlaced, is top field displayed first.\ 651 * If the content is interlaced, is top field displayed first.\
650 * - encoding: set by user\ 652 * - encoding: Set by user.\
651 * - decoding: set by lavc\ 653 * - decoding: Set by libavcodec.\
652 */\ 654 */\
653 int top_field_first;\ 655 int top_field_first;\
654 \ 656 \
655 /**\ 657 /**\
656 * Pan scan.\ 658 * Pan scan.\
657 * - encoding: set by user\ 659 * - encoding: Set by user.\
658 * - decoding: set by lavc\ 660 * - decoding: Set by libavcodec.\
659 */\ 661 */\
660 AVPanScan *pan_scan;\ 662 AVPanScan *pan_scan;\
661 \ 663 \
662 /**\ 664 /**\
663 * tell user application that palette has changed from previous frame.\ 665 * Tell user application that palette has changed from previous frame.\
664 * - encoding: ??? (no palette-enabled encoder yet)\ 666 * - encoding: ??? (no palette-enabled encoder yet)\
665 * - decoding: set by lavc (default 0)\ 667 * - decoding: Set by libavcodec. (default 0).\
666 */\ 668 */\
667 int palette_has_changed;\ 669 int palette_has_changed;\
668 \ 670 \
669 /**\ 671 /**\
670 * Codec suggestion on buffer type if != 0\ 672 * codec suggestion on buffer type if != 0\
671 * - encoding: unused\ 673 * - encoding: unused\
672 * - decoding: set by lavc (before get_buffer() call))\ 674 * - decoding: Set by libavcodec. (before get_buffer() call)).\
673 */\ 675 */\
674 int buffer_hints;\ 676 int buffer_hints;\
675 \ 677 \
676 /**\ 678 /**\
677 * DCT coeffitients\ 679 * DCT coefficients\
678 * - encoding: unused\ 680 * - encoding: unused\
679 * - decoding: set by lavc\ 681 * - decoding: Set by libavcodec.\
680 */\ 682 */\
681 short *dct_coeff;\ 683 short *dct_coeff;\
682 \ 684 \
683 /**\ 685 /**\
684 * Motion referece frame index\ 686 * motion referece frame index\
685 * - encoding: set by user\ 687 * - encoding: Set by user.\
686 * - decoding: set by lavc\ 688 * - decoding: Set by libavcodec.\
687 */\ 689 */\
688 int8_t *ref_index[2]; 690 int8_t *ref_index[2];
689 691
690 #define FF_QSCALE_TYPE_MPEG1 0 692 #define FF_QSCALE_TYPE_MPEG1 0
691 #define FF_QSCALE_TYPE_MPEG2 1 693 #define FF_QSCALE_TYPE_MPEG2 1
692 #define FF_QSCALE_TYPE_H264 2 694 #define FF_QSCALE_TYPE_H264 2
693 695
694 #define FF_BUFFER_TYPE_INTERNAL 1 696 #define FF_BUFFER_TYPE_INTERNAL 1
695 #define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user) 697 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
696 #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared 698 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
697 #define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, don't dealloc anything 699 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
698 700
699 701
700 #define FF_I_TYPE 1 // Intra 702 #define FF_I_TYPE 1 // Intra
701 #define FF_P_TYPE 2 // Predicted 703 #define FF_P_TYPE 2 // Predicted
702 #define FF_B_TYPE 3 // Bi-dir predicted 704 #define FF_B_TYPE 3 // Bi-dir predicted
703 #define FF_S_TYPE 4 // S(GMC)-VOP MPEG4 705 #define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
704 #define FF_SI_TYPE 5 706 #define FF_SI_TYPE 5
705 #define FF_SP_TYPE 6 707 #define FF_SP_TYPE 6
706 708
707 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore) 709 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
708 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer 710 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
709 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content 711 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
710 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update) 712 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
711 713
712 /** 714 /**
713 * Audio Video Frame. 715 * Audio Video Frame.
714 */ 716 */
715 typedef struct AVFrame { 717 typedef struct AVFrame {
717 } AVFrame; 719 } AVFrame;
718 720
719 #define DEFAULT_FRAME_RATE_BASE 1001000 721 #define DEFAULT_FRAME_RATE_BASE 1001000
720 722
721 /** 723 /**
722 * main external api structure. 724 * main external API structure
723 */ 725 */
724 typedef struct AVCodecContext { 726 typedef struct AVCodecContext {
725 /** 727 /**
726 * Info on struct for av_log 728 * information on struct for av_log
727 * - set by avcodec_alloc_context 729 * - set by avcodec_alloc_context
728 */ 730 */
729 AVClass *av_class; 731 AVClass *av_class;
730 /** 732 /**
731 * the average bitrate. 733 * the average bitrate
732 * - encoding: set by user. unused for constant quantizer encoding 734 * - encoding: Set by user; unused for constant quantizer encoding.
733 * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream 735 * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
734 */ 736 */
735 int bit_rate; 737 int bit_rate;
736 738
737 /** 739 /**
738 * number of bits the bitstream is allowed to diverge from the reference. 740 * number of bits the bitstream is allowed to diverge from the reference.
739 * the reference can be CBR (for CBR pass1) or VBR (for pass2) 741 * the reference can be CBR (for CBR pass1) or VBR (for pass2)
740 * - encoding: set by user. unused for constant quantizer encoding 742 * - encoding: Set by user; unused for constant quantizer encoding.
741 * - decoding: unused 743 * - decoding: unused
742 */ 744 */
743 int bit_rate_tolerance; 745 int bit_rate_tolerance;
744 746
745 /** 747 /**
746 * CODEC_FLAG_*. 748 * CODEC_FLAG_*.
747 * - encoding: set by user. 749 * - encoding: Set by user.
748 * - decoding: set by user. 750 * - decoding: Set by user.
749 */ 751 */
750 int flags; 752 int flags;
751 753
752 /** 754 /**
753 * some codecs needs additionnal format info. It is stored here 755 * Some codecs need additional format info. It is stored here.
754 * if any muxer uses this then ALL demuxers/parsers AND encoders for the specific codec MUST set it correctly 756 * If any muxer uses this then ALL demuxers/parsers AND encoders for the
755 * too otherwise stream copy breaks 757 * specific codec MUST set it correctly otherwise stream copy breaks.
756 * in general use of this field by muxers is not recommanded 758 * In general use of this field by muxers is not recommanded.
757 * - encoding: set by lavc. 759 * - encoding: Set by libavcodec.
758 * - decoding: set by lavc. (FIXME is this ok?) 760 * - decoding: Set by libavcodec. (FIXME: Is this OK?)
759 */ 761 */
760 int sub_id; 762 int sub_id;
761 763
762 /** 764 /**
763 * motion estimation algorithm used for video coding. 765 * Motion estimation algorithm used for video coding.
764 * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), 766 * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
765 * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] 767 * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific]
766 * - encoding: MUST be set by user. 768 * - encoding: MUST be set by user.
767 * - decoding: unused 769 * - decoding: unused
768 */ 770 */
769 int me_method; 771 int me_method;
770 772
771 /** 773 /**
772 * some codecs need / can use extra-data like huffman tables. 774 * some codecs need / can use extradata like Huffman tables.
773 * mjpeg: huffman tables 775 * mjpeg: Huffman tables
774 * rv10: additional flags 776 * rv10: additional flags
775 * mpeg4: global headers (they can be in the bitstream or here) 777 * mpeg4: global headers (they can be in the bitstream or here)
776 * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger 778 * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
777 * then extradata_size to avoid prolems if its read with the bitstream reader 779 * than extradata_size to avoid prolems if it is read with the bitstream reader.
778 * the bytewise contents of extradata must not depend on the architecture or cpu endianness 780 * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
779 * - encoding: set/allocated/freed by lavc. 781 * - encoding: Set/allocated/freed by libavcodec.
780 * - decoding: set/allocated/freed by user. 782 * - decoding: Set/allocated/freed by user.
781 */ 783 */
782 uint8_t *extradata; 784 uint8_t *extradata;
783 int extradata_size; 785 int extradata_size;
784 786
785 /** 787 /**
786 * this is the fundamental unit of time (in seconds) in terms 788 * This is the fundamental unit of time (in seconds) in terms
787 * of which frame timestamps are represented. for fixed-fps content, 789 * of which frame timestamps are represented. For fixed-fps content,
788 * timebase should be 1/framerate and timestamp increments should be 790 * timebase should be 1/framerate and timestamp increments should be
789 * identically 1. 791 * identically 1.
790 * - encoding: MUST be set by user 792 * - encoding: MUST be set by user.
791 * - decoding: set by lavc. 793 * - decoding: Set by libavcodec.
792 */ 794 */
793 AVRational time_base; 795 AVRational time_base;
794 796
795 /* video only */ 797 /* video only */
796 /** 798 /**
797 * picture width / height. 799 * picture width / height.
798 * - encoding: MUST be set by user. 800 * - encoding: MUST be set by user.
799 * - decoding: set by lavc. 801 * - decoding: Set by libavcodec.
800 * Note, for compatibility its possible to set this instead of 802 * Note: For compatibility it is possible to set this instead of
801 * coded_width/height before decoding 803 * coded_width/height before decoding.
802 */ 804 */
803 int width, height; 805 int width, height;
804 806
805 #define FF_ASPECT_EXTENDED 15 807 #define FF_ASPECT_EXTENDED 15
806 808
807 /** 809 /**
808 * the number of pictures in a group of pitures, or 0 for intra_only. 810 * the number of pictures in a group of pictures, or 0 for intra_only
809 * - encoding: set by user. 811 * - encoding: Set by user.
810 * - decoding: unused 812 * - decoding: unused
811 */ 813 */
812 int gop_size; 814 int gop_size;
813 815
814 /** 816 /**
815 * pixel format, see PIX_FMT_xxx. 817 * Pixel format, see PIX_FMT_xxx.
816 * - encoding: set by user. 818 * - encoding: Set by user.
817 * - decoding: set by lavc. 819 * - decoding: Set by libavcodec.
818 */ 820 */
819 enum PixelFormat pix_fmt; 821 enum PixelFormat pix_fmt;
820 822
821 /** 823 /**
822 * Frame rate emulation. If not zero lower layer (i.e. format handler) 824 * Frame rate emulation. If not zero, the lower layer (i.e. format handler)
823 * has to read frames at native frame rate. 825 * has to read frames at native frame rate.
824 * - encoding: set by user. 826 * - encoding: Set by user.
825 * - decoding: unused. 827 * - decoding: unused
826 */ 828 */
827 int rate_emu; 829 int rate_emu;
828 830
829 /** 831 /**
830 * if non NULL, 'draw_horiz_band' is called by the libavcodec 832 * If non NULL, 'draw_horiz_band' is called by the libavcodec
831 * decoder to draw an horizontal band. It improve cache usage. Not 833 * decoder to draw a horizontal band. It improves cache usage. Not
832 * all codecs can do that. You must check the codec capabilities 834 * all codecs can do that. You must check the codec capabilities
833 * before 835 * beforehand.
834 * - encoding: unused 836 * - encoding: unused
835 * - decoding: set by user. 837 * - decoding: Set by user.
836 * @param height the height of the slice 838 * @param height the height of the slice
837 * @param y the y position of the slice 839 * @param y the y position of the slice
838 * @param type 1->top field, 2->bottom field, 3->frame 840 * @param type 1->top field, 2->bottom field, 3->frame
839 * @param offset offset into the AVFrame.data from which the slice should be read 841 * @param offset offset into the AVFrame.data from which the slice should be read
840 */ 842 */
841 void (*draw_horiz_band)(struct AVCodecContext *s, 843 void (*draw_horiz_band)(struct AVCodecContext *s,
842 const AVFrame *src, int offset[4], 844 const AVFrame *src, int offset[4],
843 int y, int type, int height); 845 int y, int type, int height);
844 846
845 /* audio only */ 847 /* audio only */
846 int sample_rate; ///< samples per sec 848 int sample_rate; ///< samples per second
847 int channels; 849 int channels;
848 850
849 /** 851 /**
850 * audio sample format. 852 * audio sample format
851 * - encoding: set by user. 853 * - encoding: Set by user.
852 * - decoding: set by lavc. 854 * - decoding: Set by libavcodec.
853 */ 855 */
854 enum SampleFormat sample_fmt; ///< sample format, currenly unused 856 enum SampleFormat sample_fmt; ///< sample format, currently unused
855 857
856 /* the following data should not be initialized */ 858 /* The following data should not be initialized. */
857 /** 859 /**
858 * samples per packet. initialized when calling 'init' 860 * Samples per packet, initialized when calling 'init'.
859 */ 861 */
860 int frame_size; 862 int frame_size;
861 int frame_number; ///< audio or video frame number 863 int frame_number; ///< audio or video frame number
862 int real_pict_num; ///< returns the real picture number of previous encoded frame 864 int real_pict_num; ///< Returns the real picture number of previous encoded frame.
863 865
864 /** 866 /**
865 * number of frames the decoded output will be delayed relative to 867 * Number of frames the decoded output will be delayed relative to
866 * the encoded input. 868 * the encoded input.
867 * - encoding: set by lavc. 869 * - encoding: Set by libavcodec.
868 * - decoding: unused 870 * - decoding: unused
869 */ 871 */
870 int delay; 872 int delay;
871 873
872 /* - encoding parameters */ 874 /* - encoding parameters */
873 float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) 875 float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
874 float qblur; ///< amount of qscale smoothing over time (0.0-1.0) 876 float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
875 877
876 /** 878 /**
877 * minimum quantizer. 879 * minimum quantizer
878 * - encoding: set by user. 880 * - encoding: Set by user.
879 * - decoding: unused 881 * - decoding: unused
880 */ 882 */
881 int qmin; 883 int qmin;
882 884
883 /** 885 /**
884 * maximum quantizer. 886 * maximum quantizer
885 * - encoding: set by user. 887 * - encoding: Set by user.
886 * - decoding: unused 888 * - decoding: unused
887 */ 889 */
888 int qmax; 890 int qmax;
889 891
890 /** 892 /**
891 * maximum quantizer difference between frames. 893 * maximum quantizer difference between frames
892 * - encoding: set by user. 894 * - encoding: Set by user.
893 * - decoding: unused 895 * - decoding: unused
894 */ 896 */
895 int max_qdiff; 897 int max_qdiff;
896 898
897 /** 899 /**
898 * maximum number of b frames between non b frames. 900 * maximum number of B-frames between non-B-frames
899 * note: the output will be delayed by max_b_frames+1 relative to the input 901 * Note: The output will be delayed by max_b_frames+1 relative to the input.
900 * - encoding: set by user. 902 * - encoding: Set by user.
901 * - decoding: unused 903 * - decoding: unused
902 */ 904 */
903 int max_b_frames; 905 int max_b_frames;
904 906
905 /** 907 /**
906 * qscale factor between ip and b frames. 908 * qscale factor between IP and B-frames
907 * - encoding: set by user. 909 * - encoding: Set by user.
908 * - decoding: unused 910 * - decoding: unused
909 */ 911 */
910 float b_quant_factor; 912 float b_quant_factor;
911 913
912 /** obsolete FIXME remove */ 914 /** obsolete FIXME remove */
914 #define FF_RC_STRATEGY_XVID 1 916 #define FF_RC_STRATEGY_XVID 1
915 917
916 int b_frame_strategy; 918 int b_frame_strategy;
917 919
918 /** 920 /**
919 * hurry up amount. 921 * hurry up amount
920 * - encoding: unused 922 * - encoding: unused
921 * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header 923 * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
922 * @deprecated Deprecated in favor of skip_idct and skip_frame. 924 * @deprecated Deprecated in favor of skip_idct and skip_frame.
923 */ 925 */
924 int hurry_up; 926 int hurry_up;
925 927
926 struct AVCodec *codec; 928 struct AVCodec *codec;
931 /* unused, FIXME remove*/ 933 /* unused, FIXME remove*/
932 int rtp_mode; 934 int rtp_mode;
933 #endif 935 #endif
934 936
935 int rtp_payload_size; /* The size of the RTP payload: the coder will */ 937 int rtp_payload_size; /* The size of the RTP payload: the coder will */
936 /* do it's best to deliver a chunk with size */ 938 /* do its best to deliver a chunk with size */
937 /* below rtp_payload_size, the chunk will start */ 939 /* below rtp_payload_size, the chunk will start */
938 /* with a start code on some codecs like H.263 */ 940 /* with a start code on some codecs like H.263. */
939 /* This doesn't take account of any particular */ 941 /* This doesn't take account of any particular */
940 /* headers inside the transmited RTP payload */ 942 /* headers inside the transmitted RTP payload. */
941 943
942 944
943 /* The RTP callback: This function is called */ 945 /* The RTP callback: This function is called */
944 /* every time the encoder has a packet to send */ 946 /* every time the encoder has a packet to send. */
945 /* Depends on the encoder if the data starts */ 947 /* It depends on the encoder if the data starts */
946 /* with a Start Code (it should) H.263 does. */ 948 /* with a Start Code (it should). H.263 does. */
947 /* mb_nb contains the number of macroblocks */ 949 /* mb_nb contains the number of macroblocks */
948 /* encoded in the RTP payload */ 950 /* encoded in the RTP payload. */
949 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); 951 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
950 952
951 /* statistics, used for 2-pass encoding */ 953 /* statistics, used for 2-pass encoding */
952 int mv_bits; 954 int mv_bits;
953 int header_bits; 955 int header_bits;
957 int p_count; 959 int p_count;
958 int skip_count; 960 int skip_count;
959 int misc_bits; 961 int misc_bits;
960 962
961 /** 963 /**
962 * number of bits used for the previously encoded frame. 964 * number of bits used for the previously encoded frame
963 * - encoding: set by lavc 965 * - encoding: Set by libavcodec.
964 * - decoding: unused 966 * - decoding: unused
965 */ 967 */
966 int frame_bits; 968 int frame_bits;
967 969
968 /** 970 /**
969 * private data of the user, can be used to carry app specific stuff. 971 * Private data of the user, can be used to carry app specific stuff.
970 * - encoding: set by user 972 * - encoding: Set by user.
971 * - decoding: set by user 973 * - decoding: Set by user.
972 */ 974 */
973 void *opaque; 975 void *opaque;
974 976
975 char codec_name[32]; 977 char codec_name[32];
976 enum CodecType codec_type; /* see CODEC_TYPE_xxx */ 978 enum CodecType codec_type; /* see CODEC_TYPE_xxx */
977 enum CodecID codec_id; /* see CODEC_ID_xxx */ 979 enum CodecID codec_id; /* see CODEC_ID_xxx */
978 980
979 /** 981 /**
980 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). 982 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
981 * this is used to workaround some encoder bugs 983 * This is used to work around some encoder bugs.
982 * a demuxer should set this to what is stored in the field used to identify the codec 984 * A demuxer should set this to what is stored in the field used to identify the codec.
983 * if there are mutiple such fields in a container then the demuxer should choose the one 985 * If there are multiple such fields in a container then the demuxer should choose the one
984 * which maximizes the information about the used codec 986 * which maximizes the information about the used codec.
985 * if the codec tag field in a container is larger then 32bit then the demxuer should 987 * If the codec tag field in a container is larger then 32 bits then the demuxer should
986 * remap the longer id to 32bit with a table or other structure alternatively a new 988 * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
987 * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated 989 * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
988 * first 990 * first.
989 * - encoding: set by user, if not then the default based on codec_id will be used 991 * - encoding: Set by user, if not then the default based on codec_id will be used.
990 * - decoding: set by user, will be converted to upper case by lavc during init 992 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
991 */ 993 */
992 unsigned int codec_tag; 994 unsigned int codec_tag;
993 995
994 /** 996 /**
995 * workaround bugs in encoders which sometimes cannot be detected automatically. 997 * Work around bugs in encoders which sometimes cannot be detected automatically.
996 * - encoding: set by user 998 * - encoding: Set by user
997 * - decoding: set by user 999 * - decoding: Set by user
998 */ 1000 */
999 int workaround_bugs; 1001 int workaround_bugs;
1000 #define FF_BUG_AUTODETECT 1 ///< autodetection 1002 #define FF_BUG_AUTODETECT 1 ///< autodetection
1001 #define FF_BUG_OLD_MSMPEG4 2 1003 #define FF_BUG_OLD_MSMPEG4 2
1002 #define FF_BUG_XVID_ILACE 4 1004 #define FF_BUG_XVID_ILACE 4
1003 #define FF_BUG_UMP4 8 1005 #define FF_BUG_UMP4 8
1004 #define FF_BUG_NO_PADDING 16 1006 #define FF_BUG_NO_PADDING 16
1005 #define FF_BUG_AMV 32 1007 #define FF_BUG_AMV 32
1006 #define FF_BUG_AC_VLC 0 ///< will be removed, libavcodec can now handle these non compliant files by default 1008 #define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
1007 #define FF_BUG_QPEL_CHROMA 64 1009 #define FF_BUG_QPEL_CHROMA 64
1008 #define FF_BUG_STD_QPEL 128 1010 #define FF_BUG_STD_QPEL 128
1009 #define FF_BUG_QPEL_CHROMA2 256 1011 #define FF_BUG_QPEL_CHROMA2 256
1010 #define FF_BUG_DIRECT_BLOCKSIZE 512 1012 #define FF_BUG_DIRECT_BLOCKSIZE 512
1011 #define FF_BUG_EDGE 1024 1013 #define FF_BUG_EDGE 1024
1012 #define FF_BUG_HPEL_CHROMA 2048 1014 #define FF_BUG_HPEL_CHROMA 2048
1013 #define FF_BUG_DC_CLIP 4096 1015 #define FF_BUG_DC_CLIP 4096
1014 #define FF_BUG_MS 8192 ///< workaround various bugs in microsofts broken decoders 1016 #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
1015 //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100% 1017 //#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
1016 1018
1017 /** 1019 /**
1018 * luma single coeff elimination threshold. 1020 * luma single coefficient elimination threshold
1019 * - encoding: set by user 1021 * - encoding: Set by user.
1020 * - decoding: unused 1022 * - decoding: unused
1021 */ 1023 */
1022 int luma_elim_threshold; 1024 int luma_elim_threshold;
1023 1025
1024 /** 1026 /**
1025 * chroma single coeff elimination threshold. 1027 * chroma single coeff elimination threshold
1026 * - encoding: set by user 1028 * - encoding: Set by user.
1027 * - decoding: unused 1029 * - decoding: unused
1028 */ 1030 */
1029 int chroma_elim_threshold; 1031 int chroma_elim_threshold;
1030 1032
1031 /** 1033 /**
1032 * strictly follow the std (MPEG4, ...). 1034 * strictly follow the standard (MPEG4, ...).
1033 * - encoding: set by user 1035 * - encoding: Set by user.
1034 * - decoding: unused 1036 * - decoding: unused
1035 */ 1037 */
1036 int strict_std_compliance; 1038 int strict_std_compliance;
1037 #define FF_COMPLIANCE_VERY_STRICT 2 ///< strictly conform to a older more strict version of the spec or reference software 1039 #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to a older more strict version of the spec or reference software.
1038 #define FF_COMPLIANCE_STRICT 1 ///< strictly conform to all the things in the spec no matter what consequences 1040 #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
1039 #define FF_COMPLIANCE_NORMAL 0 1041 #define FF_COMPLIANCE_NORMAL 0
1040 #define FF_COMPLIANCE_INOFFICIAL -1 ///< allow inofficial extensions 1042 #define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions.
1041 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< allow non standarized experimental things 1043 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
1042 1044
1043 /** 1045 /**
1044 * qscale offset between ip and b frames. 1046 * qscale offset between IP and B-frames
1045 * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) 1047 * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
1046 * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) 1048 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1047 * - encoding: set by user. 1049 * - encoding: Set by user.
1048 * - decoding: unused 1050 * - decoding: unused
1049 */ 1051 */
1050 float b_quant_offset; 1052 float b_quant_offset;
1051 1053
1052 /** 1054 /**
1053 * error resilience higher values will detect more errors but may missdetect 1055 * Error resilience; higher values will detect more errors but may
1054 * some more or less valid parts as errors. 1056 * misdetect some more or less valid parts as errors.
1055 * - encoding: unused 1057 * - encoding: unused
1056 * - decoding: set by user 1058 * - decoding: Set by user.
1057 */ 1059 */
1058 int error_resilience; 1060 int error_resilience;
1059 #define FF_ER_CAREFUL 1 1061 #define FF_ER_CAREFUL 1
1060 #define FF_ER_COMPLIANT 2 1062 #define FF_ER_COMPLIANT 2
1061 #define FF_ER_AGGRESSIVE 3 1063 #define FF_ER_AGGRESSIVE 3
1062 #define FF_ER_VERY_AGGRESSIVE 4 1064 #define FF_ER_VERY_AGGRESSIVE 4
1063 1065
1064 /** 1066 /**
1065 * called at the beginning of each frame to get a buffer for it. 1067 * Called at the beginning of each frame to get a buffer for it.
1066 * if pic.reference is set then the frame will be read later by lavc 1068 * If pic.reference is set then the frame will be read later by libavcodec.
1067 * avcodec_align_dimensions() should be used to find the required width and 1069 * avcodec_align_dimensions() should be used to find the required width and
1068 * height, as they normally need to be rounded up to the next multiple of 16 1070 * height, as they normally need to be rounded up to the next multiple of 16.
1069 * - encoding: unused 1071 * - encoding: unused
1070 * - decoding: set by lavc, user can override 1072 * - decoding: Set by libavcodec., user can override.
1071 */ 1073 */
1072 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); 1074 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
1073 1075
1074 /** 1076 /**
1075 * called to release buffers which where allocated with get_buffer. 1077 * Called to release buffers which where allocated with get_buffer.
1076 * a released buffer can be reused in get_buffer() 1078 * A released buffer can be reused in get_buffer().
1077 * pic.data[*] must be set to NULL 1079 * pic.data[*] must be set to NULL.
1078 * - encoding: unused 1080 * - encoding: unused
1079 * - decoding: set by lavc, user can override 1081 * - decoding: Set by libavcodec., user can override.
1080 */ 1082 */
1081 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); 1083 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
1082 1084
1083 /** 1085 /**
1084 * if 1 the stream has a 1 frame delay during decoding. 1086 * If 1 the stream has a 1 frame delay during decoding.
1085 * - encoding: set by lavc 1087 * - encoding: Set by libavcodec.
1086 * - decoding: set by lavc 1088 * - decoding: Set by libavcodec.
1087 */ 1089 */
1088 int has_b_frames; 1090 int has_b_frames;
1089 1091
1090 /** 1092 /**
1091 * number of bytes per packet if constant and known or 0 1093 * number of bytes per packet if constant and known or 0
1092 * used by some WAV based audio codecs 1094 * Used by some WAV based audio codecs.
1093 */ 1095 */
1094 int block_align; 1096 int block_align;
1095 1097
1096 int parse_only; /* - decoding only: if true, only parsing is done 1098 int parse_only; /* - decoding only: If true, only parsing is done
1097 (function avcodec_parse_frame()). The frame 1099 (function avcodec_parse_frame()). The frame
1098 data is returned. Only MPEG codecs support this now. */ 1100 data is returned. Only MPEG codecs support this now. */
1099 1101
1100 /** 1102 /**
1101 * 0-> h263 quant 1-> mpeg quant. 1103 * 0-> h263 quant 1-> mpeg quant
1102 * - encoding: set by user. 1104 * - encoding: Set by user.
1103 * - decoding: unused 1105 * - decoding: unused
1104 */ 1106 */
1105 int mpeg_quant; 1107 int mpeg_quant;
1106 1108
1107 /** 1109 /**
1108 * pass1 encoding statistics output buffer. 1110 * pass1 encoding statistics output buffer
1109 * - encoding: set by lavc 1111 * - encoding: Set by libavcodec.
1110 * - decoding: unused 1112 * - decoding: unused
1111 */ 1113 */
1112 char *stats_out; 1114 char *stats_out;
1113 1115
1114 /** 1116 /**
1115 * pass2 encoding statistics input buffer. 1117 * pass2 encoding statistics input buffer
1116 * concatenated stuff from stats_out of pass1 should be placed here 1118 * Concatenated stuff from stats_out of pass1 should be placed here.
1117 * - encoding: allocated/set/freed by user 1119 * - encoding: Allocated/set/freed by user.
1118 * - decoding: unused 1120 * - decoding: unused
1119 */ 1121 */
1120 char *stats_in; 1122 char *stats_in;
1121 1123
1122 /** 1124 /**
1123 * ratecontrol qmin qmax limiting method. 1125 * ratecontrol qmin qmax limiting method
1124 * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax 1126 * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
1125 * - encoding: set by user. 1127 * - encoding: Set by user.
1126 * - decoding: unused 1128 * - decoding: unused
1127 */ 1129 */
1128 float rc_qsquish; 1130 float rc_qsquish;
1129 1131
1130 float rc_qmod_amp; 1132 float rc_qmod_amp;
1131 int rc_qmod_freq; 1133 int rc_qmod_freq;
1132 1134
1133 /** 1135 /**
1134 * ratecontrol override, see RcOverride. 1136 * ratecontrol override, see RcOverride
1135 * - encoding: allocated/set/freed by user. 1137 * - encoding: Allocated/set/freed by user.
1136 * - decoding: unused 1138 * - decoding: unused
1137 */ 1139 */
1138 RcOverride *rc_override; 1140 RcOverride *rc_override;
1139 int rc_override_count; 1141 int rc_override_count;
1140 1142
1141 /** 1143 /**
1142 * rate control equation. 1144 * rate control equation
1143 * - encoding: set by user 1145 * - encoding: Set by user
1144 * - decoding: unused 1146 * - decoding: unused
1145 */ 1147 */
1146 char *rc_eq; 1148 char *rc_eq;
1147 1149
1148 /** 1150 /**
1149 * maximum bitrate. 1151 * maximum bitrate
1150 * - encoding: set by user. 1152 * - encoding: Set by user.
1151 * - decoding: unused 1153 * - decoding: unused
1152 */ 1154 */
1153 int rc_max_rate; 1155 int rc_max_rate;
1154 1156
1155 /** 1157 /**
1156 * minimum bitrate. 1158 * minimum bitrate
1157 * - encoding: set by user. 1159 * - encoding: Set by user.
1158 * - decoding: unused 1160 * - decoding: unused
1159 */ 1161 */
1160 int rc_min_rate; 1162 int rc_min_rate;
1161 1163
1162 /** 1164 /**
1163 * decoder bitstream buffer size. 1165 * decoder bitstream buffer size
1164 * - encoding: set by user. 1166 * - encoding: Set by user.
1165 * - decoding: unused 1167 * - decoding: unused
1166 */ 1168 */
1167 int rc_buffer_size; 1169 int rc_buffer_size;
1168 float rc_buffer_aggressivity; 1170 float rc_buffer_aggressivity;
1169 1171
1170 /** 1172 /**
1171 * qscale factor between p and i frames. 1173 * qscale factor between P and I-frames
1172 * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) 1174 * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
1173 * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) 1175 * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
1174 * - encoding: set by user. 1176 * - encoding: Set by user.
1175 * - decoding: unused 1177 * - decoding: unused
1176 */ 1178 */
1177 float i_quant_factor; 1179 float i_quant_factor;
1178 1180
1179 /** 1181 /**
1180 * qscale offset between p and i frames. 1182 * qscale offset between P and I-frames
1181 * - encoding: set by user. 1183 * - encoding: Set by user.
1182 * - decoding: unused 1184 * - decoding: unused
1183 */ 1185 */
1184 float i_quant_offset; 1186 float i_quant_offset;
1185 1187
1186 /** 1188 /**
1187 * initial complexity for pass1 ratecontrol. 1189 * initial complexity for pass1 ratecontrol
1188 * - encoding: set by user. 1190 * - encoding: Set by user.
1189 * - decoding: unused 1191 * - decoding: unused
1190 */ 1192 */
1191 float rc_initial_cplx; 1193 float rc_initial_cplx;
1192 1194
1193 /** 1195 /**
1194 * dct algorithm, see FF_DCT_* below. 1196 * DCT algorithm, see FF_DCT_* below
1195 * - encoding: set by user 1197 * - encoding: Set by user.
1196 * - decoding: unused 1198 * - decoding: unused
1197 */ 1199 */
1198 int dct_algo; 1200 int dct_algo;
1199 #define FF_DCT_AUTO 0 1201 #define FF_DCT_AUTO 0
1200 #define FF_DCT_FASTINT 1 1202 #define FF_DCT_FASTINT 1
1203 #define FF_DCT_MLIB 4 1205 #define FF_DCT_MLIB 4
1204 #define FF_DCT_ALTIVEC 5 1206 #define FF_DCT_ALTIVEC 5
1205 #define FF_DCT_FAAN 6 1207 #define FF_DCT_FAAN 6
1206 1208
1207 /** 1209 /**
1208 * luminance masking (0-> disabled). 1210 * luminance masking (0-> disabled)
1209 * - encoding: set by user 1211 * - encoding: Set by user.
1210 * - decoding: unused 1212 * - decoding: unused
1211 */ 1213 */
1212 float lumi_masking; 1214 float lumi_masking;
1213 1215
1214 /** 1216 /**
1215 * temporary complexity masking (0-> disabled). 1217 * temporary complexity masking (0-> disabled)
1216 * - encoding: set by user 1218 * - encoding: Set by user.
1217 * - decoding: unused 1219 * - decoding: unused
1218 */ 1220 */
1219 float temporal_cplx_masking; 1221 float temporal_cplx_masking;
1220 1222
1221 /** 1223 /**
1222 * spatial complexity masking (0-> disabled). 1224 * spatial complexity masking (0-> disabled)
1223 * - encoding: set by user 1225 * - encoding: Set by user.
1224 * - decoding: unused 1226 * - decoding: unused
1225 */ 1227 */
1226 float spatial_cplx_masking; 1228 float spatial_cplx_masking;
1227 1229
1228 /** 1230 /**
1229 * p block masking (0-> disabled). 1231 * p block masking (0-> disabled)
1230 * - encoding: set by user 1232 * - encoding: Set by user.
1231 * - decoding: unused 1233 * - decoding: unused
1232 */ 1234 */
1233 float p_masking; 1235 float p_masking;
1234 1236
1235 /** 1237 /**
1236 * darkness masking (0-> disabled). 1238 * darkness masking (0-> disabled)
1237 * - encoding: set by user 1239 * - encoding: Set by user.
1238 * - decoding: unused 1240 * - decoding: unused
1239 */ 1241 */
1240 float dark_masking; 1242 float dark_masking;
1241 1243
1242 1244
1243 /* for binary compatibility */ 1245 /* for binary compatibility */
1244 int unused; 1246 int unused;
1245 1247
1246 /** 1248 /**
1247 * idct algorithm, see FF_IDCT_* below. 1249 * IDCT algorithm, see FF_IDCT_* below.
1248 * - encoding: set by user 1250 * - encoding: Set by user.
1249 * - decoding: set by user 1251 * - decoding: Set by user.
1250 */ 1252 */
1251 int idct_algo; 1253 int idct_algo;
1252 #define FF_IDCT_AUTO 0 1254 #define FF_IDCT_AUTO 0
1253 #define FF_IDCT_INT 1 1255 #define FF_IDCT_INT 1
1254 #define FF_IDCT_SIMPLE 2 1256 #define FF_IDCT_SIMPLE 2
1267 #define FF_IDCT_CAVS 15 1269 #define FF_IDCT_CAVS 15
1268 #define FF_IDCT_SIMPLEARMV5TE 16 1270 #define FF_IDCT_SIMPLEARMV5TE 16
1269 #define FF_IDCT_SIMPLEARMV6 17 1271 #define FF_IDCT_SIMPLEARMV6 17
1270 1272
1271 /** 1273 /**
1272 * slice count. 1274 * slice count
1273 * - encoding: set by lavc 1275 * - encoding: Set by libavcodec.
1274 * - decoding: set by user (or 0) 1276 * - decoding: Set by user (or 0).
1275 */ 1277 */
1276 int slice_count; 1278 int slice_count;
1277 /** 1279 /**
1278 * slice offsets in the frame in bytes. 1280 * slice offsets in the frame in bytes
1279 * - encoding: set/allocated by lavc 1281 * - encoding: Set/allocated by libavcodec.
1280 * - decoding: set/allocated by user (or NULL) 1282 * - decoding: Set/allocated by user (or NULL).
1281 */ 1283 */
1282 int *slice_offset; 1284 int *slice_offset;
1283 1285
1284 /** 1286 /**
1285 * error concealment flags. 1287 * error concealment flags
1286 * - encoding: unused 1288 * - encoding: unused
1287 * - decoding: set by user 1289 * - decoding: Set by user.
1288 */ 1290 */
1289 int error_concealment; 1291 int error_concealment;
1290 #define FF_EC_GUESS_MVS 1 1292 #define FF_EC_GUESS_MVS 1
1291 #define FF_EC_DEBLOCK 2 1293 #define FF_EC_DEBLOCK 2
1292 1294
1293 /** 1295 /**
1294 * dsp_mask could be add used to disable unwanted CPU features 1296 * dsp_mask could be add used to disable unwanted CPU features
1295 * CPU features (i.e. MMX, SSE. ...) 1297 * CPU features (i.e. MMX, SSE. ...)
1296 * 1298 *
1297 * with FORCE flag you may instead enable given CPU features 1299 * With the FORCE flag you may instead enable given CPU features.
1298 * (Dangerous: usable in case of misdetection, improper usage however will 1300 * (Dangerous: Usable in case of misdetection, improper usage however will
1299 * result into program crash) 1301 * result into program crash.)
1300 */ 1302 */
1301 unsigned dsp_mask; 1303 unsigned dsp_mask;
1302 #define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */ 1304 #define FF_MM_FORCE 0x80000000 /* Force usage of selected flags (OR) */
1303 /* lower 16 bits - CPU features */ 1305 /* lower 16 bits - CPU features */
1304 #ifdef HAVE_MMX 1306 #ifdef HAVE_MMX
1305 #define FF_MM_MMX 0x0001 /* standard MMX */ 1307 #define FF_MM_MMX 0x0001 /* standard MMX */
1306 #define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */ 1308 #define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */
1307 #define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */ 1309 #define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
1313 #define FF_MM_IWMMXT 0x0100 /* XScale IWMMXT */ 1315 #define FF_MM_IWMMXT 0x0100 /* XScale IWMMXT */
1314 #endif /* HAVE_IWMMXT */ 1316 #endif /* HAVE_IWMMXT */
1315 1317
1316 /** 1318 /**
1317 * bits per sample/pixel from the demuxer (needed for huffyuv). 1319 * bits per sample/pixel from the demuxer (needed for huffyuv).
1318 * - encoding: set by lavc 1320 * - encoding: Set by libavcodec.
1319 * - decoding: set by user 1321 * - decoding: Set by user.
1320 */ 1322 */
1321 int bits_per_sample; 1323 int bits_per_sample;
1322 1324
1323 /** 1325 /**
1324 * prediction method (needed for huffyuv). 1326 * prediction method (needed for huffyuv)
1325 * - encoding: set by user 1327 * - encoding: Set by user.
1326 * - decoding: unused 1328 * - decoding: unused
1327 */ 1329 */
1328 int prediction_method; 1330 int prediction_method;
1329 #define FF_PRED_LEFT 0 1331 #define FF_PRED_LEFT 0
1330 #define FF_PRED_PLANE 1 1332 #define FF_PRED_PLANE 1
1331 #define FF_PRED_MEDIAN 2 1333 #define FF_PRED_MEDIAN 2
1332 1334
1333 /** 1335 /**
1334 * sample aspect ratio (0 if unknown). 1336 * sample aspect ratio (0 if unknown)
1335 * numerator and denominator must be relative prime and smaller then 256 for some video standards 1337 * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
1336 * - encoding: set by user. 1338 * - encoding: Set by user.
1337 * - decoding: set by lavc. 1339 * - decoding: Set by libavcodec.
1338 */ 1340 */
1339 AVRational sample_aspect_ratio; 1341 AVRational sample_aspect_ratio;
1340 1342
1341 /** 1343 /**
1342 * the picture in the bitstream. 1344 * the picture in the bitstream
1343 * - encoding: set by lavc 1345 * - encoding: Set by libavcodec.
1344 * - decoding: set by lavc 1346 * - decoding: Set by libavcodec.
1345 */ 1347 */
1346 AVFrame *coded_frame; 1348 AVFrame *coded_frame;
1347 1349
1348 /** 1350 /**
1349 * debug. 1351 * debug
1350 * - encoding: set by user. 1352 * - encoding: Set by user.
1351 * - decoding: set by user. 1353 * - decoding: Set by user.
1352 */ 1354 */
1353 int debug; 1355 int debug;
1354 #define FF_DEBUG_PICT_INFO 1 1356 #define FF_DEBUG_PICT_INFO 1
1355 #define FF_DEBUG_RC 2 1357 #define FF_DEBUG_RC 2
1356 #define FF_DEBUG_BITSTREAM 4 1358 #define FF_DEBUG_BITSTREAM 4
1366 #define FF_DEBUG_BUGS 0x00001000 1368 #define FF_DEBUG_BUGS 0x00001000
1367 #define FF_DEBUG_VIS_QP 0x00002000 1369 #define FF_DEBUG_VIS_QP 0x00002000
1368 #define FF_DEBUG_VIS_MB_TYPE 0x00004000 1370 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
1369 1371
1370 /** 1372 /**
1371 * debug. 1373 * debug
1372 * - encoding: set by user. 1374 * - encoding: Set by user.
1373 * - decoding: set by user. 1375 * - decoding: Set by user.
1374 */ 1376 */
1375 int debug_mv; 1377 int debug_mv;
1376 #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames 1378 #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
1377 #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames 1379 #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
1378 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames 1380 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
1379 1381
1380 /** 1382 /**
1381 * error. 1383 * error
1382 * - encoding: set by lavc if flags&CODEC_FLAG_PSNR 1384 * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
1383 * - decoding: unused 1385 * - decoding: unused
1384 */ 1386 */
1385 uint64_t error[4]; 1387 uint64_t error[4];
1386 1388
1387 /** 1389 /**
1388 * minimum MB quantizer. 1390 * minimum MB quantizer
1389 * - encoding: unused 1391 * - encoding: unused
1390 * - decoding: unused 1392 * - decoding: unused
1391 */ 1393 */
1392 int mb_qmin; 1394 int mb_qmin;
1393 1395
1394 /** 1396 /**
1395 * maximum MB quantizer. 1397 * maximum MB quantizer
1396 * - encoding: unused 1398 * - encoding: unused
1397 * - decoding: unused 1399 * - decoding: unused
1398 */ 1400 */
1399 int mb_qmax; 1401 int mb_qmax;
1400 1402
1401 /** 1403 /**
1402 * motion estimation compare function. 1404 * motion estimation comparison function
1403 * - encoding: set by user. 1405 * - encoding: Set by user.
1404 * - decoding: unused 1406 * - decoding: unused
1405 */ 1407 */
1406 int me_cmp; 1408 int me_cmp;
1407 /** 1409 /**
1408 * subpixel motion estimation compare function. 1410 * subpixel motion estimation comparison function
1409 * - encoding: set by user. 1411 * - encoding: Set by user.
1410 * - decoding: unused 1412 * - decoding: unused
1411 */ 1413 */
1412 int me_sub_cmp; 1414 int me_sub_cmp;
1413 /** 1415 /**
1414 * macroblock compare function (not supported yet). 1416 * macroblock comparison function (not supported yet)
1415 * - encoding: set by user. 1417 * - encoding: Set by user.
1416 * - decoding: unused 1418 * - decoding: unused
1417 */ 1419 */
1418 int mb_cmp; 1420 int mb_cmp;
1419 /** 1421 /**
1420 * interlaced dct compare function 1422 * interlaced DCT comparison function
1421 * - encoding: set by user. 1423 * - encoding: Set by user.
1422 * - decoding: unused 1424 * - decoding: unused
1423 */ 1425 */
1424 int ildct_cmp; 1426 int ildct_cmp;
1425 #define FF_CMP_SAD 0 1427 #define FF_CMP_SAD 0
1426 #define FF_CMP_SSE 1 1428 #define FF_CMP_SSE 1
1438 #define FF_CMP_DCTMAX 13 1440 #define FF_CMP_DCTMAX 13
1439 #define FF_CMP_DCT264 14 1441 #define FF_CMP_DCT264 14
1440 #define FF_CMP_CHROMA 256 1442 #define FF_CMP_CHROMA 256
1441 1443
1442 /** 1444 /**
1443 * ME diamond size & shape. 1445 * ME diamond size & shape
1444 * - encoding: set by user. 1446 * - encoding: Set by user.
1445 * - decoding: unused 1447 * - decoding: unused
1446 */ 1448 */
1447 int dia_size; 1449 int dia_size;
1448 1450
1449 /** 1451 /**
1450 * amount of previous MV predictors (2a+1 x 2a+1 square). 1452 * amount of previous MV predictors (2a+1 x 2a+1 square)
1451 * - encoding: set by user. 1453 * - encoding: Set by user.
1452 * - decoding: unused 1454 * - decoding: unused
1453 */ 1455 */
1454 int last_predictor_count; 1456 int last_predictor_count;
1455 1457
1456 /** 1458 /**
1457 * pre pass for motion estimation. 1459 * prepass for motion estimation
1458 * - encoding: set by user. 1460 * - encoding: Set by user.
1459 * - decoding: unused 1461 * - decoding: unused
1460 */ 1462 */
1461 int pre_me; 1463 int pre_me;
1462 1464
1463 /** 1465 /**
1464 * motion estimation pre pass compare function. 1466 * motion estimation prepass comparison function
1465 * - encoding: set by user. 1467 * - encoding: Set by user.
1466 * - decoding: unused 1468 * - decoding: unused
1467 */ 1469 */
1468 int me_pre_cmp; 1470 int me_pre_cmp;
1469 1471
1470 /** 1472 /**
1471 * ME pre pass diamond size & shape. 1473 * ME prepass diamond size & shape
1472 * - encoding: set by user. 1474 * - encoding: Set by user.
1473 * - decoding: unused 1475 * - decoding: unused
1474 */ 1476 */
1475 int pre_dia_size; 1477 int pre_dia_size;
1476 1478
1477 /** 1479 /**
1478 * subpel ME quality. 1480 * subpel ME quality
1479 * - encoding: set by user. 1481 * - encoding: Set by user.
1480 * - decoding: unused 1482 * - decoding: unused
1481 */ 1483 */
1482 int me_subpel_quality; 1484 int me_subpel_quality;
1483 1485
1484 /** 1486 /**
1485 * callback to negotiate the pixelFormat. 1487 * callback to negotiate the pixelFormat
1486 * @param fmt is the list of formats which are supported by the codec, 1488 * @param fmt is the list of formats which are supported by the codec,
1487 * its terminated by -1 as 0 is a valid format, the formats are ordered by quality 1489 * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
1488 * the first is allways the native one 1490 * The first is always the native one.
1489 * @return the choosen format 1491 * @return the chosen format
1490 * - encoding: unused 1492 * - encoding: unused
1491 * - decoding: set by user, if not set then the native format will always be choosen 1493 * - decoding: Set by user, if not set the native format will be chosen.
1492 */ 1494 */
1493 enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt); 1495 enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
1494 1496
1495 /** 1497 /**
1496 * DTG active format information (additionnal aspect ratio 1498 * DTG active format information (additional aspect ratio
1497 * information only used in DVB MPEG2 transport streams). 0 if 1499 * information only used in DVB MPEG-2 transport streams)
1498 * not set. 1500 * 0 if not set.
1499 * 1501 *
1500 * - encoding: unused. 1502 * - encoding: unused
1501 * - decoding: set by decoder 1503 * - decoding: Set by decoder.
1502 */ 1504 */
1503 int dtg_active_format; 1505 int dtg_active_format;
1504 #define FF_DTG_AFD_SAME 8 1506 #define FF_DTG_AFD_SAME 8
1505 #define FF_DTG_AFD_4_3 9 1507 #define FF_DTG_AFD_4_3 9
1506 #define FF_DTG_AFD_16_9 10 1508 #define FF_DTG_AFD_16_9 10
1508 #define FF_DTG_AFD_4_3_SP_14_9 13 1510 #define FF_DTG_AFD_4_3_SP_14_9 13
1509 #define FF_DTG_AFD_16_9_SP_14_9 14 1511 #define FF_DTG_AFD_16_9_SP_14_9 14
1510 #define FF_DTG_AFD_SP_4_3 15 1512 #define FF_DTG_AFD_SP_4_3 15
1511 1513
1512 /** 1514 /**
1513 * Maximum motion estimation search range in subpel units. 1515 * maximum motion estimation search range in subpel units
1514 * if 0 then no limit 1516 * If 0 then no limit.
1515 * 1517 *
1516 * - encoding: set by user. 1518 * - encoding: Set by user.
1517 * - decoding: unused. 1519 * - decoding: unused
1518 */ 1520 */
1519 int me_range; 1521 int me_range;
1520 1522
1521 /** 1523 /**
1522 * intra quantizer bias. 1524 * intra quantizer bias
1523 * - encoding: set by user. 1525 * - encoding: Set by user.
1524 * - decoding: unused 1526 * - decoding: unused
1525 */ 1527 */
1526 int intra_quant_bias; 1528 int intra_quant_bias;
1527 #define FF_DEFAULT_QUANT_BIAS 999999 1529 #define FF_DEFAULT_QUANT_BIAS 999999
1528 1530
1529 /** 1531 /**
1530 * inter quantizer bias. 1532 * inter quantizer bias
1531 * - encoding: set by user. 1533 * - encoding: Set by user.
1532 * - decoding: unused 1534 * - decoding: unused
1533 */ 1535 */
1534 int inter_quant_bias; 1536 int inter_quant_bias;
1535 1537
1536 /** 1538 /**
1537 * color table ID. 1539 * color table ID
1538 * - encoding: unused. 1540 * - encoding: unused
1539 * - decoding: which clrtable should be used for 8bit RGB images 1541 * - decoding: Which clrtable should be used for 8bit RGB images.
1540 * table have to be stored somewhere FIXME 1542 * Tables have to be stored somewhere. FIXME
1541 */ 1543 */
1542 int color_table_id; 1544 int color_table_id;
1543 1545
1544 /** 1546 /**
1545 * internal_buffer count. 1547 * internal_buffer count
1546 * Don't touch, used by lavc default_get_buffer() 1548 * Don't touch, used by libavcodec default_get_buffer().
1547 */ 1549 */
1548 int internal_buffer_count; 1550 int internal_buffer_count;
1549 1551
1550 /** 1552 /**
1551 * internal_buffers. 1553 * internal_buffers
1552 * Don't touch, used by lavc default_get_buffer() 1554 * Don't touch, used by libavcodec default_get_buffer().
1553 */ 1555 */
1554 void *internal_buffer; 1556 void *internal_buffer;
1555 1557
1556 #define FF_LAMBDA_SHIFT 7 1558 #define FF_LAMBDA_SHIFT 7
1557 #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT) 1559 #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
1558 #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda 1560 #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
1559 #define FF_LAMBDA_MAX (256*128-1) 1561 #define FF_LAMBDA_MAX (256*128-1)
1560 1562
1561 #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove 1563 #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
1562 /** 1564 /**
1563 * global quality for codecs which cannot change it per frame. 1565 * Global quality for codecs which cannot change it per frame.
1564 * this should be proportional to MPEG1/2/4 qscale. 1566 * This should be proportional to MPEG-1/2/4 qscale.
1565 * - encoding: set by user. 1567 * - encoding: Set by user.
1566 * - decoding: unused 1568 * - decoding: unused
1567 */ 1569 */
1568 int global_quality; 1570 int global_quality;
1569 1571
1570 #define FF_CODER_TYPE_VLC 0 1572 #define FF_CODER_TYPE_VLC 0
1572 #define FF_CODER_TYPE_RAW 2 1574 #define FF_CODER_TYPE_RAW 2
1573 #define FF_CODER_TYPE_RLE 3 1575 #define FF_CODER_TYPE_RLE 3
1574 #define FF_CODER_TYPE_DEFLATE 4 1576 #define FF_CODER_TYPE_DEFLATE 4
1575 /** 1577 /**
1576 * coder type 1578 * coder type
1577 * - encoding: set by user. 1579 * - encoding: Set by user.
1578 * - decoding: unused 1580 * - decoding: unused
1579 */ 1581 */
1580 int coder_type; 1582 int coder_type;
1581 1583
1582 /** 1584 /**
1583 * context model 1585 * context model
1584 * - encoding: set by user. 1586 * - encoding: Set by user.
1585 * - decoding: unused 1587 * - decoding: unused
1586 */ 1588 */
1587 int context_model; 1589 int context_model;
1588 #if 0 1590 #if 0
1589 /** 1591 /**
1590 * 1592 *
1591 * - encoding: unused 1593 * - encoding: unused
1592 * - decoding: set by user. 1594 * - decoding: Set by user.
1593 */ 1595 */
1594 uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size); 1596 uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
1595 #endif 1597 #endif
1596 1598
1597 /** 1599 /**
1598 * slice flags 1600 * slice flags
1599 * - encoding: unused 1601 * - encoding: unused
1600 * - decoding: set by user. 1602 * - decoding: Set by user.
1601 */ 1603 */
1602 int slice_flags; 1604 int slice_flags;
1603 #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display 1605 #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
1604 #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) 1606 #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
1605 #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) 1607 #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
1611 */ 1613 */
1612 int xvmc_acceleration; 1614 int xvmc_acceleration;
1613 1615
1614 /** 1616 /**
1615 * macroblock decision mode 1617 * macroblock decision mode
1616 * - encoding: set by user. 1618 * - encoding: Set by user.
1617 * - decoding: unused 1619 * - decoding: unused
1618 */ 1620 */
1619 int mb_decision; 1621 int mb_decision;
1620 #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp 1622 #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
1621 #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits 1623 #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
1622 #define FF_MB_DECISION_RD 2 ///< rate distoration 1624 #define FF_MB_DECISION_RD 2 ///< rate distoration
1623 1625
1624 /** 1626 /**
1625 * custom intra quantization matrix 1627 * custom intra quantization matrix
1626 * - encoding: set by user, can be NULL 1628 * - encoding: Set by user, can be NULL.
1627 * - decoding: set by lavc 1629 * - decoding: Set by libavcodec.
1628 */ 1630 */
1629 uint16_t *intra_matrix; 1631 uint16_t *intra_matrix;
1630 1632
1631 /** 1633 /**
1632 * custom inter quantization matrix 1634 * custom inter quantization matrix
1633 * - encoding: set by user, can be NULL 1635 * - encoding: Set by user, can be NULL.
1634 * - decoding: set by lavc 1636 * - decoding: Set by libavcodec.
1635 */ 1637 */
1636 uint16_t *inter_matrix; 1638 uint16_t *inter_matrix;
1637 1639
1638 /** 1640 /**
1639 * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). 1641 * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1640 * this is used to workaround some encoder bugs 1642 * This is used to work around some encoder bugs.
1641 * - encoding: unused 1643 * - encoding: unused
1642 * - decoding: set by user, will be converted to upper case by lavc during init 1644 * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
1643 */ 1645 */
1644 unsigned int stream_codec_tag; 1646 unsigned int stream_codec_tag;
1645 1647
1646 /** 1648 /**
1647 * scene change detection threshold. 1649 * scene change detection threshold
1648 * 0 is default, larger means fewer detected scene changes 1650 * 0 is default, larger means fewer detected scene changes.
1649 * - encoding: set by user. 1651 * - encoding: Set by user.
1650 * - decoding: unused 1652 * - decoding: unused
1651 */ 1653 */
1652 int scenechange_threshold; 1654 int scenechange_threshold;
1653 1655
1654 /** 1656 /**
1655 * minimum lagrange multipler 1657 * minimum Lagrange multipler
1656 * - encoding: set by user. 1658 * - encoding: Set by user.
1657 * - decoding: unused 1659 * - decoding: unused
1658 */ 1660 */
1659 int lmin; 1661 int lmin;
1660 1662
1661 /** 1663 /**
1662 * maximum lagrange multipler 1664 * maximum Lagrange multipler
1663 * - encoding: set by user. 1665 * - encoding: Set by user.
1664 * - decoding: unused 1666 * - decoding: unused
1665 */ 1667 */
1666 int lmax; 1668 int lmax;
1667 1669
1668 /** 1670 /**
1669 * Palette control structure 1671 * palette control structure
1670 * - encoding: ??? (no palette-enabled encoder yet) 1672 * - encoding: ??? (no palette-enabled encoder yet)
1671 * - decoding: set by user. 1673 * - decoding: Set by user.
1672 */ 1674 */
1673 struct AVPaletteControl *palctrl; 1675 struct AVPaletteControl *palctrl;
1674 1676
1675 /** 1677 /**
1676 * noise reduction strength 1678 * noise reduction strength
1677 * - encoding: set by user. 1679 * - encoding: Set by user.
1678 * - decoding: unused 1680 * - decoding: unused
1679 */ 1681 */
1680 int noise_reduction; 1682 int noise_reduction;
1681 1683
1682 /** 1684 /**
1683 * called at the beginning of a frame to get cr buffer for it. 1685 * Called at the beginning of a frame to get cr buffer for it.
1684 * buffer type (size, hints) must be the same. lavc won't check it. 1686 * Buffer type (size, hints) must be the same. libavcodec won't check it.
1685 * lavc will pass previous buffer in pic, function should return 1687 * libavcodec will pass previous buffer in pic, function should return
1686 * same buffer or new buffer with old frame "painted" into it. 1688 * same buffer or new buffer with old frame "painted" into it.
1687 * if pic.data[0] == NULL must behave like get_buffer(). 1689 * If pic.data[0] == NULL must behave like get_buffer().
1688 * - encoding: unused 1690 * - encoding: unused
1689 * - decoding: set by lavc, user can override 1691 * - decoding: Set by libavcodec., user can override
1690 */ 1692 */
1691 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); 1693 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
1692 1694
1693 /** 1695 /**
1694 * number of bits which should be loaded into the rc buffer before decoding starts 1696 * Number of bits which should be loaded into the rc buffer before decoding starts.
1695 * - encoding: set by user. 1697 * - encoding: Set by user.
1696 * - decoding: unused 1698 * - decoding: unused
1697 */ 1699 */
1698 int rc_initial_buffer_occupancy; 1700 int rc_initial_buffer_occupancy;
1699 1701
1700 /** 1702 /**
1701 * 1703 *
1702 * - encoding: set by user. 1704 * - encoding: Set by user.
1703 * - decoding: unused 1705 * - decoding: unused
1704 */ 1706 */
1705 int inter_threshold; 1707 int inter_threshold;
1706 1708
1707 /** 1709 /**
1708 * CODEC_FLAG2_*. 1710 * CODEC_FLAG2_*
1709 * - encoding: set by user. 1711 * - encoding: Set by user.
1710 * - decoding: set by user. 1712 * - decoding: Set by user.
1711 */ 1713 */
1712 int flags2; 1714 int flags2;
1713 1715
1714 /** 1716 /**
1715 * simulates errors in the bitstream to test error concealment. 1717 * Simulates errors in the bitstream to test error concealment.
1716 * - encoding: set by user. 1718 * - encoding: Set by user.
1717 * - decoding: unused. 1719 * - decoding: unused
1718 */ 1720 */
1719 int error_rate; 1721 int error_rate;
1720 1722
1721 /** 1723 /**
1722 * MP3 antialias algorithm, see FF_AA_* below. 1724 * MP3 antialias algorithm, see FF_AA_* below.
1723 * - encoding: unused 1725 * - encoding: unused
1724 * - decoding: set by user 1726 * - decoding: Set by user.
1725 */ 1727 */
1726 int antialias_algo; 1728 int antialias_algo;
1727 #define FF_AA_AUTO 0 1729 #define FF_AA_AUTO 0
1728 #define FF_AA_FASTINT 1 //not implemented yet 1730 #define FF_AA_FASTINT 1 //not implemented yet
1729 #define FF_AA_INT 2 1731 #define FF_AA_INT 2
1730 #define FF_AA_FLOAT 3 1732 #define FF_AA_FLOAT 3
1731 /** 1733 /**
1732 * Quantizer noise shaping. 1734 * quantizer noise shaping
1733 * - encoding: set by user 1735 * - encoding: Set by user.
1734 * - decoding: unused 1736 * - decoding: unused
1735 */ 1737 */
1736 int quantizer_noise_shaping; 1738 int quantizer_noise_shaping;
1737 1739
1738 /** 1740 /**
1739 * Thread count. 1741 * thread count
1740 * is used to decide how many independent tasks should be passed to execute() 1742 * is used to decide how many independent tasks should be passed to execute()
1741 * - encoding: set by user 1743 * - encoding: Set by user.
1742 * - decoding: set by user 1744 * - decoding: Set by user.
1743 */ 1745 */
1744 int thread_count; 1746 int thread_count;
1745 1747
1746 /** 1748 /**
1747 * the codec may call this to execute several independent things. it will return only after 1749 * The codec may call this to execute several independent things.
1748 * finishing all tasks, the user may replace this with some multithreaded implementation, the 1750 * It will return only after finishing all tasks.
1749 * default implementation will execute the parts serially 1751 * The user may replace this with some multithreaded implementation,
1752 * the default implementation will execute the parts serially.
1750 * @param count the number of things to execute 1753 * @param count the number of things to execute
1751 * - encoding: set by lavc, user can override 1754 * - encoding: Set by libavcodec, user can override.
1752 * - decoding: set by lavc, user can override 1755 * - decoding: Set by libavcodec, user can override.
1753 */ 1756 */
1754 int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count); 1757 int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count);
1755 1758
1756 /** 1759 /**
1757 * Thread opaque. 1760 * thread opaque
1758 * can be used by execute() to store some per AVCodecContext stuff. 1761 * Can be used by execute() to store some per AVCodecContext stuff.
1759 * - encoding: set by execute() 1762 * - encoding: set by execute()
1760 * - decoding: set by execute() 1763 * - decoding: set by execute()
1761 */ 1764 */
1762 void *thread_opaque; 1765 void *thread_opaque;
1763 1766
1764 /** 1767 /**
1765 * Motion estimation threshold. under which no motion estimation is 1768 * Motion estimation threshold below which no motion estimation is
1766 * performed, but instead the user specified motion vectors are used 1769 * performed, but instead the user specified motion vectors are used.
1767 * 1770 *
1768 * - encoding: set by user 1771 * - encoding: Set by user.
1769 * - decoding: unused 1772 * - decoding: unused
1770 */ 1773 */
1771 int me_threshold; 1774 int me_threshold;
1772 1775
1773 /** 1776 /**
1774 * Macroblock threshold. under which the user specified macroblock types will be used 1777 * Macroblock threshold below which the user specified macroblock types will be used.
1775 * - encoding: set by user 1778 * - encoding: Set by user.
1776 * - decoding: unused 1779 * - decoding: unused
1777 */ 1780 */
1778 int mb_threshold; 1781 int mb_threshold;
1779 1782
1780 /** 1783 /**
1781 * precision of the intra dc coefficient - 8. 1784 * precision of the intra DC coefficient - 8
1782 * - encoding: set by user 1785 * - encoding: Set by user.
1783 * - decoding: unused 1786 * - decoding: unused
1784 */ 1787 */
1785 int intra_dc_precision; 1788 int intra_dc_precision;
1786 1789
1787 /** 1790 /**
1788 * noise vs. sse weight for the nsse comparsion function. 1791 * noise vs. sse weight for the nsse comparsion function
1789 * - encoding: set by user 1792 * - encoding: Set by user.
1790 * - decoding: unused 1793 * - decoding: unused
1791 */ 1794 */
1792 int nsse_weight; 1795 int nsse_weight;
1793 1796
1794 /** 1797 /**
1795 * number of macroblock rows at the top which are skipped. 1798 * Number of macroblock rows at the top which are skipped.
1796 * - encoding: unused 1799 * - encoding: unused
1797 * - decoding: set by user 1800 * - decoding: Set by user.
1798 */ 1801 */
1799 int skip_top; 1802 int skip_top;
1800 1803
1801 /** 1804 /**
1802 * number of macroblock rows at the bottom which are skipped. 1805 * Number of macroblock rows at the bottom which are skipped.
1803 * - encoding: unused 1806 * - encoding: unused
1804 * - decoding: set by user 1807 * - decoding: Set by user.
1805 */ 1808 */
1806 int skip_bottom; 1809 int skip_bottom;
1807 1810
1808 /** 1811 /**
1809 * profile 1812 * profile
1810 * - encoding: set by user 1813 * - encoding: Set by user.
1811 * - decoding: set by lavc 1814 * - decoding: Set by libavcodec.
1812 */ 1815 */
1813 int profile; 1816 int profile;
1814 #define FF_PROFILE_UNKNOWN -99 1817 #define FF_PROFILE_UNKNOWN -99
1815 1818
1816 /** 1819 /**
1817 * level 1820 * level
1818 * - encoding: set by user 1821 * - encoding: Set by user.
1819 * - decoding: set by lavc 1822 * - decoding: Set by libavcodec.
1820 */ 1823 */
1821 int level; 1824 int level;
1822 #define FF_LEVEL_UNKNOWN -99 1825 #define FF_LEVEL_UNKNOWN -99
1823 1826
1824 /** 1827 /**
1825 * low resolution decoding. 1-> 1/2 size, 2->1/4 size 1828 * low resolution decoding, 1-> 1/2 size, 2->1/4 size
1826 * - encoding: unused 1829 * - encoding: unused
1827 * - decoding: set by user 1830 * - decoding: Set by user.
1828 */ 1831 */
1829 int lowres; 1832 int lowres;
1830 1833
1831 /** 1834 /**
1832 * bitsream width / height. may be different from width/height if lowres 1835 * Bitstream width / height, may be different from width/height if lowres
1833 * or other things are used 1836 * or other things are used.
1834 * - encoding: unused 1837 * - encoding: unused
1835 * - decoding: set by user before init if known, codec should override / dynamically change if needed 1838 * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
1836 */ 1839 */
1837 int coded_width, coded_height; 1840 int coded_width, coded_height;
1838 1841
1839 /** 1842 /**
1840 * frame skip threshold 1843 * frame skip threshold
1841 * - encoding: set by user 1844 * - encoding: Set by user.
1842 * - decoding: unused 1845 * - decoding: unused
1843 */ 1846 */
1844 int frame_skip_threshold; 1847 int frame_skip_threshold;
1845 1848
1846 /** 1849 /**
1847 * frame skip factor 1850 * frame skip factor
1848 * - encoding: set by user 1851 * - encoding: Set by user.
1849 * - decoding: unused 1852 * - decoding: unused
1850 */ 1853 */
1851 int frame_skip_factor; 1854 int frame_skip_factor;
1852 1855
1853 /** 1856 /**
1854 * frame skip exponent 1857 * frame skip exponent
1855 * - encoding: set by user 1858 * - encoding: Set by user.
1856 * - decoding: unused 1859 * - decoding: unused
1857 */ 1860 */
1858 int frame_skip_exp; 1861 int frame_skip_exp;
1859 1862
1860 /** 1863 /**
1861 * frame skip comparission function 1864 * frame skip comparison function
1862 * - encoding: set by user. 1865 * - encoding: Set by user.
1863 * - decoding: unused 1866 * - decoding: unused
1864 */ 1867 */
1865 int frame_skip_cmp; 1868 int frame_skip_cmp;
1866 1869
1867 /** 1870 /**
1868 * border processing masking. raises the quantizer for mbs on the borders 1871 * Border processing masking, raises the quantizer for mbs on the borders
1869 * of the picture. 1872 * of the picture.
1870 * - encoding: set by user 1873 * - encoding: Set by user.
1871 * - decoding: unused 1874 * - decoding: unused
1872 */ 1875 */
1873 float border_masking; 1876 float border_masking;
1874 1877
1875 /** 1878 /**
1876 * minimum MB lagrange multipler. 1879 * minimum MB lagrange multipler
1877 * - encoding: set by user. 1880 * - encoding: Set by user.
1878 * - decoding: unused 1881 * - decoding: unused
1879 */ 1882 */
1880 int mb_lmin; 1883 int mb_lmin;
1881 1884
1882 /** 1885 /**
1883 * maximum MB lagrange multipler. 1886 * maximum MB lagrange multipler
1884 * - encoding: set by user. 1887 * - encoding: Set by user.
1885 * - decoding: unused 1888 * - decoding: unused
1886 */ 1889 */
1887 int mb_lmax; 1890 int mb_lmax;
1888 1891
1889 /** 1892 /**
1890 * 1893 *
1891 * - encoding: set by user. 1894 * - encoding: Set by user.
1892 * - decoding: unused 1895 * - decoding: unused
1893 */ 1896 */
1894 int me_penalty_compensation; 1897 int me_penalty_compensation;
1895 1898
1896 /** 1899 /**
1897 * 1900 *
1898 * - encoding: unused 1901 * - encoding: unused
1899 * - decoding: set by user. 1902 * - decoding: Set by user.
1900 */ 1903 */
1901 enum AVDiscard skip_loop_filter; 1904 enum AVDiscard skip_loop_filter;
1902 1905
1903 /** 1906 /**
1904 * 1907 *
1905 * - encoding: unused 1908 * - encoding: unused
1906 * - decoding: set by user. 1909 * - decoding: Set by user.
1907 */ 1910 */
1908 enum AVDiscard skip_idct; 1911 enum AVDiscard skip_idct;
1909 1912
1910 /** 1913 /**
1911 * 1914 *
1912 * - encoding: unused 1915 * - encoding: unused
1913 * - decoding: set by user. 1916 * - decoding: Set by user.
1914 */ 1917 */
1915 enum AVDiscard skip_frame; 1918 enum AVDiscard skip_frame;
1916 1919
1917 /** 1920 /**
1918 * 1921 *
1919 * - encoding: set by user. 1922 * - encoding: Set by user.
1920 * - decoding: unused 1923 * - decoding: unused
1921 */ 1924 */
1922 int bidir_refine; 1925 int bidir_refine;
1923 1926
1924 /** 1927 /**
1925 * 1928 *
1926 * - encoding: set by user. 1929 * - encoding: Set by user.
1927 * - decoding: unused 1930 * - decoding: unused
1928 */ 1931 */
1929 int brd_scale; 1932 int brd_scale;
1930 1933
1931 /** 1934 /**
1932 * constant rate factor - quality-based VBR - values ~correspond to qps 1935 * constant rate factor - quality-based VBR - values ~correspond to qps
1933 * - encoding: set by user. 1936 * - encoding: Set by user.
1934 * - decoding: unused 1937 * - decoding: unused
1935 */ 1938 */
1936 float crf; 1939 float crf;
1937 1940
1938 /** 1941 /**
1939 * constant quantization parameter rate control method 1942 * constant quantization parameter rate control method
1940 * - encoding: set by user. 1943 * - encoding: Set by user.
1941 * - decoding: unused 1944 * - decoding: unused
1942 */ 1945 */
1943 int cqp; 1946 int cqp;
1944 1947
1945 /** 1948 /**
1946 * minimum gop size 1949 * minimum GOP size
1947 * - encoding: set by user. 1950 * - encoding: Set by user.
1948 * - decoding: unused 1951 * - decoding: unused
1949 */ 1952 */
1950 int keyint_min; 1953 int keyint_min;
1951 1954
1952 /** 1955 /**
1953 * number of reference frames 1956 * number of reference frames
1954 * - encoding: set by user. 1957 * - encoding: Set by user.
1955 * - decoding: unused 1958 * - decoding: unused
1956 */ 1959 */
1957 int refs; 1960 int refs;
1958 1961
1959 /** 1962 /**
1960 * chroma qp offset from luma 1963 * chroma qp offset from luma
1961 * - encoding: set by user. 1964 * - encoding: Set by user.
1962 * - decoding: unused 1965 * - decoding: unused
1963 */ 1966 */
1964 int chromaoffset; 1967 int chromaoffset;
1965 1968
1966 /** 1969 /**
1967 * influences how often b-frames are used 1970 * Influences how often B-frames are used.
1968 * - encoding: set by user. 1971 * - encoding: Set by user.
1969 * - decoding: unused 1972 * - decoding: unused
1970 */ 1973 */
1971 int bframebias; 1974 int bframebias;
1972 1975
1973 /** 1976 /**
1974 * trellis RD quantization 1977 * trellis RD quantization
1975 * - encoding: set by user. 1978 * - encoding: Set by user.
1976 * - decoding: unused 1979 * - decoding: unused
1977 */ 1980 */
1978 int trellis; 1981 int trellis;
1979 1982
1980 /** 1983 /**
1981 * reduce fluctuations in qp (before curve compression) 1984 * Reduce fluctuations in qp (before curve compression).
1982 * - encoding: set by user. 1985 * - encoding: Set by user.
1983 * - decoding: unused 1986 * - decoding: unused
1984 */ 1987 */
1985 float complexityblur; 1988 float complexityblur;
1986 1989
1987 /** 1990 /**
1988 * in-loop deblocking filter alphac0 parameter 1991 * in-loop deblocking filter alphac0 parameter
1989 * alpha is in the range -6...6 1992 * alpha is in the range -6...6
1990 * - encoding: set by user. 1993 * - encoding: Set by user.
1991 * - decoding: unused 1994 * - decoding: unused
1992 */ 1995 */
1993 int deblockalpha; 1996 int deblockalpha;
1994 1997
1995 /** 1998 /**
1996 * in-loop deblocking filter beta parameter 1999 * in-loop deblocking filter beta parameter
1997 * beta is in the range -6...6 2000 * beta is in the range -6...6
1998 * - encoding: set by user. 2001 * - encoding: Set by user.
1999 * - decoding: unused 2002 * - decoding: unused
2000 */ 2003 */
2001 int deblockbeta; 2004 int deblockbeta;
2002 2005
2003 /** 2006 /**
2004 * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 2007 * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4
2005 * - encoding: set by user. 2008 * - encoding: Set by user.
2006 * - decoding: unused 2009 * - decoding: unused
2007 */ 2010 */
2008 int partitions; 2011 int partitions;
2009 #define X264_PART_I4X4 0x001 /* Analyse i4x4 */ 2012 #define X264_PART_I4X4 0x001 /* Analyse i4x4 */
2010 #define X264_PART_I8X8 0x002 /* Analyse i8x8 (requires 8x8 transform) */ 2013 #define X264_PART_I8X8 0x002 /* Analyse i8x8 (requires 8x8 transform) */
2011 #define X264_PART_P8X8 0x010 /* Analyse p16x8, p8x16 and p8x8 */ 2014 #define X264_PART_P8X8 0x010 /* Analyse p16x8, p8x16 and p8x8 */
2012 #define X264_PART_P4X4 0x020 /* Analyse p8x4, p4x8, p4x4 */ 2015 #define X264_PART_P4X4 0x020 /* Analyse p8x4, p4x8, p4x4 */
2013 #define X264_PART_B8X8 0x100 /* Analyse b16x8, b8x16 and b8x8 */ 2016 #define X264_PART_B8X8 0x100 /* Analyse b16x8, b8x16 and b8x8 */
2014 2017
2015 /** 2018 /**
2016 * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) 2019 * direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal)
2017 * - encoding: set by user. 2020 * - encoding: Set by user.
2018 * - decoding: unused 2021 * - decoding: unused
2019 */ 2022 */
2020 int directpred; 2023 int directpred;
2021 2024
2022 /** 2025 /**
2023 * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC 2026 * Audio cutoff bandwidth (0 means "automatic"), currently used only by FAAC.
2024 * - encoding: set by user. 2027 * - encoding: Set by user.
2025 * - decoding: unused 2028 * - decoding: unused
2026 */ 2029 */
2027 int cutoff; 2030 int cutoff;
2028 2031
2029 /** 2032 /**
2030 * multiplied by qscale for each frame and added to scene_change_score 2033 * Multiplied by qscale for each frame and added to scene_change_score.
2031 * - encoding: set by user. 2034 * - encoding: Set by user.
2032 * - decoding: unused 2035 * - decoding: unused
2033 */ 2036 */
2034 int scenechange_factor; 2037 int scenechange_factor;
2035 2038
2036 /** 2039 /**
2037 * 2040 *
2038 * note: value depends upon the compare functin used for fullpel ME 2041 * Note: Value depends upon the compare function used for fullpel ME.
2039 * - encoding: set by user. 2042 * - encoding: Set by user.
2040 * - decoding: unused 2043 * - decoding: unused
2041 */ 2044 */
2042 int mv0_threshold; 2045 int mv0_threshold;
2043 2046
2044 /** 2047 /**
2045 * adjusts sensitivity of b_frame_strategy 1 2048 * Adjusts sensitivity of b_frame_strategy 1.
2046 * - encoding: set by user. 2049 * - encoding: Set by user.
2047 * - decoding: unused 2050 * - decoding: unused
2048 */ 2051 */
2049 int b_sensitivity; 2052 int b_sensitivity;
2050 2053
2051 /** 2054 /**
2052 * - encoding: set by user. 2055 * - encoding: Set by user.
2053 * - decoding: unused 2056 * - decoding: unused
2054 */ 2057 */
2055 int compression_level; 2058 int compression_level;
2056 #define FF_COMPRESSION_DEFAULT -1 2059 #define FF_COMPRESSION_DEFAULT -1
2057 2060
2058 /** 2061 /**
2059 * sets whether to use LPC mode - used by FLAC encoder 2062 * Sets whether to use LPC mode - used by FLAC encoder.
2060 * - encoding: set by user. 2063 * - encoding: Set by user.
2061 * - decoding: unused. 2064 * - decoding: unused
2062 */ 2065 */
2063 int use_lpc; 2066 int use_lpc;
2064 2067
2065 /** 2068 /**
2066 * LPC coefficient precision - used by FLAC encoder 2069 * LPC coefficient precision - used by FLAC encoder
2067 * - encoding: set by user. 2070 * - encoding: Set by user.
2068 * - decoding: unused. 2071 * - decoding: unused
2069 */ 2072 */
2070 int lpc_coeff_precision; 2073 int lpc_coeff_precision;
2071 2074
2072 /** 2075 /**
2073 * - encoding: set by user. 2076 * - encoding: Set by user.
2074 * - decoding: unused. 2077 * - decoding: unused
2075 */ 2078 */
2076 int min_prediction_order; 2079 int min_prediction_order;
2077 2080
2078 /** 2081 /**
2079 * - encoding: set by user. 2082 * - encoding: Set by user.
2080 * - decoding: unused. 2083 * - decoding: unused
2081 */ 2084 */
2082 int max_prediction_order; 2085 int max_prediction_order;
2083 2086
2084 /** 2087 /**
2085 * search method for selecting prediction order 2088 * search method for selecting prediction order
2086 * - encoding: set by user. 2089 * - encoding: Set by user.
2087 * - decoding: unused. 2090 * - decoding: unused
2088 */ 2091 */
2089 int prediction_order_method; 2092 int prediction_order_method;
2090 2093
2091 /** 2094 /**
2092 * - encoding: set by user. 2095 * - encoding: Set by user.
2093 * - decoding: unused. 2096 * - decoding: unused
2094 */ 2097 */
2095 int min_partition_order; 2098 int min_partition_order;
2096 2099
2097 /** 2100 /**
2098 * - encoding: set by user. 2101 * - encoding: Set by user.
2099 * - decoding: unused. 2102 * - decoding: unused
2100 */ 2103 */
2101 int max_partition_order; 2104 int max_partition_order;
2102 2105
2103 /** 2106 /**
2104 * GOP timecode frame start number, in non drop frame format 2107 * GOP timecode frame start number, in non drop frame format
2105 * - encoding: set by user. 2108 * - encoding: Set by user.
2106 * - decoding: unused. 2109 * - decoding: unused
2107 */ 2110 */
2108 int64_t timecode_frame_start; 2111 int64_t timecode_frame_start;
2109 } AVCodecContext; 2112 } AVCodecContext;
2110 2113
2111 /** 2114 /**
2139 2142
2140 /** 2143 /**
2141 * AVPaletteControl 2144 * AVPaletteControl
2142 * This structure defines a method for communicating palette changes 2145 * This structure defines a method for communicating palette changes
2143 * between and demuxer and a decoder. 2146 * between and demuxer and a decoder.
2144 * this is totally broken, palette changes should be sent as AVPackets 2147 * This is totally broken, palette changes should be sent as AVPackets.
2145 */ 2148 */
2146 #define AVPALETTE_SIZE 1024 2149 #define AVPALETTE_SIZE 1024
2147 #define AVPALETTE_COUNT 256 2150 #define AVPALETTE_COUNT 256
2148 typedef struct AVPaletteControl { 2151 typedef struct AVPaletteControl {
2149 2152
2150 /* demuxer sets this to 1 to indicate the palette has changed; 2153 /* Demuxer sets this to 1 to indicate the palette has changed;
2151 * decoder resets to 0 */ 2154 * decoder resets to 0. */
2152 int palette_changed; 2155 int palette_changed;
2153 2156
2154 /* 4-byte ARGB palette entries, stored in native byte order; note that 2157 /* 4-byte ARGB palette entries, stored in native byte order; note that
2155 * the individual palette components should be on a 8-bit scale; if 2158 * the individual palette components should be on a 8-bit scale; if
2156 * the palette data comes from a IBM VGA native format, the component 2159 * the palette data comes from an IBM VGA native format, the component
2157 * data is probably 6 bits in size and needs to be scaled */ 2160 * data is probably 6 bits in size and needs to be scaled. */
2158 unsigned int palette[AVPALETTE_COUNT]; 2161 unsigned int palette[AVPALETTE_COUNT];
2159 2162
2160 } AVPaletteControl attribute_deprecated; 2163 } AVPaletteControl attribute_deprecated;
2161 2164
2162 typedef struct AVSubtitleRect { 2165 typedef struct AVSubtitleRect {
2369 extern AVCodec xan_wc3_decoder; 2372 extern AVCodec xan_wc3_decoder;
2370 extern AVCodec xl_decoder; 2373 extern AVCodec xl_decoder;
2371 extern AVCodec zlib_decoder; 2374 extern AVCodec zlib_decoder;
2372 extern AVCodec zmbv_decoder; 2375 extern AVCodec zmbv_decoder;
2373 2376
2374 /* pcm codecs */ 2377 /* PCM codecs */
2375 #define PCM_CODEC(id, name) \ 2378 #define PCM_CODEC(id, name) \
2376 extern AVCodec name ## _decoder; \ 2379 extern AVCodec name ## _decoder; \
2377 extern AVCodec name ## _encoder 2380 extern AVCodec name ## _encoder
2378 2381
2379 PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw); 2382 PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
2392 PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be); 2395 PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be);
2393 PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le); 2396 PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le);
2394 PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be); 2397 PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be);
2395 PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le); 2398 PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le);
2396 2399
2397 /* adpcm codecs */ 2400 /* ADPCM codecs */
2398 2401
2399 PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm); 2402 PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm);
2400 PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx); 2403 PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx);
2401 PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct); 2404 PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct);
2402 PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea); 2405 PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea);
2474 #endif 2477 #endif
2475 2478
2476 /** 2479 /**
2477 * Allocate memory for a picture. Call avpicture_free to free it. 2480 * Allocate memory for a picture. Call avpicture_free to free it.
2478 * 2481 *
2479 * @param picture the picture to be filled in. 2482 * @param picture the picture to be filled in
2480 * @param pix_fmt the format of the picture. 2483 * @param pix_fmt the format of the picture
2481 * @param width the width of the picture. 2484 * @param width the width of the picture
2482 * @param height the height of the picture. 2485 * @param height the height of the picture
2483 * @return Zero if successful, a negative value if not. 2486 * @return zero if successful, a negative value if not
2484 */ 2487 */
2485 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height); 2488 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
2486 2489
2487 /** 2490 /**
2488 * Free a picture previously allocated by avpicture_alloc(). 2491 * Free a picture previously allocated by avpicture_alloc().
2489 * 2492 *
2490 * @param picture The AVPicture to be freed. 2493 * @param picture the AVPicture to be freed
2491 */ 2494 */
2492 void avpicture_free(AVPicture *picture); 2495 void avpicture_free(AVPicture *picture);
2493 2496
2494 /** 2497 /**
2495 * Fill in AVPicture's fields. 2498 * Fill in the AVPicture fields.
2496 * The fields of the given AVPicture are filled in by using the 'ptr' address 2499 * The fields of the given AVPicture are filled in by using the 'ptr' address
2497 * which points to the image data buffer. Depending on the specified picture 2500 * which points to the image data buffer. Depending on the specified picture
2498 * format, one or multiple image data pointers and line sizes will be set. 2501 * format, one or multiple image data pointers and line sizes will be set.
2499 * If a planar format is specified, several pointers will be set pointing to 2502 * If a planar format is specified, several pointers will be set pointing to
2500 * the different picture planes and the line sizes of the different planes 2503 * the different picture planes and the line sizes of the different planes
2501 * will be stored in the lines_sizes array. 2504 * will be stored in the lines_sizes array.
2502 * 2505 *
2503 * @param picture AVPicture who's fields are to be filled in 2506 * @param picture AVPicture whose fields are to be filled in
2504 * @param ptr Buffer which will contain or contains the actual image data 2507 * @param ptr Buffer which will contain or contains the actual image data
2505 * @param pix_fmt The format in which the picture data is stored 2508 * @param pix_fmt The format in which the picture data is stored.
2506 * @param width The width of the image in pixels 2509 * @param width the width of the image in pixels
2507 * @param height The height of the image in pixels 2510 * @param height the height of the image in pixels
2508 * @return Size of the image data in bytes. 2511 * @return size of the image data in bytes
2509 */ 2512 */
2510 int avpicture_fill(AVPicture *picture, uint8_t *ptr, 2513 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
2511 int pix_fmt, int width, int height); 2514 int pix_fmt, int width, int height);
2512 int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, 2515 int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
2513 unsigned char *dest, int dest_size); 2516 unsigned char *dest, int dest_size);
2514 2517
2515 /** 2518 /**
2516 * Calculate the size in bytes that a picture of the given width and height 2519 * Calculate the size in bytes that a picture of the given width and height
2517 * would occupy if stored in the given picture format. 2520 * would occupy if stored in the given picture format.
2518 * 2521 *
2519 * @param pix_fmt The given picture format 2522 * @param pix_fmt the given picture format
2520 * @param width The width of the image 2523 * @param width the width of the image
2521 * @param height The height of the image 2524 * @param height the height of the image
2522 * @return Image data size in bytes 2525 * @return Image data size in bytes
2523 */ 2526 */
2524 int avpicture_get_size(int pix_fmt, int width, int height); 2527 int avpicture_get_size(int pix_fmt, int width, int height);
2525 void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); 2528 void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
2526 const char *avcodec_get_pix_fmt_name(int pix_fmt); 2529 const char *avcodec_get_pix_fmt_name(int pix_fmt);
2542 * For example, when converting from RGB24 to GRAY, the color information will 2545 * For example, when converting from RGB24 to GRAY, the color information will
2543 * be lost. Similarly, other losses occur when converting from some formats to 2546 * be lost. Similarly, other losses occur when converting from some formats to
2544 * other formats. These losses can involve loss of chroma, but also loss of 2547 * other formats. These losses can involve loss of chroma, but also loss of
2545 * resolution, loss of color depth, loss due to the color space conversion, loss 2548 * resolution, loss of color depth, loss due to the color space conversion, loss
2546 * of the alpha bits or loss due to color quantization. 2549 * of the alpha bits or loss due to color quantization.
2547 * avcodec_get_fix_fmt_loss() informs you on the various types of losses which 2550 * avcodec_get_fix_fmt_loss() informs you about the various types of losses
2548 * will occur when converting from one pixel format to another. 2551 * which will occur when converting from one pixel format to another.
2549 * 2552 *
2550 * @param[in] dst_pix_fmt Destination pixel format. 2553 * @param[in] dst_pix_fmt destination pixel format
2551 * @param[in] src_pix_fmt Source pixel format. 2554 * @param[in] src_pix_fmt source pixel format
2552 * @param[in] has_alpha Whether the source pixel format alpha channel is used. 2555 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2553 * @return Combination of flags informing you what kind of losses will occur. 2556 * @return Combination of flags informing you what kind of losses will occur.
2554 */ 2557 */
2555 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, 2558 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
2556 int has_alpha); 2559 int has_alpha);
2559 * Finds the best pixel format to convert to given a certain source pixel 2562 * Finds the best pixel format to convert to given a certain source pixel
2560 * format. When converting from one pixel format to another, information loss 2563 * format. When converting from one pixel format to another, information loss
2561 * may occur. For example, when converting from RGB24 to GRAY, the color 2564 * may occur. For example, when converting from RGB24 to GRAY, the color
2562 * information will be lost. Similarly, other losses occur when converting from 2565 * information will be lost. Similarly, other losses occur when converting from
2563 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of 2566 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
2564 * the given pixel formats should be used to undergo the least amount of losses. 2567 * the given pixel formats should be used to suffer the least amount of loss.
2565 * The pixel formats from which it choses one, are determined by the 2568 * The pixel formats from which it chooses one, are determined by the
2566 * \p pix_fmt_mask parameter. 2569 * \p pix_fmt_mask parameter.
2567 * 2570 *
2568 * @code 2571 * @code
2569 * src_pix_fmt = PIX_FMT_YUV420P; 2572 * src_pix_fmt = PIX_FMT_YUV420P;
2570 * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24); 2573 * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
2571 * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); 2574 * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
2572 * @endcode 2575 * @endcode
2573 * 2576 *
2574 * @param[in] pix_fmt_mask Bitmask determining which pixel format to choose from. 2577 * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
2575 * @param[in] src_pix_fmt Source pixel format. 2578 * @param[in] src_pix_fmt source pixel format
2576 * @param[in] has_alpha Whether the source pixel format alpha channel is used. 2579 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2577 * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. 2580 * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
2578 * @return The best pixel format to convert to or -1 if none was found. 2581 * @return The best pixel format to convert to or -1 if none was found.
2579 */ 2582 */
2580 int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt, 2583 int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
2622 void register_avcodec(AVCodec *format); 2625 void register_avcodec(AVCodec *format);
2623 2626
2624 /** 2627 /**
2625 * Finds an encoder with a matching codec ID. 2628 * Finds an encoder with a matching codec ID.
2626 * 2629 *
2627 * @param id CodecID of the requested encoder. 2630 * @param id CodecID of the requested encoder
2628 * @return An encoder if one was found, NULL otherwise. 2631 * @return An encoder if one was found, NULL otherwise.
2629 */ 2632 */
2630 AVCodec *avcodec_find_encoder(enum CodecID id); 2633 AVCodec *avcodec_find_encoder(enum CodecID id);
2631 2634
2632 /** 2635 /**
2633 * Finds an encoder with the specified name. 2636 * Finds an encoder with the specified name.
2634 * 2637 *
2635 * @param name Name of the requested encoder. 2638 * @param name name of the requested encoder
2636 * @return An encoder if one was found, NULL otherwise. 2639 * @return An encoder if one was found, NULL otherwise.
2637 */ 2640 */
2638 AVCodec *avcodec_find_encoder_by_name(const char *name); 2641 AVCodec *avcodec_find_encoder_by_name(const char *name);
2639 2642
2640 /** 2643 /**
2641 * Finds a decoder with a matching codec ID. 2644 * Finds a decoder with a matching codec ID.
2642 * 2645 *
2643 * @param id CodecID of the requested decoder. 2646 * @param id CodecID of the requested decoder
2644 * @return A decoder if one was found, NULL otherwise. 2647 * @return A decoder if one was found, NULL otherwise.
2645 */ 2648 */
2646 AVCodec *avcodec_find_decoder(enum CodecID id); 2649 AVCodec *avcodec_find_decoder(enum CodecID id);
2647 2650
2648 /** 2651 /**
2649 * Finds an decoder with the specified name. 2652 * Finds an decoder with the specified name.
2650 * 2653 *
2651 * @param name Name of the requested decoder. 2654 * @param name name of the requested decoder
2652 * @return A decoder if one was found, NULL otherwise. 2655 * @return A decoder if one was found, NULL otherwise.
2653 */ 2656 */
2654 AVCodec *avcodec_find_decoder_by_name(const char *name); 2657 AVCodec *avcodec_find_decoder_by_name(const char *name);
2655 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); 2658 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
2656 2659
2722 * 2725 *
2723 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), 2726 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
2724 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for 2727 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
2725 * retrieving a codec. 2728 * retrieving a codec.
2726 * 2729 *
2727 * @warning This function is not thread save! 2730 * @warning This function is not thread safe!
2728 * 2731 *
2729 * @code 2732 * @code
2730 * codec = avcodec_find_decoder(CODEC_ID_H264); 2733 * codec = avcodec_find_decoder(CODEC_ID_H264);
2731 * if (!codec) 2734 * if (!codec)
2732 * exit(1); 2735 * exit(1);
2735 * 2738 *
2736 * if (avcodec_open(context, codec) < 0) 2739 * if (avcodec_open(context, codec) < 0)
2737 * exit(1); 2740 * exit(1);
2738 * @endcode 2741 * @endcode
2739 * 2742 *
2740 * @param avctx The context which will be setup to use the given codec. 2743 * @param avctx The context which will be set up to use the given codec.
2741 * @param codec The codec to use within the context. 2744 * @param codec The codec to use within the context.
2742 * @return Zero on success, a negative value on error. 2745 * @return zero on success, a negative value on error
2743 * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder 2746 * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder
2744 */ 2747 */
2745 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); 2748 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
2746 2749
2747 /** 2750 /**
2751 int *frame_size_ptr, 2754 int *frame_size_ptr,
2752 uint8_t *buf, int buf_size); 2755 uint8_t *buf, int buf_size);
2753 2756
2754 /** 2757 /**
2755 * Decodes an audio frame from \p buf into \p samples. 2758 * Decodes an audio frame from \p buf into \p samples.
2756 * The avcodec_decode_audio2() function decodes a frame of audio from the input 2759 * The avcodec_decode_audio2() function decodes an audio frame from the input
2757 * buffer \p buf of size \p buf_size. To decode it, it makes use of the 2760 * buffer \p buf of size \p buf_size. To decode it, it makes use of the
2758 * audiocodec which was coupled with \p avctx using avcodec_open(). The 2761 * audio codec which was coupled with \p avctx using avcodec_open(). The
2759 * resulting decoded frame is stored in output buffer \p samples. If no frame 2762 * resulting decoded frame is stored in output buffer \p samples. If no frame
2760 * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the 2763 * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the
2761 * decompressed frame size in \e bytes. 2764 * decompressed frame size in \e bytes.
2762 * 2765 *
2763 * @warning You \e must set \p frame_size_ptr to the allocated size of the 2766 * @warning You \e must set \p frame_size_ptr to the allocated size of the
2764 * output buffer before calling avcodec_decode_audio2(). 2767 * output buffer before calling avcodec_decode_audio2().
2768 *
2769 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than
2770 * the actual read bytes because some optimized bitstream readers read 32 or 64
2771 * bits at once and could read over the end.
2772 *
2773 * @warning The end of the input buffer \p buf should be set to 0 to ensure that
2774 * no overreading happens for damaged MPEG streams.
2775 *
2776 * @note You might have to align the input buffer \p buf and output buffer \p
2777 * samples. The alignment requirements depend on the CPU: On some CPUs it isn't
2778 * necessary at all, on others it won't work at all if not aligned and on others
2779 * it will work but it will have an impact on performance. In practice, the
2780 * bitstream should have 4 byte alignment at minimum and all sample data should
2781 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If
2782 * the linesize is not a multiple of 16 then there's no sense in aligning the
2783 * start of the buffer to 16.
2784 *
2785 * @param avctx the codec context
2786 * @param[out] samples the output buffer
2787 * @param[in,out] frame_size_ptr the output buffer size in bytes
2788 * @param[in] buf the input buffer
2789 * @param[in] buf_size the input buffer size in bytes
2790 * @return On error a negative value is returned, otherwise the number of bytes
2791 * used or zero if no frame could be decompressed.
2792 */
2793 int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
2794 int *frame_size_ptr,
2795 uint8_t *buf, int buf_size);
2796
2797 /**
2798 * Decodes a video frame from \p buf into \p picture.
2799 * The avcodec_decode_video() function decodes a video frame from the input
2800 * buffer \p buf of size \p buf_size. To decode it, it makes use of the
2801 * video codec which was coupled with \p avctx using avcodec_open(). The
2802 * resulting decoded frame is stored in \p picture.
2765 * 2803 *
2766 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than 2804 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than
2767 * the actual read bytes because some optimized bitstream readers read 32 or 64 2805 * the actual read bytes because some optimized bitstream readers read 32 or 64
2768 * bits at once and could read over the end. 2806 * bits at once and could read over the end.
2769 * 2807 *
2777 * bitstream should have 4 byte alignment at minimum and all sample data should 2815 * bitstream should have 4 byte alignment at minimum and all sample data should
2778 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If 2816 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If
2779 * the linesize is not a multiple of 16 then there's no sense in aligning the 2817 * the linesize is not a multiple of 16 then there's no sense in aligning the
2780 * start of the buffer to 16. 2818 * start of the buffer to 16.
2781 * 2819 *
2782 * @param avctx The codec context. 2820 * @param avctx the codec context
2783 * @param[out] samples The output buffer.
2784 * @param[in,out] frame_size_ptr The output buffer size in bytes.
2785 * @param[in] buf The input buffer.
2786 * @param[in] buf_size The input buffer size in bytes.
2787 * @return On error a negative value is returned, otherwise the number of bytes
2788 * used or zero if no frame could be decompressed.
2789 */
2790 int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
2791 int *frame_size_ptr,
2792 uint8_t *buf, int buf_size);
2793
2794 /**
2795 * Decodes a video frame from \p buf into \p picture.
2796 * The avcodec_decode_video() function decodes a frame of video from the input
2797 * buffer \p buf of size \p buf_size. To decode it, it makes use of the
2798 * videocodec which was coupled with \p avctx using avcodec_open(). The
2799 * resulting decoded frame is stored in \p picture.
2800 *
2801 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than
2802 * the actual read bytes because some optimized bitstream readers read 32 or 64
2803 * bits at once and could read over the end.
2804 *
2805 * @warning The end of the input buffer \p buf should be set to 0 to ensure that
2806 * no overreading happens for damaged MPEG streams.
2807 *
2808 * @note You might have to align the input buffer \p buf and output buffer \p
2809 * samples. The alignment requirements depend on the CPU: on some CPUs it isn't
2810 * necessary at all, on others it won't work at all if not aligned and on others
2811 * it will work but it will have an impact on performance. In practice, the
2812 * bitstream should have 4 byte alignment at minimum and all sample data should
2813 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If
2814 * the linesize is not a multiple of 16 then there's no sense in aligning the
2815 * start of the buffer to 16.
2816 *
2817 * @param avctx The codec context.
2818 * @param[out] picture The AVFrame in which the decoded video frame will be stored. 2821 * @param[out] picture The AVFrame in which the decoded video frame will be stored.
2819 * @param[in] buf The input buffer. 2822 * @param[in] buf the input buffer
2820 * @param[in] buf_size The size of the input buffer in bytes. 2823 * @param[in] buf_size the size of the input buffer in bytes
2821 * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is non zero. 2824 * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
2822 * @return On error a negative value is returned, otherwise the number of bytes 2825 * @return On error a negative value is returned, otherwise the number of bytes
2823 * used or zero if no frame could be decompressed. 2826 * used or zero if no frame could be decompressed.
2824 */ 2827 */
2825 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, 2828 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
2826 int *got_picture_ptr, 2829 int *got_picture_ptr,
2827 uint8_t *buf, int buf_size); 2830 uint8_t *buf, int buf_size);
2828 2831
2829 /* decode a subtitle message. return -1 if error, otherwise return the 2832 /* Decode a subtitle message. Return -1 if error, otherwise return the
2830 *number of bytes used. If no subtitle could be decompressed, 2833 * number of bytes used. If no subtitle could be decompressed,
2831 *got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ 2834 * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */
2832 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, 2835 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
2833 int *got_sub_ptr, 2836 int *got_sub_ptr,
2834 const uint8_t *buf, int buf_size); 2837 const uint8_t *buf, int buf_size);
2835 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, 2838 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
2836 int *data_size_ptr, 2839 int *data_size_ptr,
2837 uint8_t *buf, int buf_size); 2840 uint8_t *buf, int buf_size);
2838 2841
2839 /** 2842 /**
2840 * Encodes an audio frame from \p samples into \p buf. 2843 * Encodes an audio frame from \p samples into \p buf.
2841 * The avcodec_encode_audio() function encodes a frame of audio from the input 2844 * The avcodec_encode_audio() function encodes an audio frame from the input
2842 * buffer \p samples. To encode it, it makes use of the audiocodec which was 2845 * buffer \p samples. To encode it, it makes use of the audio codec which was
2843 * coupled with \p avctx using avcodec_open(). The resulting encoded frame is 2846 * coupled with \p avctx using avcodec_open(). The resulting encoded frame is
2844 * stored in output buffer \p buf. 2847 * stored in output buffer \p buf.
2845 * 2848 *
2846 * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. 2849 * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large.
2847 * 2850 *
2848 * @param avctx The codec context. 2851 * @param avctx the codec context
2849 * @param[out] buf The output buffer. 2852 * @param[out] buf the output buffer
2850 * @param[in] buf_size The output buffer size. 2853 * @param[in] buf_size the output buffer size
2851 * @param[in] samples The input buffer containing the samples. 2854 * @param[in] samples the input buffer containing the samples
2852 * @return On error a negative value is returned, on succes zero or the number 2855 * @return On error a negative value is returned, on succes zero or the number
2853 * of bytes used from the input buffer. 2856 * of bytes used from the input buffer.
2854 */ 2857 */
2855 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, 2858 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
2856 const short *samples); 2859 const short *samples);
2857 2860
2858 /** 2861 /**
2859 * Encodes a video frame from \p pict into \p buf. 2862 * Encodes a video frame from \p pict into \p buf.
2860 * The avcodec_encode_video() function encodes a frame of video from the input 2863 * The avcodec_encode_video() function encodes a video frame from the input
2861 * \p pict. To encode it, it makes use of the videocodec which was coupled with 2864 * \p pict. To encode it, it makes use of the video codec which was coupled with
2862 * \p avctx using avcodec_open(). The resulting encoded bytes representing the 2865 * \p avctx using avcodec_open(). The resulting encoded bytes representing the
2863 * frame are stored in the output buffer \p buf. The input picture should be 2866 * frame are stored in the output buffer \p buf. The input picture should be
2864 * stored using a specific format, namely \c avctx.pix_fmt. 2867 * stored using a specific format, namely \c avctx.pix_fmt.
2865 * 2868 *
2866 * @param avctx The codec context. 2869 * @param avctx the codec context
2867 * @param[out] buf The output buffer for the bitstream of encoded frame. 2870 * @param[out] buf the output buffer for the bitstream of encoded frame
2868 * @param[in] buf_size The size of the outputbuffer in bytes. 2871 * @param[in] buf_size the size of the output buffer in bytes
2869 * @param[in] pict The input picture to encode. 2872 * @param[in] pict the input picture to encode
2870 * @return On error a negative value is returned, on success zero or the number 2873 * @return On error a negative value is returned, on success zero or the number
2871 * of bytes used from the input buffer. 2874 * of bytes used from the input buffer.
2872 */ 2875 */
2873 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 2876 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
2874 const AVFrame *pict); 2877 const AVFrame *pict);
2889 /* misc useful functions */ 2892 /* misc useful functions */
2890 2893
2891 /** 2894 /**
2892 * Returns a single letter to describe the given picture type \p pict_type. 2895 * Returns a single letter to describe the given picture type \p pict_type.
2893 * 2896 *
2894 * @param[in] pict_type The picture type. 2897 * @param[in] pict_type the picture type
2895 * @return A single character representing the picture type. 2898 * @return A single character representing the picture type.
2896 */ 2899 */
2897 char av_get_pict_type_char(int pict_type); 2900 char av_get_pict_type_char(int pict_type);
2898 2901
2899 /** 2902 /**
2900 * Returns codec bits per sample. 2903 * Returns codec bits per sample.
2901 * 2904 *
2902 * @param[in] codec_id The codec. 2905 * @param[in] codec_id the codec
2903 * @return Number of bits per sample or zero if unknown for the given codec. 2906 * @return Number of bits per sample or zero if unknown for the given codec.
2904 */ 2907 */
2905 int av_get_bits_per_sample(enum CodecID codec_id); 2908 int av_get_bits_per_sample(enum CodecID codec_id);
2906 2909
2907 /* frame parsing */ 2910 /* frame parsing */
2911 int64_t frame_offset; /* offset of the current frame */ 2914 int64_t frame_offset; /* offset of the current frame */
2912 int64_t cur_offset; /* current offset 2915 int64_t cur_offset; /* current offset
2913 (incremented by each av_parser_parse()) */ 2916 (incremented by each av_parser_parse()) */
2914 int64_t last_frame_offset; /* offset of the last frame */ 2917 int64_t last_frame_offset; /* offset of the last frame */
2915 /* video info */ 2918 /* video info */
2916 int pict_type; /* XXX: put it back in AVCodecContext */ 2919 int pict_type; /* XXX: Put it back in AVCodecContext. */
2917 int repeat_pict; /* XXX: put it back in AVCodecContext */ 2920 int repeat_pict; /* XXX: Put it back in AVCodecContext. */
2918 int64_t pts; /* pts of the current frame */ 2921 int64_t pts; /* pts of the current frame */
2919 int64_t dts; /* dts of the current frame */ 2922 int64_t dts; /* dts of the current frame */
2920 2923
2921 /* private data */ 2924 /* private data */
2922 int64_t last_pts; 2925 int64_t last_pts;
3026 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); 3029 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
3027 3030
3028 /* for static data only */ 3031 /* for static data only */
3029 3032
3030 /** 3033 /**
3031 * Frees all static arrays and reset their pointers to 0. 3034 * Frees all static arrays and resets their pointers to 0.
3032 * Call this function to release all statically allocated tables. 3035 * Call this function to release all statically allocated tables.
3033 */ 3036 */
3034 attribute_deprecated void av_free_static(void); 3037 attribute_deprecated void av_free_static(void);
3035 3038
3036 /** 3039 /**
3037 * Allocation of static arrays. 3040 * Allocation of static arrays.
3038 * 3041 *
3039 * @warning Do not use for normal allocation. 3042 * @warning Do not use for normal allocation.
3040 * 3043 *
3041 * @param[in] size The amount of memory you need in bytes. 3044 * @param[in] size The amount of memory you need in bytes.
3042 * @return Block of memory of the requested size. 3045 * @return block of memory of the requested size
3043 */ 3046 */
3044 attribute_deprecated void *av_mallocz_static(unsigned int size); 3047 attribute_deprecated void *av_mallocz_static(unsigned int size);
3045 3048
3046 /** 3049 /**
3047 * Copy image 'src' to 'dst'. 3050 * Copy image 'src' to 'dst'.
3048 */ 3051 */
3049 void av_picture_copy(AVPicture *dst, const AVPicture *src, 3052 void av_picture_copy(AVPicture *dst, const AVPicture *src,
3050 int pix_fmt, int width, int height); 3053 int pix_fmt, int width, int height);
3051 3054
3052 /** 3055 /**
3053 * Crop image top and left side 3056 * Crop image top and left side.
3054 */ 3057 */
3055 int av_picture_crop(AVPicture *dst, const AVPicture *src, 3058 int av_picture_crop(AVPicture *dst, const AVPicture *src,
3056 int pix_fmt, int top_band, int left_band); 3059 int pix_fmt, int top_band, int left_band);
3057 3060
3058 /** 3061 /**
3059 * Pad image 3062 * Pad image.
3060 */ 3063 */
3061 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, 3064 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
3062 int padtop, int padbottom, int padleft, int padright, int *color); 3065 int padtop, int padbottom, int padleft, int padright, int *color);
3063 3066
3064 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) 3067 #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
3074 3077
3075 extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v); 3078 extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
3076 3079
3077 /* error handling */ 3080 /* error handling */
3078 #if EINVAL > 0 3081 #if EINVAL > 0
3079 #define AVERROR(e) (-(e)) /**< returns a negative error code from a POSIX error code, to return from library functions. */ 3082 #define AVERROR(e) (-(e)) /**< Returns a negative error code from a POSIX error code, to return from library functions. */
3080 #define AVUNERROR(e) (-(e)) /**< returns a POSIX error code from a library function error return value. */ 3083 #define AVUNERROR(e) (-(e)) /**< Returns a POSIX error code from a library function error return value. */
3081 #else 3084 #else
3082 /* some platforms have E* and errno already negated. */ 3085 /* Some platforms have E* and errno already negated. */
3083 #define AVERROR(e) (e) 3086 #define AVERROR(e) (e)
3084 #define AVUNERROR(e) (e) 3087 #define AVUNERROR(e) (e)
3085 #endif 3088 #endif
3086 #define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */ 3089 #define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */
3087 #define AVERROR_IO AVERROR(EIO) /**< i/o error */ 3090 #define AVERROR_IO AVERROR(EIO) /**< I/O error */
3088 #define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< number syntax expected in filename */ 3091 #define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< Number syntax expected in filename. */
3089 #define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */ 3092 #define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */
3090 #define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */ 3093 #define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */
3091 #define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */ 3094 #define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */
3092 #define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< operation not supported */ 3095 #define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< Operation not supported. */
3093 3096
3094 #ifdef __cplusplus 3097 #ifdef __cplusplus
3095 } 3098 }
3096 #endif 3099 #endif
3097 3100