interlaced motion estimation
[libav.git] / libavcodec / avcodec.h
1 #ifndef AVCODEC_H
2 #define AVCODEC_H
3
4 /**
5 * @file avcodec.h
6 * external api header.
7 */
8
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 #include "common.h"
15 #include "rational.h"
16 #include <sys/types.h> /* size_t */
17
18 #define FFMPEG_VERSION_INT 0x000408
19 #define FFMPEG_VERSION "0.4.8"
20 #define LIBAVCODEC_BUILD 4698
21
22 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
23 #define LIBAVCODEC_VERSION FFMPEG_VERSION
24
25 #define AV_STRINGIFY(s) AV_TOSTRING(s)
26 #define AV_TOSTRING(s) #s
27 #define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
28
29 enum CodecID {
30 CODEC_ID_NONE,
31 CODEC_ID_MPEG1VIDEO,
32 CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */
33 CODEC_ID_MPEG2VIDEO_XVMC,
34 CODEC_ID_H263,
35 CODEC_ID_RV10,
36 CODEC_ID_RV20,
37 CODEC_ID_MP2,
38 CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */
39 CODEC_ID_VORBIS,
40 CODEC_ID_AC3,
41 CODEC_ID_MJPEG,
42 CODEC_ID_MJPEGB,
43 CODEC_ID_LJPEG,
44 CODEC_ID_SP5X,
45 CODEC_ID_MPEG4,
46 CODEC_ID_RAWVIDEO,
47 CODEC_ID_MSMPEG4V1,
48 CODEC_ID_MSMPEG4V2,
49 CODEC_ID_MSMPEG4V3,
50 CODEC_ID_WMV1,
51 CODEC_ID_WMV2,
52 CODEC_ID_H263P,
53 CODEC_ID_H263I,
54 CODEC_ID_FLV1,
55 CODEC_ID_SVQ1,
56 CODEC_ID_SVQ3,
57 CODEC_ID_DVVIDEO,
58 CODEC_ID_DVAUDIO,
59 CODEC_ID_WMAV1,
60 CODEC_ID_WMAV2,
61 CODEC_ID_MACE3,
62 CODEC_ID_MACE6,
63 CODEC_ID_HUFFYUV,
64 CODEC_ID_CYUV,
65 CODEC_ID_H264,
66 CODEC_ID_INDEO3,
67 CODEC_ID_VP3,
68 CODEC_ID_THEORA,
69 CODEC_ID_AAC,
70 CODEC_ID_MPEG4AAC,
71 CODEC_ID_ASV1,
72 CODEC_ID_ASV2,
73 CODEC_ID_FFV1,
74 CODEC_ID_4XM,
75 CODEC_ID_VCR1,
76 CODEC_ID_CLJR,
77 CODEC_ID_MDEC,
78 CODEC_ID_ROQ,
79 CODEC_ID_INTERPLAY_VIDEO,
80 CODEC_ID_XAN_WC3,
81 CODEC_ID_XAN_WC4,
82 CODEC_ID_RPZA,
83 CODEC_ID_CINEPAK,
84 CODEC_ID_WS_VQA,
85 CODEC_ID_MSRLE,
86 CODEC_ID_MSVIDEO1,
87 CODEC_ID_IDCIN,
88 CODEC_ID_8BPS,
89 CODEC_ID_SMC,
90 CODEC_ID_FLIC,
91 CODEC_ID_TRUEMOTION1,
92
93 /* various pcm "codecs" */
94 CODEC_ID_PCM_S16LE,
95 CODEC_ID_PCM_S16BE,
96 CODEC_ID_PCM_U16LE,
97 CODEC_ID_PCM_U16BE,
98 CODEC_ID_PCM_S8,
99 CODEC_ID_PCM_U8,
100 CODEC_ID_PCM_MULAW,
101 CODEC_ID_PCM_ALAW,
102
103 /* various adpcm codecs */
104 CODEC_ID_ADPCM_IMA_QT,
105 CODEC_ID_ADPCM_IMA_WAV,
106 CODEC_ID_ADPCM_IMA_DK3,
107 CODEC_ID_ADPCM_IMA_DK4,
108 CODEC_ID_ADPCM_IMA_WS,
109 CODEC_ID_ADPCM_MS,
110 CODEC_ID_ADPCM_4XM,
111 CODEC_ID_ADPCM_XA,
112 CODEC_ID_ADPCM_ADX,
113
114 /* AMR */
115 CODEC_ID_AMR_NB,
116 CODEC_ID_AMR_WB,
117
118 /* RealAudio codecs*/
119 CODEC_ID_RA_144,
120 CODEC_ID_RA_288,
121
122 /* various DPCM codecs */
123 CODEC_ID_ROQ_DPCM,
124 CODEC_ID_INTERPLAY_DPCM,
125 CODEC_ID_XAN_DPCM,
126
127 CODEC_ID_MPEG2TS, /* _FAKE_ codec to indicate a raw MPEG2 transport
128 stream (only used by libavformat) */
129 };
130
131 /* CODEC_ID_MP3LAME is absolete */
132 #define CODEC_ID_MP3LAME CODEC_ID_MP3
133
134 enum CodecType {
135 CODEC_TYPE_UNKNOWN = -1,
136 CODEC_TYPE_VIDEO,
137 CODEC_TYPE_AUDIO,
138 CODEC_TYPE_DATA,
139 };
140
141 /**
142 * Pixel format. Notes:
143 *
144 * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
145 * color is put together as:
146 * (A << 24) | (R << 16) | (G << 8) | B
147 * This is stored as BGRA on little endian CPU architectures and ARGB on
148 * big endian CPUs.
149 *
150 * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
151 * image data is stored in AVFrame.data[0]. The palette is transported in
152 * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
153 * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
154 * also endian-specific). Note also that the individual RGB palette
155 * components stored in AVFrame.data[1] should be in the range 0..255.
156 * This is important as many custom PAL8 video codecs that were designed
157 * to run on the IBM VGA graphics adapter use 6-bit palette components.
158 */
159 enum PixelFormat {
160 PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
161 PIX_FMT_YUV422,
162 PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
163 PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
164 PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
165 PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
166 PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
167 PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
168 PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
169 PIX_FMT_RGB565, ///< always stored in cpu endianness
170 PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1
171 PIX_FMT_GRAY8,
172 PIX_FMT_MONOWHITE, ///< 0 is white
173 PIX_FMT_MONOBLACK, ///< 0 is black
174 PIX_FMT_PAL8, ///< 8 bit with RGBA palette
175 PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg)
176 PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg)
177 PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg)
178 PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
179 PIX_FMT_XVMC_MPEG2_IDCT,
180 PIX_FMT_NB,
181 };
182
183 /* currently unused, may be used if 24/32 bits samples ever supported */
184 enum SampleFormat {
185 SAMPLE_FMT_S16 = 0, ///< signed 16 bits
186 };
187
188 /* in bytes */
189 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072
190
191 /**
192 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
193 * this is mainly needed because some optimized bitstream readers read
194 * 32 or 64 bit at once and could read over the end<br>
195 * Note, if the first 23 bits of the additional bytes are not 0 then damaged
196 * MPEG bitstreams could cause overread and segfault
197 */
198 #define FF_INPUT_BUFFER_PADDING_SIZE 8
199
200 /* motion estimation type, EPZS by default */
201 enum Motion_Est_ID {
202 ME_ZERO = 1,
203 ME_FULL,
204 ME_LOG,
205 ME_PHODS,
206 ME_EPZS,
207 ME_X1
208 };
209
210 typedef struct RcOverride{
211 int start_frame;
212 int end_frame;
213 int qscale; // if this is 0 then quality_factor will be used instead
214 float quality_factor;
215 } RcOverride;
216
217 /* only for ME compatiblity with old apps */
218 extern int motion_estimation_method;
219
220 /* ME algos sorted by quality */
221 //FIXME remove IMHO
222 static const __attribute__((unused)) int Motion_Est_QTab[] =
223 { ME_ZERO, ME_PHODS, ME_LOG, ME_X1, ME_EPZS, ME_FULL };
224
225
226 #define FF_MAX_B_FRAMES 8
227
228 /* encoding support
229 these flags can be passed in AVCodecContext.flags before initing
230 Note: note not everything is supported yet
231 */
232
233 #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale
234 #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / Advanced prediction for H263
235 #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC
236 #define CODEC_FLAG_GMC 0x0020 ///< use GMC
237 #define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0>
238 #define CODEC_FLAG_PART 0x0080 ///< use data partitioning
239 /* parent program gurantees that the input for b-frame containing streams is not written to
240 for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
241 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
242 #define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode
243 #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode
244 #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg)
245 #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale
246 #define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges
247 #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding
248 #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead
249 of only at frame boundaries */
250 #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization
251 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct
252 #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay
253 #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan
254 #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization
255 #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe
256 #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct)
257 /* Fx : Flag for h263+ extra options */
258 #define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this)
259 #define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction
260 #define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector
261 #define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp
262 #define CODEC_FLAG_QP_RD 0x08000000 ///< use rate distortion optimization for qp selectioon
263 #define CODEC_FLAG_H263P_AIV 0x00000008 ///< H263 Alternative inter vlc
264 #define CODEC_FLAG_OBMC 0x00000001 ///< OBMC
265 #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
266 #define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
267 #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
268 /* Unsupported options :
269 * Syntax Arithmetic coding (SAC)
270 * Reference Picture Selection
271 * Independant Segment Decoding */
272 /* /Fx */
273 /* codec capabilities */
274
275 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback
276 /**
277 * Codec uses get_buffer() for allocating buffers.
278 * direct rendering method 1
279 */
280 #define CODEC_CAP_DR1 0x0002
281 /* if 'parse_only' field is true, then avcodec_parse_frame() can be
282 used */
283 #define CODEC_CAP_PARSE_ONLY 0x0004
284 #define CODEC_CAP_TRUNCATED 0x0008
285
286 //the following defines might change, so dont expect compatibility if u use them
287 #define MB_TYPE_INTRA4x4 0x0001
288 #define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific
289 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME h264 specific
290 #define MB_TYPE_16x16 0x0008
291 #define MB_TYPE_16x8 0x0010
292 #define MB_TYPE_8x16 0x0020
293 #define MB_TYPE_8x8 0x0040
294 #define MB_TYPE_INTERLACED 0x0080
295 #define MB_TYPE_DIRECT2 0x0100 //FIXME
296 #define MB_TYPE_ACPRED 0x0200
297 #define MB_TYPE_GMC 0x0400
298 #define MB_TYPE_SKIP 0x0800
299 #define MB_TYPE_P0L0 0x1000
300 #define MB_TYPE_P1L0 0x2000
301 #define MB_TYPE_P0L1 0x4000
302 #define MB_TYPE_P1L1 0x8000
303 #define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
304 #define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
305 #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
306 #define MB_TYPE_QUANT 0x00010000
307 #define MB_TYPE_CBP 0x00020000
308 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
309
310 /**
311 * Pan Scan area.
312 * this specifies the area which should be displayed. Note there may be multiple such areas for one frame
313 */
314 typedef struct AVPanScan{
315 /**
316 * id.
317 * - encoding: set by user.
318 * - decoding: set by lavc
319 */
320 int id;
321
322 /**
323 * width and height in 1/16 pel
324 * - encoding: set by user.
325 * - decoding: set by lavc
326 */
327 int width;
328 int height;
329
330 /**
331 * position of the top left corner in 1/16 pel for up to 3 fields/frames.
332 * - encoding: set by user.
333 * - decoding: set by lavc
334 */
335 int16_t position[3][2];
336 }AVPanScan;
337
338 #define FF_COMMON_FRAME \
339 /**\
340 * pointer to the picture planes.\
341 * this might be different from the first allocated byte\
342 * - encoding: \
343 * - decoding: \
344 */\
345 uint8_t *data[4];\
346 int linesize[4];\
347 /**\
348 * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
349 * this isnt used by lavc unless the default get/release_buffer() is used\
350 * - encoding: \
351 * - decoding: \
352 */\
353 uint8_t *base[4];\
354 /**\
355 * 1 -> keyframe, 0-> not\
356 * - encoding: set by lavc\
357 * - decoding: set by lavc\
358 */\
359 int key_frame;\
360 \
361 /**\
362 * picture type of the frame, see ?_TYPE below.\
363 * - encoding: set by lavc for coded_picture (and set by user for input)\
364 * - decoding: set by lavc\
365 */\
366 int pict_type;\
367 \
368 /**\
369 * presentation timestamp in micro seconds (time when frame should be shown to user)\
370 * if 0 then the frame_rate will be used as reference\
371 * - encoding: MUST be set by user\
372 * - decoding: set by lavc\
373 */\
374 int64_t pts;\
375 \
376 /**\
377 * picture number in bitstream order.\
378 * - encoding: set by\
379 * - decoding: set by lavc\
380 */\
381 int coded_picture_number;\
382 /**\
383 * picture number in display order.\
384 * - encoding: set by\
385 * - decoding: set by lavc\
386 */\
387 int display_picture_number;\
388 \
389 /**\
390 * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \
391 * - encoding: set by lavc for coded_picture (and set by user for input)\
392 * - decoding: set by lavc\
393 */\
394 int quality; \
395 \
396 /**\
397 * buffer age (1->was last buffer and dint change, 2->..., ...).\
398 * set to INT_MAX if the buffer has not been used yet \
399 * - encoding: unused\
400 * - decoding: MUST be set by get_buffer()\
401 */\
402 int age;\
403 \
404 /**\
405 * is this picture used as reference\
406 * - encoding: unused\
407 * - decoding: set by lavc (before get_buffer() call))\
408 */\
409 int reference;\
410 \
411 /**\
412 * QP table\
413 * - encoding: unused\
414 * - decoding: set by lavc\
415 */\
416 int8_t *qscale_table;\
417 /**\
418 * QP store stride\
419 * - encoding: unused\
420 * - decoding: set by lavc\
421 */\
422 int qstride;\
423 \
424 /**\
425 * mbskip_table[mb]>=1 if MB didnt change\
426 * stride= mb_width = (width+15)>>4\
427 * - encoding: unused\
428 * - decoding: set by lavc\
429 */\
430 uint8_t *mbskip_table;\
431 \
432 /**\
433 * Motion vector table\
434 * - encoding: unused\
435 * - decoding: set by lavc\
436 */\
437 int16_t (*motion_val[2])[2];\
438 \
439 /**\
440 * Macroblock type table\
441 * mb_type_base + mb_width + 2\
442 * - encoding: unused\
443 * - decoding: set by lavc\
444 */\
445 uint32_t *mb_type;\
446 \
447 /**\
448 * Macroblock size: (0->16x16, 1->8x8, 2-> 4x4, 3-> 2x2)\
449 * - encoding: unused\
450 * - decoding: set by lavc\
451 */\
452 uint8_t motion_subsample_log2;\
453 \
454 /**\
455 * for some private data of the user\
456 * - encoding: unused\
457 * - decoding: set by user\
458 */\
459 void *opaque;\
460 \
461 /**\
462 * error\
463 * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\
464 * - decoding: unused\
465 */\
466 uint64_t error[4];\
467 \
468 /**\
469 * type of the buffer (to keep track of who has to dealloc data[*])\
470 * - encoding: set by the one who allocs it\
471 * - decoding: set by the one who allocs it\
472 * Note: user allocated (direct rendering) & internal buffers can not coexist currently\
473 */\
474 int type;\
475 \
476 /**\
477 * when decoding, this signal how much the picture must be delayed.\
478 * extra_delay = repeat_pict / (2*fps)\
479 * - encoding: unused\
480 * - decoding: set by lavc\
481 */\
482 int repeat_pict;\
483 \
484 /**\
485 * \
486 */\
487 int qscale_type;\
488 \
489 /**\
490 * The content of the picture is interlaced.\
491 * - encoding: set by user\
492 * - decoding: set by lavc (default 0)\
493 */\
494 int interlaced_frame;\
495 \
496 /**\
497 * if the content is interlaced, is top field displayed first.\
498 * - encoding: set by user\
499 * - decoding: set by lavc\
500 */\
501 int top_field_first;\
502 \
503 /**\
504 * Pan scan.\
505 * - encoding: set by user\
506 * - decoding: set by lavc\
507 */\
508 AVPanScan *pan_scan;\
509 \
510 /**\
511 * tell user application that palette has changed from previous frame.\
512 * - encoding: ??? (no palette-enabled encoder yet)\
513 * - decoding: set by lavc (default 0)\
514 */\
515 int palette_has_changed;\
516 \
517 /**\
518 * Codec suggestion on buffer type if != 0\
519 * - encoding: unused\
520 * - decoding: set by lavc (before get_buffer() call))\
521 */\
522 int buffer_hints;\
523
524 #define FF_QSCALE_TYPE_MPEG1 0
525 #define FF_QSCALE_TYPE_MPEG2 1
526
527 #define FF_BUFFER_TYPE_INTERNAL 1
528 #define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user)
529 #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewher else, dont dealloc image (data/base)
530 #define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, dont dealloc anything
531
532
533 #define FF_I_TYPE 1 // Intra
534 #define FF_P_TYPE 2 // Predicted
535 #define FF_B_TYPE 3 // Bi-dir predicted
536 #define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
537 #define FF_SI_TYPE 5
538 #define FF_SP_TYPE 6
539
540 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore)
541 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer
542 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content
543 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update)
544
545 /**
546 * Audio Video Frame.
547 */
548 typedef struct AVFrame {
549 FF_COMMON_FRAME
550 } AVFrame;
551
552 #define DEFAULT_FRAME_RATE_BASE 1001000
553
554 /**
555 * main external api structure.
556 */
557 typedef struct AVCodecContext {
558 /**
559 * the average bitrate.
560 * - encoding: set by user. unused for constant quantizer encoding
561 * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream
562 */
563 int bit_rate;
564
565 /**
566 * number of bits the bitstream is allowed to diverge from the reference.
567 * the reference can be CBR (for CBR pass1) or VBR (for pass2)
568 * - encoding: set by user. unused for constant quantizer encoding
569 * - decoding: unused
570 */
571 int bit_rate_tolerance;
572
573 /**
574 * CODEC_FLAG_*.
575 * - encoding: set by user.
576 * - decoding: set by user.
577 */
578 int flags;
579
580 /**
581 * some codecs needs additionnal format info. It is stored here
582 * - encoding: set by user.
583 * - decoding: set by lavc. (FIXME is this ok?)
584 */
585 int sub_id;
586
587 /**
588 * motion estimation algorithm used for video coding.
589 * - encoding: MUST be set by user.
590 * - decoding: unused
591 */
592 int me_method;
593
594 /**
595 * some codecs need / can use extra-data like huffman tables.
596 * mjpeg: huffman tables
597 * rv10: additional flags
598 * mpeg4: global headers (they can be in the bitstream or here)
599 * - encoding: set/allocated/freed by lavc.
600 * - decoding: set/allocated/freed by user.
601 */
602 void *extradata;
603 int extradata_size;
604
605 /* video only */
606 /**
607 * frames per sec multiplied by frame_rate_base.
608 * for variable fps this is the precission, so if the timestamps
609 * can be specified in msec precssion then this is 1000*frame_rate_base
610 * - encoding: MUST be set by user
611 * - decoding: set by lavc. 0 or the frame_rate if available
612 */
613 int frame_rate;
614
615 /**
616 * width / height.
617 * - encoding: MUST be set by user.
618 * - decoding: set by user if known, codec should override / dynamically change if needed
619 */
620 int width, height;
621
622 #define FF_ASPECT_SQUARE 1
623 #define FF_ASPECT_4_3_625 2
624 #define FF_ASPECT_4_3_525 3
625 #define FF_ASPECT_16_9_625 4
626 #define FF_ASPECT_16_9_525 5
627 #define FF_ASPECT_EXTENDED 15
628
629 /**
630 * the number of pictures in a group of pitures, or 0 for intra_only.
631 * - encoding: set by user.
632 * - decoding: unused
633 */
634 int gop_size;
635
636 /**
637 * pixel format, see PIX_FMT_xxx.
638 * - encoding: FIXME: used by ffmpeg to decide whether an pix_fmt
639 * conversion is in order. This only works for
640 * codecs with one supported pix_fmt, we should
641 * do something for a generic case as well.
642 * - decoding: set by lavc.
643 */
644 enum PixelFormat pix_fmt;
645
646 /**
647 * Frame rate emulation. If not zero lower layer (i.e. format handler)
648 * has to read frames at native frame rate.
649 * - encoding: set by user.
650 * - decoding: unused.
651 */
652 int rate_emu;
653
654 /**
655 * if non NULL, 'draw_horiz_band' is called by the libavcodec
656 * decoder to draw an horizontal band. It improve cache usage. Not
657 * all codecs can do that. You must check the codec capabilities
658 * before
659 * - encoding: unused
660 * - decoding: set by user.
661 * @param height the height of the slice
662 * @param y the y position of the slice
663 * @param type 1->top field, 2->bottom field, 3->frame
664 * @param offset offset into the AVFrame.data from which the slice should be read
665 */
666 void (*draw_horiz_band)(struct AVCodecContext *s,
667 const AVFrame *src, int offset[4],
668 int y, int type, int height);
669
670 /* audio only */
671 int sample_rate; ///< samples per sec
672 int channels;
673 int sample_fmt; ///< sample format, currenly unused
674
675 /* the following data should not be initialized */
676 int frame_size; ///< in samples, initialized when calling 'init'
677 int frame_number; ///< audio or video frame number
678 int real_pict_num; ///< returns the real picture number of previous encoded frame
679
680 /**
681 * number of frames the decoded output will be delayed relative to
682 * the encoded input.
683 * - encoding: set by lavc.
684 * - decoding: unused
685 */
686 int delay;
687
688 /* - encoding parameters */
689 float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
690 float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
691
692 /**
693 * minimum quantizer.
694 * - encoding: set by user.
695 * - decoding: unused
696 */
697 int qmin;
698
699 /**
700 * maximum quantizer.
701 * - encoding: set by user.
702 * - decoding: unused
703 */
704 int qmax;
705
706 /**
707 * maximum quantizer difference etween frames.
708 * - encoding: set by user.
709 * - decoding: unused
710 */
711 int max_qdiff;
712
713 /**
714 * maximum number of b frames between non b frames.
715 * note: the output will be delayed by max_b_frames+1 relative to the input
716 * - encoding: set by user.
717 * - decoding: unused
718 */
719 int max_b_frames;
720
721 /**
722 * qscale factor between ip and b frames.
723 * - encoding: set by user.
724 * - decoding: unused
725 */
726 float b_quant_factor;
727
728 /** obsolete FIXME remove */
729 int rc_strategy;
730 int b_frame_strategy;
731
732 /**
733 * hurry up amount.
734 * - encoding: unused
735 * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
736 */
737 int hurry_up;
738
739 struct AVCodec *codec;
740
741 void *priv_data;
742
743 /* unused, FIXME remove*/
744 int rtp_mode;
745
746 int rtp_payload_size; /* The size of the RTP payload, the coder will */
747 /* do it's best to deliver a chunk with size */
748 /* below rtp_payload_size, the chunk will start */
749 /* with a start code on some codecs like H.263 */
750 /* This doesn't take account of any particular */
751 /* headers inside the transmited RTP payload */
752
753
754 /* The RTP callcack: This function is called */
755 /* every time the encoder as a packet to send */
756 /* Depends on the encoder if the data starts */
757 /* with a Start Code (it should) H.263 does */
758 void (*rtp_callback)(void *data, int size, int packet_number);
759
760 /* statistics, used for 2-pass encoding */
761 int mv_bits;
762 int header_bits;
763 int i_tex_bits;
764 int p_tex_bits;
765 int i_count;
766 int p_count;
767 int skip_count;
768 int misc_bits;
769
770 /**
771 * number of bits used for the previously encoded frame.
772 * - encoding: set by lavc
773 * - decoding: unused
774 */
775 int frame_bits;
776
777 /**
778 * private data of the user, can be used to carry app specific stuff.
779 * - encoding: set by user
780 * - decoding: set by user
781 */
782 void *opaque;
783
784 char codec_name[32];
785 enum CodecType codec_type; /* see CODEC_TYPE_xxx */
786 enum CodecID codec_id; /* see CODEC_ID_xxx */
787
788 /**
789 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
790 * this is used to workaround some encoder bugs
791 * - encoding: set by user, if not then the default based on codec_id will be used
792 * - decoding: set by user, will be converted to upper case by lavc during init
793 */
794 unsigned int codec_tag;
795
796 /**
797 * workaround bugs in encoders which sometimes cannot be detected automatically.
798 * - encoding: unused
799 * - decoding: set by user
800 */
801 int workaround_bugs;
802 #define FF_BUG_AUTODETECT 1 ///< autodetection
803 #define FF_BUG_OLD_MSMPEG4 2
804 #define FF_BUG_XVID_ILACE 4
805 #define FF_BUG_UMP4 8
806 #define FF_BUG_NO_PADDING 16
807 #define FF_BUG_AC_VLC 0 ///< will be removed, libavcodec can now handle these non compliant files by default
808 #define FF_BUG_QPEL_CHROMA 64
809 #define FF_BUG_STD_QPEL 128
810 #define FF_BUG_QPEL_CHROMA2 256
811 #define FF_BUG_DIRECT_BLOCKSIZE 512
812 #define FF_BUG_EDGE 1024
813 //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
814
815 /**
816 * luma single coeff elimination threshold.
817 * - encoding: set by user
818 * - decoding: unused
819 */
820 int luma_elim_threshold;
821
822 /**
823 * chroma single coeff elimination threshold.
824 * - encoding: set by user
825 * - decoding: unused
826 */
827 int chroma_elim_threshold;
828
829 /**
830 * strictly follow the std (MPEG4, ...).
831 * - encoding: set by user
832 * - decoding: unused
833 */
834 int strict_std_compliance;
835
836 /**
837 * qscale offset between ip and b frames.
838 * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
839 * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
840 * - encoding: set by user.
841 * - decoding: unused
842 */
843 float b_quant_offset;
844
845 /**
846 * error resilience higher values will detect more errors but may missdetect
847 * some more or less valid parts as errors.
848 * - encoding: unused
849 * - decoding: set by user
850 */
851 int error_resilience;
852 #define FF_ER_CAREFULL 1
853 #define FF_ER_COMPLIANT 2
854 #define FF_ER_AGGRESSIVE 3
855 #define FF_ER_VERY_AGGRESSIVE 4
856
857 /**
858 * called at the beginning of each frame to get a buffer for it.
859 * if pic.reference is set then the frame will be read later by lavc
860 * width and height should be rounded up to the next multiple of 16
861 * - encoding: unused
862 * - decoding: set by lavc, user can override
863 */
864 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
865
866 /**
867 * called to release buffers which where allocated with get_buffer.
868 * a released buffer can be reused in get_buffer()
869 * pic.data[*] must be set to NULL
870 * - encoding: unused
871 * - decoding: set by lavc, user can override
872 */
873 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
874
875 /**
876 * is 1 if the decoded stream contains b frames, 0 otherwise.
877 * - encoding: unused
878 * - decoding: set by lavc
879 */
880 int has_b_frames;
881
882 int block_align; ///< used by some WAV based audio codecs
883
884 int parse_only; /* - decoding only: if true, only parsing is done
885 (function avcodec_parse_frame()). The frame
886 data is returned. Only MPEG codecs support this now. */
887
888 /**
889 * 0-> h263 quant 1-> mpeg quant.
890 * - encoding: set by user.
891 * - decoding: unused
892 */
893 int mpeg_quant;
894
895 /**
896 * pass1 encoding statistics output buffer.
897 * - encoding: set by lavc
898 * - decoding: unused
899 */
900 char *stats_out;
901
902 /**
903 * pass2 encoding statistics input buffer.
904 * concatenated stuff from stats_out of pass1 should be placed here
905 * - encoding: allocated/set/freed by user
906 * - decoding: unused
907 */
908 char *stats_in;
909
910 /**
911 * ratecontrol qmin qmax limiting method.
912 * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax
913 * - encoding: set by user.
914 * - decoding: unused
915 */
916 float rc_qsquish;
917
918 float rc_qmod_amp;
919 int rc_qmod_freq;
920
921 /**
922 * ratecontrol override, see RcOverride.
923 * - encoding: allocated/set/freed by user.
924 * - decoding: unused
925 */
926 RcOverride *rc_override;
927 int rc_override_count;
928
929 /**
930 * rate control equation.
931 * - encoding: set by user
932 * - decoding: unused
933 */
934 char *rc_eq;
935
936 /**
937 * maximum bitrate.
938 * - encoding: set by user.
939 * - decoding: unused
940 */
941 int rc_max_rate;
942
943 /**
944 * minimum bitrate.
945 * - encoding: set by user.
946 * - decoding: unused
947 */
948 int rc_min_rate;
949
950 /**
951 * decoder bitstream buffer size.
952 * - encoding: set by user.
953 * - decoding: unused
954 */
955 int rc_buffer_size;
956 float rc_buffer_aggressivity;
957
958 /**
959 * qscale factor between p and i frames.
960 * - encoding: set by user.
961 * - decoding: unused
962 */
963 float i_quant_factor;
964
965 /**
966 * qscale offset between p and i frames.
967 * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
968 * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
969 * - encoding: set by user.
970 * - decoding: unused
971 */
972 float i_quant_offset;
973
974 /**
975 * initial complexity for pass1 ratecontrol.
976 * - encoding: set by user.
977 * - decoding: unused
978 */
979 float rc_initial_cplx;
980
981 /**
982 * dct algorithm, see FF_DCT_* below.
983 * - encoding: set by user
984 * - decoding: unused
985 */
986 int dct_algo;
987 #define FF_DCT_AUTO 0
988 #define FF_DCT_FASTINT 1
989 #define FF_DCT_INT 2
990 #define FF_DCT_MMX 3
991 #define FF_DCT_MLIB 4
992 #define FF_DCT_ALTIVEC 5
993 #define FF_DCT_FAAN 6
994
995 /**
996 * luminance masking (0-> disabled).
997 * - encoding: set by user
998 * - decoding: unused
999 */
1000 float lumi_masking;
1001
1002 /**
1003 * temporary complexity masking (0-> disabled).
1004 * - encoding: set by user
1005 * - decoding: unused
1006 */
1007 float temporal_cplx_masking;
1008
1009 /**
1010 * spatial complexity masking (0-> disabled).
1011 * - encoding: set by user
1012 * - decoding: unused
1013 */
1014 float spatial_cplx_masking;
1015
1016 /**
1017 * p block masking (0-> disabled).
1018 * - encoding: set by user
1019 * - decoding: unused
1020 */
1021 float p_masking;
1022
1023 /**
1024 * darkness masking (0-> disabled).
1025 * - encoding: set by user
1026 * - decoding: unused
1027 */
1028 float dark_masking;
1029
1030
1031 /* for binary compatibility */
1032 int unused;
1033
1034 /**
1035 * idct algorithm, see FF_IDCT_* below.
1036 * - encoding: set by user
1037 * - decoding: set by user
1038 */
1039 int idct_algo;
1040 #define FF_IDCT_AUTO 0
1041 #define FF_IDCT_INT 1
1042 #define FF_IDCT_SIMPLE 2
1043 #define FF_IDCT_SIMPLEMMX 3
1044 #define FF_IDCT_LIBMPEG2MMX 4
1045 #define FF_IDCT_PS2 5
1046 #define FF_IDCT_MLIB 6
1047 #define FF_IDCT_ARM 7
1048 #define FF_IDCT_ALTIVEC 8
1049 #define FF_IDCT_SH4 9
1050 #define FF_IDCT_SIMPLEARM 10
1051
1052 /**
1053 * slice count.
1054 * - encoding: set by lavc
1055 * - decoding: set by user (or 0)
1056 */
1057 int slice_count;
1058 /**
1059 * slice offsets in the frame in bytes.
1060 * - encoding: set/allocated by lavc
1061 * - decoding: set/allocated by user (or NULL)
1062 */
1063 int *slice_offset;
1064
1065 /**
1066 * error concealment flags.
1067 * - encoding: unused
1068 * - decoding: set by user
1069 */
1070 int error_concealment;
1071 #define FF_EC_GUESS_MVS 1
1072 #define FF_EC_DEBLOCK 2
1073
1074 /**
1075 * dsp_mask could be add used to disable unwanted CPU features
1076 * CPU features (i.e. MMX, SSE. ...)
1077 *
1078 * with FORCE flag you may instead enable given CPU features
1079 * (Dangerous: usable in case of misdetection, improper usage however will
1080 * result into program crash)
1081 */
1082 unsigned dsp_mask;
1083 #define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */
1084 /* lower 16 bits - CPU features */
1085 #ifdef HAVE_MMX
1086 #define FF_MM_MMX 0x0001 /* standard MMX */
1087 #define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */
1088 #define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
1089 #define FF_MM_SSE 0x0008 /* SSE functions */
1090 #define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
1091 #endif /* HAVE_MMX */
1092
1093 /**
1094 * bits per sample/pixel from the demuxer (needed for huffyuv).
1095 * - encoding: set by lavc
1096 * - decoding: set by user
1097 */
1098 int bits_per_sample;
1099
1100 /**
1101 * prediction method (needed for huffyuv).
1102 * - encoding: set by user
1103 * - decoding: unused
1104 */
1105 int prediction_method;
1106 #define FF_PRED_LEFT 0
1107 #define FF_PRED_PLANE 1
1108 #define FF_PRED_MEDIAN 2
1109
1110 /**
1111 * sample aspect ratio (0 if unknown).
1112 * numerator and denominator must be relative prime and smaller then 256 for some video standards
1113 * - encoding: set by user.
1114 * - decoding: set by lavc.
1115 */
1116 AVRational sample_aspect_ratio;
1117
1118 /**
1119 * the picture in the bitstream.
1120 * - encoding: set by lavc
1121 * - decoding: set by lavc
1122 */
1123 AVFrame *coded_frame;
1124
1125 /**
1126 * debug.
1127 * - encoding: set by user.
1128 * - decoding: set by user.
1129 */
1130 int debug;
1131 #define FF_DEBUG_PICT_INFO 1
1132 #define FF_DEBUG_RC 2
1133 #define FF_DEBUG_BITSTREAM 4
1134 #define FF_DEBUG_MB_TYPE 8
1135 #define FF_DEBUG_QP 16
1136 #define FF_DEBUG_MV 32
1137 //#define FF_DEBUG_VIS_MV 0x00000040
1138 #define FF_DEBUG_SKIP 0x00000080
1139 #define FF_DEBUG_STARTCODE 0x00000100
1140 #define FF_DEBUG_PTS 0x00000200
1141 #define FF_DEBUG_ER 0x00000400
1142 #define FF_DEBUG_MMCO 0x00000800
1143 #define FF_DEBUG_BUGS 0x00001000
1144 #define FF_DEBUG_VIS_QP 0x00002000
1145 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
1146
1147 /**
1148 * debug.
1149 * - encoding: set by user.
1150 * - decoding: set by user.
1151 */
1152 int debug_mv;
1153 #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
1154 #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
1155 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
1156
1157 /**
1158 * error.
1159 * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
1160 * - decoding: unused
1161 */
1162 uint64_t error[4];
1163
1164 /**
1165 * minimum MB quantizer.
1166 * - encoding: set by user.
1167 * - decoding: unused
1168 */
1169 int mb_qmin;
1170
1171 /**
1172 * maximum MB quantizer.
1173 * - encoding: set by user.
1174 * - decoding: unused
1175 */
1176 int mb_qmax;
1177
1178 /**
1179 * motion estimation compare function.
1180 * - encoding: set by user.
1181 * - decoding: unused
1182 */
1183 int me_cmp;
1184 /**
1185 * subpixel motion estimation compare function.
1186 * - encoding: set by user.
1187 * - decoding: unused
1188 */
1189 int me_sub_cmp;
1190 /**
1191 * macroblock compare function (not supported yet).
1192 * - encoding: set by user.
1193 * - decoding: unused
1194 */
1195 int mb_cmp;
1196 #define FF_CMP_SAD 0
1197 #define FF_CMP_SSE 1
1198 #define FF_CMP_SATD 2
1199 #define FF_CMP_DCT 3
1200 #define FF_CMP_PSNR 4
1201 #define FF_CMP_BIT 5
1202 #define FF_CMP_RD 6
1203 #define FF_CMP_ZERO 7
1204 #define FF_CMP_CHROMA 256
1205
1206 /**
1207 * ME diamond size & shape.
1208 * - encoding: set by user.
1209 * - decoding: unused
1210 */
1211 int dia_size;
1212
1213 /**
1214 * amount of previous MV predictors (2a+1 x 2a+1 square).
1215 * - encoding: set by user.
1216 * - decoding: unused
1217 */
1218 int last_predictor_count;
1219
1220 /**
1221 * pre pass for motion estimation.
1222 * - encoding: set by user.
1223 * - decoding: unused
1224 */
1225 int pre_me;
1226
1227 /**
1228 * motion estimation pre pass compare function.
1229 * - encoding: set by user.
1230 * - decoding: unused
1231 */
1232 int me_pre_cmp;
1233
1234 /**
1235 * ME pre pass diamond size & shape.
1236 * - encoding: set by user.
1237 * - decoding: unused
1238 */
1239 int pre_dia_size;
1240
1241 /**
1242 * subpel ME quality.
1243 * - encoding: set by user.
1244 * - decoding: unused
1245 */
1246 int me_subpel_quality;
1247
1248 /**
1249 * callback to negotiate the pixelFormat.
1250 * @param fmt is the list of formats which are supported by the codec,
1251 * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
1252 * the first is allways the native one
1253 * @return the choosen format
1254 * - encoding: unused
1255 * - decoding: set by user, if not set then the native format will always be choosen
1256 */
1257 enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
1258
1259 /**
1260 * DTG active format information (additionnal aspect ratio
1261 * information only used in DVB MPEG2 transport streams). 0 if
1262 * not set.
1263 *
1264 * - encoding: unused.
1265 * - decoding: set by decoder
1266 */
1267 int dtg_active_format;
1268 #define FF_DTG_AFD_SAME 8
1269 #define FF_DTG_AFD_4_3 9
1270 #define FF_DTG_AFD_16_9 10
1271 #define FF_DTG_AFD_14_9 11
1272 #define FF_DTG_AFD_4_3_SP_14_9 13
1273 #define FF_DTG_AFD_16_9_SP_14_9 14
1274 #define FF_DTG_AFD_SP_4_3 15
1275
1276 /**
1277 * Maximum motion estimation search range in subpel units.
1278 * if 0 then no limit
1279 *
1280 * - encoding: set by user.
1281 * - decoding: unused.
1282 */
1283 int me_range;
1284
1285 /**
1286 * frame_rate_base.
1287 * for variable fps this is 1
1288 * - encoding: set by user.
1289 * - decoding: set by lavc.
1290 * @todo move this after frame_rate
1291 */
1292
1293 int frame_rate_base;
1294 /**
1295 * intra quantizer bias.
1296 * - encoding: set by user.
1297 * - decoding: unused
1298 */
1299 int intra_quant_bias;
1300 #define FF_DEFAULT_QUANT_BIAS 999999
1301
1302 /**
1303 * inter quantizer bias.
1304 * - encoding: set by user.
1305 * - decoding: unused
1306 */
1307 int inter_quant_bias;
1308
1309 /**
1310 * color table ID.
1311 * - encoding: unused.
1312 * - decoding: which clrtable should be used for 8bit RGB images
1313 * table have to be stored somewhere FIXME
1314 */
1315 int color_table_id;
1316
1317 /**
1318 * internal_buffer count.
1319 * Dont touch, used by lavc default_get_buffer()
1320 */
1321 int internal_buffer_count;
1322
1323 /**
1324 * internal_buffers.
1325 * Dont touch, used by lavc default_get_buffer()
1326 */
1327 void *internal_buffer;
1328
1329 #define FF_LAMBDA_SHIFT 7
1330 #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
1331 #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
1332 #define FF_LAMBDA_MAX (256*128-1)
1333
1334 #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
1335 /**
1336 * global quality for codecs which cannot change it per frame.
1337 * this should be proportional to MPEG1/2/4 qscale.
1338 * - encoding: set by user.
1339 * - decoding: unused
1340 */
1341 int global_quality;
1342
1343 #define FF_CODER_TYPE_VLC 0
1344 #define FF_CODER_TYPE_AC 1
1345 /**
1346 * coder type
1347 * - encoding: set by user.
1348 * - decoding: unused
1349 */
1350 int coder_type;
1351
1352 /**
1353 * context model
1354 * - encoding: set by user.
1355 * - decoding: unused
1356 */
1357 int context_model;
1358
1359 /**
1360 * slice flags
1361 * - encoding: unused
1362 * - decoding: set by user.
1363 */
1364 int slice_flags;
1365 #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
1366 #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
1367 #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
1368
1369 /**
1370 * XVideo Motion Acceleration
1371 * - encoding: forbidden
1372 * - decoding: set by decoder
1373 */
1374 int xvmc_acceleration;
1375
1376 /**
1377 * macroblock decision mode
1378 * - encoding: set by user.
1379 * - decoding: unused
1380 */
1381 int mb_decision;
1382 #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
1383 #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
1384 #define FF_MB_DECISION_RD 2 ///< rate distoration
1385
1386 /**
1387 * custom intra quantization matrix
1388 * - encoding: set by user, can be NULL
1389 * - decoding: set by lavc
1390 */
1391 uint16_t *intra_matrix;
1392
1393 /**
1394 * custom inter quantization matrix
1395 * - encoding: set by user, can be NULL
1396 * - decoding: set by lavc
1397 */
1398 uint16_t *inter_matrix;
1399
1400 /**
1401 * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1402 * this is used to workaround some encoder bugs
1403 * - encoding: unused
1404 * - decoding: set by user, will be converted to upper case by lavc during init
1405 */
1406 unsigned int stream_codec_tag;
1407
1408 /**
1409 * scene change detection threshold.
1410 * 0 is default, larger means fewer detected scene changes
1411 * - encoding: set by user.
1412 * - decoding: unused
1413 */
1414 int scenechange_threshold;
1415
1416 /**
1417 * minimum lagrange multipler
1418 * - encoding: set by user.
1419 * - decoding: unused
1420 */
1421 int lmin;
1422
1423 /**
1424 * maximum lagrange multipler
1425 * - encoding: set by user.
1426 * - decoding: unused
1427 */
1428 int lmax;
1429
1430 /**
1431 * Palette control structure
1432 * - encoding: ??? (no palette-enabled encoder yet)
1433 * - decoding: set by user.
1434 */
1435 struct AVPaletteControl *palctrl;
1436
1437 /**
1438 * noise reduction strength
1439 * - encoding: set by user.
1440 * - decoding: unused
1441 */
1442 int noise_reduction;
1443
1444 /**
1445 * called at the beginning of a frame to get cr buffer for it.
1446 * buffer type (size, hints) must be the same. lavc won't check it.
1447 * lavc will pass previous buffer in pic, function should return
1448 * same buffer or new buffer with old frame "painted" into it.
1449 * if pic.data[0] == NULL must behave like get_buffer().
1450 * - encoding: unused
1451 * - decoding: set by lavc, user can override
1452 */
1453 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
1454
1455 /**
1456 * number of bits which should be loaded into the rc buffer before decoding starts
1457 * - encoding: set by user.
1458 * - decoding: unused
1459 */
1460 int rc_initial_buffer_occupancy;
1461
1462 /**
1463 *
1464 * - encoding: set by user.
1465 * - decoding: unused
1466 */
1467 int inter_threshold;
1468
1469 /**
1470 * CODEC_FLAG2_*.
1471 * - encoding: set by user.
1472 * - decoding: set by user.
1473 */
1474 int flags2;
1475
1476 /**
1477 * simulates errors in the bitstream to test error concealment.
1478 * - encoding: set by user.
1479 * - decoding: unused.
1480 */
1481 int error_rate;
1482 } AVCodecContext;
1483
1484
1485 /**
1486 * AVOption.
1487 */
1488 typedef struct AVOption {
1489 /** options' name */
1490 const char *name; /* if name is NULL, it indicates a link to next */
1491 /** short English text help or const struct AVOption* subpointer */
1492 const char *help; // const struct AVOption* sub;
1493 /** offset to context structure where the parsed value should be stored */
1494 int offset;
1495 /** options' type */
1496 int type;
1497 #define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
1498 #define FF_OPT_TYPE_DOUBLE 2 ///< double
1499 #define FF_OPT_TYPE_INT 3 ///< integer
1500 #define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
1501 #define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
1502 //#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
1503 #define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
1504 #define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
1505 /** min value (min == max -> no limits) */
1506 double min;
1507 /** maximum value for double/int */
1508 double max;
1509 /** default boo [0,1]l/double/int value */
1510 double defval;
1511 /**
1512 * default string value (with optional semicolon delimited extra option-list
1513 * i.e. option1;option2;option3
1514 * defval might select other then first argument as default
1515 */
1516 const char *defstr;
1517 #define FF_OPT_MAX_DEPTH 10
1518 } AVOption;
1519
1520 /**
1521 * Parse option(s) and sets fields in passed structure
1522 * @param strct structure where the parsed results will be written
1523 * @param list list with AVOptions
1524 * @param opts string with options for parsing
1525 */
1526 int avoption_parse(void* strct, const AVOption* list, const char* opts);
1527
1528
1529 /**
1530 * AVCodec.
1531 */
1532 typedef struct AVCodec {
1533 const char *name;
1534 enum CodecType type;
1535 int id;
1536 int priv_data_size;
1537 int (*init)(AVCodecContext *);
1538 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
1539 int (*close)(AVCodecContext *);
1540 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
1541 uint8_t *buf, int buf_size);
1542 int capabilities;
1543 const AVOption *options;
1544 struct AVCodec *next;
1545 void (*flush)(AVCodecContext *);
1546 } AVCodec;
1547
1548 /**
1549 * four components are given, that's all.
1550 * the last component is alpha
1551 */
1552 typedef struct AVPicture {
1553 uint8_t *data[4];
1554 int linesize[4]; ///< number of bytes per line
1555 } AVPicture;
1556
1557 /**
1558 * AVPaletteControl
1559 * This structure defines a method for communicating palette changes
1560 * between and demuxer and a decoder.
1561 */
1562 #define AVPALETTE_SIZE 1024
1563 #define AVPALETTE_COUNT 256
1564 typedef struct AVPaletteControl {
1565
1566 /* demuxer sets this to 1 to indicate the palette has changed;
1567 * decoder resets to 0 */
1568 int palette_changed;
1569
1570 /* 4-byte ARGB palette entries, stored in native byte order; note that
1571 * the individual palette components should be on a 8-bit scale; if
1572 * the palette data comes from a IBM VGA native format, the component
1573 * data is probably 6 bits in size and needs to be scaled */
1574 unsigned int palette[AVPALETTE_COUNT];
1575
1576 } AVPaletteControl;
1577
1578 extern AVCodec ac3_encoder;
1579 extern AVCodec mp2_encoder;
1580 extern AVCodec mp3lame_encoder;
1581 extern AVCodec oggvorbis_encoder;
1582 extern AVCodec faac_encoder;
1583 extern AVCodec mpeg1video_encoder;
1584 extern AVCodec mpeg2video_encoder;
1585 extern AVCodec h263_encoder;
1586 extern AVCodec h263p_encoder;
1587 extern AVCodec flv_encoder;
1588 extern AVCodec rv10_encoder;
1589 extern AVCodec rv20_encoder;
1590 extern AVCodec mjpeg_encoder;
1591 extern AVCodec ljpeg_encoder;
1592 extern AVCodec mpeg4_encoder;
1593 extern AVCodec msmpeg4v1_encoder;
1594 extern AVCodec msmpeg4v2_encoder;
1595 extern AVCodec msmpeg4v3_encoder;
1596 extern AVCodec wmv1_encoder;
1597 extern AVCodec wmv2_encoder;
1598 extern AVCodec huffyuv_encoder;
1599 extern AVCodec h264_encoder;
1600 extern AVCodec asv1_encoder;
1601 extern AVCodec asv2_encoder;
1602 extern AVCodec vcr1_encoder;
1603 extern AVCodec ffv1_encoder;
1604 extern AVCodec mdec_encoder;
1605
1606 extern AVCodec h263_decoder;
1607 extern AVCodec mpeg4_decoder;
1608 extern AVCodec msmpeg4v1_decoder;
1609 extern AVCodec msmpeg4v2_decoder;
1610 extern AVCodec msmpeg4v3_decoder;
1611 extern AVCodec wmv1_decoder;
1612 extern AVCodec wmv2_decoder;
1613 extern AVCodec mpeg1video_decoder;
1614 extern AVCodec mpeg2video_decoder;
1615 extern AVCodec mpegvideo_decoder;
1616 extern AVCodec mpeg_xvmc_decoder;
1617 extern AVCodec h263i_decoder;
1618 extern AVCodec flv_decoder;
1619 extern AVCodec rv10_decoder;
1620 extern AVCodec rv20_decoder;
1621 extern AVCodec svq1_decoder;
1622 extern AVCodec svq3_decoder;
1623 extern AVCodec dvvideo_decoder;
1624 extern AVCodec wmav1_decoder;
1625 extern AVCodec wmav2_decoder;
1626 extern AVCodec mjpeg_decoder;
1627 extern AVCodec mjpegb_decoder;
1628 extern AVCodec sp5x_decoder;
1629 extern AVCodec mp2_decoder;
1630 extern AVCodec mp3_decoder;
1631 extern AVCodec mace3_decoder;
1632 extern AVCodec mace6_decoder;
1633 extern AVCodec huffyuv_decoder;
1634 extern AVCodec oggvorbis_decoder;
1635 extern AVCodec cyuv_decoder;
1636 extern AVCodec h264_decoder;
1637 extern AVCodec indeo3_decoder;
1638 extern AVCodec vp3_decoder;
1639 extern AVCodec theora_decoder;
1640 extern AVCodec amr_nb_decoder;
1641 extern AVCodec amr_nb_encoder;
1642 extern AVCodec amr_wb_encoder;
1643 extern AVCodec amr_wb_decoder;
1644 extern AVCodec aac_decoder;
1645 extern AVCodec mpeg4aac_decoder;
1646 extern AVCodec asv1_decoder;
1647 extern AVCodec asv2_decoder;
1648 extern AVCodec vcr1_decoder;
1649 extern AVCodec cljr_decoder;
1650 extern AVCodec ffv1_decoder;
1651 extern AVCodec fourxm_decoder;
1652 extern AVCodec mdec_decoder;
1653 extern AVCodec roq_decoder;
1654 extern AVCodec interplay_video_decoder;
1655 extern AVCodec xan_wc3_decoder;
1656 extern AVCodec rpza_decoder;
1657 extern AVCodec cinepak_decoder;
1658 extern AVCodec msrle_decoder;
1659 extern AVCodec msvideo1_decoder;
1660 extern AVCodec vqa_decoder;
1661 extern AVCodec idcin_decoder;
1662 extern AVCodec eightbps_decoder;
1663 extern AVCodec smc_decoder;
1664 extern AVCodec flic_decoder;
1665 extern AVCodec truemotion1_decoder;
1666 extern AVCodec ra_144_decoder;
1667 extern AVCodec ra_288_decoder;
1668 extern AVCodec roq_dpcm_decoder;
1669 extern AVCodec interplay_dpcm_decoder;
1670 extern AVCodec xan_dpcm_decoder;
1671
1672 /* pcm codecs */
1673 #define PCM_CODEC(id, name) \
1674 extern AVCodec name ## _decoder; \
1675 extern AVCodec name ## _encoder
1676
1677 PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
1678 PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
1679 PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
1680 PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
1681 PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
1682 PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
1683 PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
1684 PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
1685
1686 /* adpcm codecs */
1687
1688 PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
1689 PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
1690 PCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
1691 PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
1692 PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws);
1693 PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
1694 PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm);
1695 PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa);
1696 PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx);
1697
1698 #undef PCM_CODEC
1699
1700 /* dummy raw video codec */
1701 extern AVCodec rawvideo_encoder;
1702 extern AVCodec rawvideo_decoder;
1703
1704 /* the following codecs use external GPL libs */
1705 extern AVCodec ac3_decoder;
1706
1707 /* resample.c */
1708
1709 struct ReSampleContext;
1710
1711 typedef struct ReSampleContext ReSampleContext;
1712
1713 ReSampleContext *audio_resample_init(int output_channels, int input_channels,
1714 int output_rate, int input_rate);
1715 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
1716 void audio_resample_close(ReSampleContext *s);
1717
1718 /* YUV420 format is assumed ! */
1719
1720 struct ImgReSampleContext;
1721
1722 typedef struct ImgReSampleContext ImgReSampleContext;
1723
1724 ImgReSampleContext *img_resample_init(int output_width, int output_height,
1725 int input_width, int input_height);
1726
1727 ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
1728 int iwidth, int iheight,
1729 int topBand, int bottomBand,
1730 int leftBand, int rightBand);
1731
1732 void img_resample(ImgReSampleContext *s,
1733 AVPicture *output, const AVPicture *input);
1734
1735 void img_resample_close(ImgReSampleContext *s);
1736
1737 /**
1738 * Allocate memory for a picture. Call avpicture_free to free it.
1739 *
1740 * @param picture the picture to be filled in.
1741 * @param pix_fmt the format of the picture.
1742 * @param width the width of the picture.
1743 * @param height the height of the picture.
1744 * @return 0 if successful, -1 if not.
1745 */
1746 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
1747
1748 /* Free a picture previously allocated by avpicture_alloc. */
1749 void avpicture_free(AVPicture *picture);
1750
1751 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
1752 int pix_fmt, int width, int height);
1753 int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
1754 unsigned char *dest, int dest_size);
1755 int avpicture_get_size(int pix_fmt, int width, int height);
1756 void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
1757 const char *avcodec_get_pix_fmt_name(int pix_fmt);
1758 enum PixelFormat avcodec_get_pix_fmt(const char* name);
1759
1760 #define FF_LOSS_RESOLUTION 0x0001 /* loss due to resolution change */
1761 #define FF_LOSS_DEPTH 0x0002 /* loss due to color depth change */
1762 #define FF_LOSS_COLORSPACE 0x0004 /* loss due to color space conversion */
1763 #define FF_LOSS_ALPHA 0x0008 /* loss of alpha bits */
1764 #define FF_LOSS_COLORQUANT 0x0010 /* loss due to color quantization */
1765 #define FF_LOSS_CHROMA 0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
1766
1767 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
1768 int has_alpha);
1769 int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
1770 int has_alpha, int *loss_ptr);
1771
1772 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
1773 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
1774 int img_get_alpha_info(const AVPicture *src,
1775 int pix_fmt, int width, int height);
1776
1777 /* convert among pixel formats */
1778 int img_convert(AVPicture *dst, int dst_pix_fmt,
1779 const AVPicture *src, int pix_fmt,
1780 int width, int height);
1781
1782 /* deinterlace a picture */
1783 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
1784 int pix_fmt, int width, int height);
1785
1786 /* external high level API */
1787
1788 extern AVCodec *first_avcodec;
1789
1790 /* returns LIBAVCODEC_VERSION_INT constant */
1791 unsigned avcodec_version(void);
1792 /* returns LIBAVCODEC_BUILD constant */
1793 unsigned avcodec_build(void);
1794 void avcodec_init(void);
1795
1796 void register_avcodec(AVCodec *format);
1797 AVCodec *avcodec_find_encoder(enum CodecID id);
1798 AVCodec *avcodec_find_encoder_by_name(const char *name);
1799 AVCodec *avcodec_find_decoder(enum CodecID id);
1800 AVCodec *avcodec_find_decoder_by_name(const char *name);
1801 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
1802
1803 void avcodec_get_context_defaults(AVCodecContext *s);
1804 AVCodecContext *avcodec_alloc_context(void);
1805 AVFrame *avcodec_alloc_frame(void);
1806
1807 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
1808 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
1809 void avcodec_default_free_buffers(AVCodecContext *s);
1810
1811 /**
1812 * opens / inits the AVCodecContext.
1813 * not thread save!
1814 */
1815 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
1816
1817 int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
1818 int *frame_size_ptr,
1819 uint8_t *buf, int buf_size);
1820 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
1821 int *got_picture_ptr,
1822 uint8_t *buf, int buf_size);
1823 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
1824 int *data_size_ptr,
1825 uint8_t *buf, int buf_size);
1826 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
1827 const short *samples);
1828 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
1829 const AVFrame *pict);
1830
1831 int avcodec_close(AVCodecContext *avctx);
1832
1833 void avcodec_register_all(void);
1834
1835 void avcodec_flush_buffers(AVCodecContext *avctx);
1836
1837 /* misc usefull functions */
1838
1839 /**
1840 * returns a single letter to describe the picture type
1841 */
1842 char av_get_pict_type_char(int pict_type);
1843
1844 /**
1845 * reduce a fraction.
1846 * this is usefull for framerate calculations
1847 * @param max the maximum allowed for dst_nom & dst_den
1848 * @return 1 if exact, 0 otherwise
1849 */
1850 int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
1851
1852 /**
1853 * rescale a 64bit integer.
1854 * a simple a*b/c isnt possible as it can overflow
1855 */
1856 int64_t av_rescale(int64_t a, int b, int c);
1857
1858
1859 /**
1860 * Interface for 0.5.0 version
1861 *
1862 * do not even think about it's usage for this moment
1863 */
1864
1865 typedef struct {
1866 /// compressed size used from given memory buffer
1867 int size;
1868 /// I/P/B frame type
1869 int frame_type;
1870 } avc_enc_result_t;
1871
1872 /**
1873 * Commands
1874 * order can't be changed - once it was defined
1875 */
1876 typedef enum {
1877 // general commands
1878 AVC_OPEN_BY_NAME = 0xACA000,
1879 AVC_OPEN_BY_CODEC_ID,
1880 AVC_OPEN_BY_FOURCC,
1881 AVC_CLOSE,
1882
1883 AVC_FLUSH,
1884 // pin - struct { uint8_t* src, uint_t src_size }
1885 // pout - struct { AVPicture* img, consumed_bytes,
1886 AVC_DECODE,
1887 // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
1888 // pout - uint_t used_from_dest_size
1889 AVC_ENCODE,
1890
1891 // query/get video commands
1892 AVC_GET_VERSION = 0xACB000,
1893 AVC_GET_WIDTH,
1894 AVC_GET_HEIGHT,
1895 AVC_GET_DELAY,
1896 AVC_GET_QUANT_TABLE,
1897 // ...
1898
1899 // query/get audio commands
1900 AVC_GET_FRAME_SIZE = 0xABC000,
1901
1902 // maybe define some simple structure which
1903 // might be passed to the user - but they can't
1904 // contain any codec specific parts and these
1905 // calls are usualy necessary only few times
1906
1907 // set video commands
1908 AVC_SET_WIDTH = 0xACD000,
1909 AVC_SET_HEIGHT,
1910
1911 // set video encoding commands
1912 AVC_SET_FRAME_RATE = 0xACD800,
1913 AVC_SET_QUALITY,
1914 AVC_SET_HURRY_UP,
1915
1916 // set audio commands
1917 AVC_SET_SAMPLE_RATE = 0xACE000,
1918 AVC_SET_CHANNELS,
1919
1920 } avc_cmd_t;
1921
1922 /**
1923 * \param handle allocated private structure by libavcodec
1924 * for initialization pass NULL - will be returned pout
1925 * user is supposed to know nothing about its structure
1926 * \param cmd type of operation to be performed
1927 * \param pint input parameter
1928 * \param pout output parameter
1929 *
1930 * \returns command status - eventually for query command it might return
1931 * integer resulting value
1932 */
1933 int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
1934
1935 /* frame parsing */
1936 typedef struct AVCodecParserContext {
1937 void *priv_data;
1938 struct AVCodecParser *parser;
1939 int64_t frame_offset; /* offset of the current frame */
1940 int64_t cur_offset; /* current offset
1941 (incremented by each av_parser_parse()) */
1942 int64_t last_frame_offset; /* offset of the last frame */
1943 /* video info */
1944 int pict_type; /* XXX: put it back in AVCodecContext */
1945 int repeat_pict; /* XXX: put it back in AVCodecContext */
1946 int64_t pts; /* pts of the current frame */
1947 int64_t dts; /* dts of the current frame */
1948
1949 /* private data */
1950 int64_t last_pts;
1951 int64_t last_dts;
1952
1953 #define AV_PARSER_PTS_NB 4
1954 int cur_frame_start_index;
1955 int64_t cur_frame_offset[AV_PARSER_PTS_NB];
1956 int64_t cur_frame_pts[AV_PARSER_PTS_NB];
1957 int64_t cur_frame_dts[AV_PARSER_PTS_NB];
1958 } AVCodecParserContext;
1959
1960 typedef struct AVCodecParser {
1961 int codec_ids[3]; /* several codec IDs are permitted */
1962 int priv_data_size;
1963 int (*parser_init)(AVCodecParserContext *s);
1964 int (*parser_parse)(AVCodecParserContext *s,
1965 AVCodecContext *avctx,
1966 uint8_t **poutbuf, int *poutbuf_size,
1967 const uint8_t *buf, int buf_size);
1968 void (*parser_close)(AVCodecParserContext *s);
1969 struct AVCodecParser *next;
1970 } AVCodecParser;
1971
1972 extern AVCodecParser *av_first_parser;
1973
1974 void av_register_codec_parser(AVCodecParser *parser);
1975 AVCodecParserContext *av_parser_init(int codec_id);
1976 int av_parser_parse(AVCodecParserContext *s,
1977 AVCodecContext *avctx,
1978 uint8_t **poutbuf, int *poutbuf_size,
1979 const uint8_t *buf, int buf_size,
1980 int64_t pts, int64_t dts);
1981 void av_parser_close(AVCodecParserContext *s);
1982
1983 extern AVCodecParser mpegvideo_parser;
1984 extern AVCodecParser mpeg4video_parser;
1985 extern AVCodecParser h263_parser;
1986 extern AVCodecParser h264_parser;
1987 extern AVCodecParser mpegaudio_parser;
1988 extern AVCodecParser ac3_parser;
1989
1990 /* memory */
1991 void *av_malloc(unsigned int size);
1992 void *av_mallocz(unsigned int size);
1993 void *av_realloc(void *ptr, unsigned int size);
1994 void av_free(void *ptr);
1995 char *av_strdup(const char *s);
1996 void __av_freep(void **ptr);
1997 #define av_freep(p) __av_freep((void **)(p))
1998 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
1999 /* for static data only */
2000 /* call av_free_static to release all staticaly allocated tables */
2001 void av_free_static(void);
2002 void *__av_mallocz_static(void** location, unsigned int size);
2003 #define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
2004
2005 /* add by bero : in adx.c */
2006 int is_adx(const unsigned char *buf,size_t bufsize);
2007
2008 void img_copy(AVPicture *dst, const AVPicture *src,
2009 int pix_fmt, int width, int height);
2010
2011 /* av_log API */
2012
2013 #include <stdarg.h>
2014
2015 #define AV_LOG_ERROR 0
2016 #define AV_LOG_INFO 1
2017 #define AV_LOG_DEBUG 2
2018
2019 extern void av_log(AVCodecContext*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
2020 extern void av_vlog(AVCodecContext*, int level, const char *fmt, va_list);
2021 extern int av_log_get_level(void);
2022 extern void av_log_set_level(int);
2023 extern void av_log_set_callback(void (*)(AVCodecContext*, int, const char*, va_list));
2024
2025 #undef AV_LOG_TRAP_PRINTF
2026 #ifdef AV_LOG_TRAP_PRINTF
2027 #define printf DO NOT USE
2028 #define fprintf DO NOT USE
2029 #undef stderr
2030 #define stderr DO NOT USE
2031 #endif
2032
2033 #ifdef __cplusplus
2034 }
2035 #endif
2036
2037 #endif /* AVCODEC_H */