cosmetics
[libav.git] / libavcodec / avcodec.h
CommitLineData
a96b68b7
FB
1#ifndef AVCODEC_H
2#define AVCODEC_H
3
36df8805
MN
4/**
5 * @file avcodec.h
6 * @brief
7 * external api header
8 */
9
10
02d697aa
ZK
11#ifdef __cplusplus
12extern "C" {
13#endif
14
de6d9b64
FB
15#include "common.h"
16
4b1f4f23
J
17#define LIBAVCODEC_VERSION_INT 0x000406
18#define LIBAVCODEC_VERSION "0.4.6"
b0368839
MN
19#define LIBAVCODEC_BUILD 4660
20#define LIBAVCODEC_BUILD_STR "4660"
4b1f4f23 21
de6d9b64
FB
22enum CodecID {
23 CODEC_ID_NONE,
24 CODEC_ID_MPEG1VIDEO,
25 CODEC_ID_H263,
26 CODEC_ID_RV10,
27 CODEC_ID_MP2,
9d36bdc9 28 CODEC_ID_MP3LAME,
81e0d0b4 29 CODEC_ID_VORBIS,
de6d9b64
FB
30 CODEC_ID_AC3,
31 CODEC_ID_MJPEG,
b135d9fb 32 CODEC_ID_MJPEGB,
bf89e6b1 33 CODEC_ID_MPEG4,
de6d9b64 34 CODEC_ID_RAWVIDEO,
84afee34
MN
35 CODEC_ID_MSMPEG4V1,
36 CODEC_ID_MSMPEG4V2,
37 CODEC_ID_MSMPEG4V3,
e1a9dbff 38 CODEC_ID_WMV1,
b50eef3a 39 CODEC_ID_WMV2,
de6d9b64
FB
40 CODEC_ID_H263P,
41 CODEC_ID_H263I,
be8ffec9 42 CODEC_ID_SVQ1,
020fcc94
FB
43 CODEC_ID_DVVIDEO,
44 CODEC_ID_DVAUDIO,
bc8d1857
FB
45 CODEC_ID_WMAV1,
46 CODEC_ID_WMAV2,
3f95e843
FR
47 CODEC_ID_MACE3,
48 CODEC_ID_MACE6,
11f18faf 49 CODEC_ID_HUFFYUV,
f70f7c6d 50 CODEC_ID_CYUV,
a96b68b7
FB
51
52 /* various pcm "codecs" */
53 CODEC_ID_PCM_S16LE,
54 CODEC_ID_PCM_S16BE,
55 CODEC_ID_PCM_U16LE,
56 CODEC_ID_PCM_U16BE,
57 CODEC_ID_PCM_S8,
58 CODEC_ID_PCM_U8,
59 CODEC_ID_PCM_MULAW,
60 CODEC_ID_PCM_ALAW,
0147f198
FR
61
62 /* various adpcm codecs */
63 CODEC_ID_ADPCM_IMA_QT,
64 CODEC_ID_ADPCM_IMA_WAV,
65 CODEC_ID_ADPCM_MS,
de6d9b64
FB
66};
67
68enum CodecType {
4a663d80 69 CODEC_TYPE_UNKNOWN = -1,
de6d9b64
FB
70 CODEC_TYPE_VIDEO,
71 CODEC_TYPE_AUDIO,
72};
73
74enum PixelFormat {
75 PIX_FMT_YUV420P,
76 PIX_FMT_YUV422,
dab64ebc
FB
77 PIX_FMT_RGB24, /* 3 bytes, R is first */
78 PIX_FMT_BGR24, /* 3 bytes, B is first */
d9fea0b5
FB
79 PIX_FMT_YUV422P,
80 PIX_FMT_YUV444P,
dab64ebc 81 PIX_FMT_RGBA32, /* always stored in cpu endianness */
e9feea59 82 PIX_FMT_YUV410P,
a32072d0 83 PIX_FMT_YUV411P,
dab64ebc
FB
84 PIX_FMT_RGB565, /* always stored in cpu endianness */
85 PIX_FMT_RGB555, /* always stored in cpu endianness, most significant bit to 1 */
86 PIX_FMT_GRAY8,
87 PIX_FMT_MONOWHITE, /* 0 is white */
88 PIX_FMT_MONOBLACK, /* 0 is black */
7e6d70d0 89 PIX_FMT_PAL8, /* 8 bit with RGBA palette */
dab64ebc 90 PIX_FMT_NB,
de6d9b64
FB
91};
92
a96b68b7
FB
93/* currently unused, may be used if 24/32 bits samples ever supported */
94enum SampleFormat {
95 SAMPLE_FMT_S16 = 0, /* signed 16 bits */
96};
97
de6d9b64 98/* in bytes */
bc8d1857 99#define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072
de6d9b64 100
d7425f59
MN
101/**
102 * Required number of zero bytes at the end of the input bitstream for decoding.
103 * to avoid overreading (and possibly segfaulting)
104 */
105#define FF_INPUT_BUFFER_PADDING_SIZE 8
106
e4986da9
J
107/* motion estimation type, EPZS by default */
108enum Motion_Est_ID {
101bea5f 109 ME_ZERO = 1,
e4986da9
J
110 ME_FULL,
111 ME_LOG,
112 ME_PHODS,
113 ME_EPZS,
114 ME_X1
115};
116
ce980a95
MN
117typedef struct RcOverride{
118 int start_frame;
119 int end_frame;
120 int qscale; // if this is 0 then quality_factor will be used instead
121 float quality_factor;
122} RcOverride;
123
101bea5f
J
124/* only for ME compatiblity with old apps */
125extern int motion_estimation_method;
126
e4986da9 127/* ME algos sorted by quality */
bc6caae2
J
128static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
129 ME_X1, ME_EPZS, ME_FULL };
de6d9b64 130
28db7fce 131
4e00e76b 132#define FF_MAX_B_FRAMES 8
9dbcbd92 133
a949d72e
MN
134/* encoding support
135 these flags can be passed in AVCodecContext.flags before initing
136 Note: note not everything is supported yet
137*/
de6d9b64 138
b71901e6
MN
139#define CODEC_FLAG_HQ 0x0001 /* brute force MB-type decission mode (slow) */
140#define CODEC_FLAG_QSCALE 0x0002 /* use fixed qscale */
141#define CODEC_FLAG_4MV 0x0004 /* 4 MV per MB allowed */
142#define CODEC_FLAG_QPEL 0x0010 /* use qpel MC */
143#define CODEC_FLAG_GMC 0x0020 /* use GMC */
b71901e6 144#define CODEC_FLAG_PART 0x0080 /* use data partitioning */
9dbcbd92
MN
145/* parent program gurantees that the input for b-frame containing streams is not written to
146 for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
8b4c7dbc 147#define CODEC_FLAG_INPUT_PRESERVED 0x0100
b71901e6
MN
148#define CODEC_FLAG_PASS1 0x0200 /* use internal 2pass ratecontrol in first pass mode */
149#define CODEC_FLAG_PASS2 0x0400 /* use internal 2pass ratecontrol in second pass mode */
e84c31dc 150#define CODEC_FLAG_EXTERN_HUFF 0x1000 /* use external huffman table (for mjpeg) */
b71901e6 151#define CODEC_FLAG_GRAY 0x2000 /* only decode/encode grayscale */
93a21abd 152#define CODEC_FLAG_EMU_EDGE 0x4000/* dont draw edges */
140cb663 153#define CODEC_FLAG_PSNR 0x8000 /* error[?] variables will be set during encoding */
d7425f59
MN
154#define CODEC_FLAG_TRUNCATED 0x00010000 /* input bitstream might be truncated at a random location instead
155 of only at frame boundaries */
c5d309f2 156#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 /* normalize adaptive quantization */
fcb48651 157#define CODEC_FLAG_INTERLACED_DCT 0x00040000 /* use interlaced dct */
9f9c3229 158#define CODEC_FLAG_LOW_DELAY 0x00080000 /* force low delay / will fail on b frames */
5d3cea3a 159#define CODEC_FLAG_ALT_SCAN 0x00100000 /* use alternate scan */
477ab036 160#define CODEC_FLAG_TRELLIS_QUANT 0x00200000 /* use trellis quantization */
70ac76c0 161#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 /* place global headers in extradata instead of every keyframe */
b0368839 162#define CODEC_FLAG_BITEXACT 0x00800000 /* use only bitexact stuff (except (i)dct) */
21e59552
MN
163/* Fx : Flag for h263+ extra options */
164#define CODEC_FLAG_H263P_AIC 0x01000000 /* Advanced intra coding */
165#define CODEC_FLAG_H263P_UMV 0x02000000 /* Unlimited motion vector */
166/* For advanced prediction mode, we reuse the 4MV flag */
167/* Unsupported options :
168 * Syntax Arithmetic coding (SAC)
169 * Deblocking filter internal loop
170 * Slice structured
171 * Reference Picture Selection
172 * Independant Segment Decoding
173 * Alternative Inter * VLC
174 * Modified Quantization */
175/* /Fx */
bf89e6b1
FB
176/* codec capabilities */
177
b71901e6 178#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 /* decoder can use draw_horiz_band callback */
93a21abd 179#define CODEC_CAP_DR1 0x0002 /* direct rendering method 1 */
917e06c8
FB
180/* if 'parse_only' field is true, then avcodec_parse_frame() can be
181 used */
182#define CODEC_CAP_PARSE_ONLY 0x0004
d7425f59 183#define CODEC_CAP_TRUNCATED 0x0008
bf89e6b1 184
a5dbb247 185#define FRAME_RATE_BASE 10010
de6d9b64 186
492cd3a9 187#define FF_COMMON_FRAME \
1e491e29
MN
188 uint8_t *data[4];\
189 int linesize[4];\
190 /**\
32db2b1d 191 * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
1e491e29
MN
192 * this isnt used by lavc unless the default get/release_buffer() is used\
193 * encoding: \
194 * decoding: \
195 */\
196 uint8_t *base[4];\
197 /**\
198 * 1 -> keyframe, 0-> not\
199 * encoding: set by lavc\
200 * decoding: set by lavc\
201 */\
202 int key_frame;\
203\
204 /**\
205 * picture type of the frame, see ?_TYPE below\
206 * encoding: set by lavc for coded_picture (and set by user for input)\
207 * decoding: set by lavc\
208 */\
209 int pict_type;\
210\
211 /**\
212 * presentation timestamp in micro seconds (time when frame should be shown to user)\
213 * if 0 then the frame_rate will be used as reference\
214 * encoding: MUST be set by user\
215 * decoding: set by lavc\
216 */\
217 long long int pts;\
218\
219 /**\
220 * picture number in bitstream order.\
221 * encoding: set by\
222 * decoding: set by lavc\
223 */\
224 int coded_picture_number;\
225 /**\
226 * encoding: set by\
227 * decoding: set by lavc\
228 * picture number in display order.\
229 */\
230 int display_picture_number;\
231\
232 /**\
233 * quality (between 1 (good) and 31 (bad)) \
234 * encoding: set by lavc for coded_picture (and set by user for input)\
235 * decoding: set by lavc\
236 */\
237 float quality; \
238\
239 /**\
240 * buffer age (1->was last buffer and dint change, 2->..., ...).\
241 * set to something large if the buffer has not been used yet \
242 * encoding: unused\
243 * decoding: MUST be set by get_buffer()\
244 */\
245 int age;\
246\
247 /**\
248 * is this picture used as reference\
249 * encoding: unused\
250 * decoding: set by lavc (before get_buffer() call))\
251 */\
252 int reference;\
253\
254 /**\
255 * QP table\
256 * encoding: unused\
257 * decoding: set by lavc\
258 */\
259 int8_t *qscale_table;\
260 /**\
261 * QP store stride\
262 * encoding: unused\
263 * decoding: set by lavc\
264 */\
265 int qstride;\
266\
267 /**\
268 * mbskip_table[mb]>=1 if MB didnt change\
269 * stride= mb_width = (width+15)>>4\
270 * encoding: unused\
271 * decoding: set by lavc\
272 */\
273 uint8_t *mbskip_table;\
274\
275 /**\
276 * for some private data of the user\
277 * encoding: unused\
278 * decoding: set by user\
279 */\
280 void *opaque;\
140cb663
MN
281\
282 /**\
283 * error\
284 * encoding: set by lavc if flags&CODEC_FLAG_PSNR\
285 * decoding: unused\
286 */\
287 uint64_t error[4];\
4e00e76b
MN
288\
289 /**\
290 * type of the buffer (to keep track of who has to dealloc data[*])\
291 * encoding: set by the one who allocs it\
292 * decoding: set by the one who allocs it\
293 * Note: user allocated (direct rendering) & internal buffers can not coexist currently\
294 */\
295 int type;\
2ec23b6d
MN
296 \
297 /**\
298 * when decoding, this signal how much the picture must be delayed.\
299 * extra_delay = repeat_pict / (2*fps)\
300 * encoding: unused\
301 * decoding: set by lavc\
302 */\
303 int repeat_pict;
304
4e00e76b
MN
305
306#define FF_BUFFER_TYPE_INTERNAL 1
307#define FF_BUFFER_TYPE_USER 2 // Direct rendering buffers
308#define FF_BUFFER_TYPE_SHARED 4 // input frame for encoding(wont be dealloced)
309
1e491e29 310
140cb663
MN
311#define FF_I_TYPE 1 // Intra
312#define FF_P_TYPE 2 // Predicted
313#define FF_B_TYPE 3 // Bi-dir predicted
314#define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
1e491e29 315
492cd3a9
MN
316typedef struct AVFrame {
317 FF_COMMON_FRAME
318} AVFrame;
1e491e29 319
de6d9b64 320typedef struct AVCodecContext {
b71901e6
MN
321 /**
322 * the average bitrate
323 * encoding: set by user. unused for constant quantizer encoding
324 * decoding: set by lavc. 0 or some bitrate if this info is available in the stream
325 */
de6d9b64 326 int bit_rate;
b71901e6
MN
327
328 /**
329 * number of bits the bitstream is allowed to diverge from the reference
330 * the reference can be CBR (for CBR pass1) or VBR (for pass2)
331 * encoding: set by user. unused for constant quantizer encoding
332 * decoding: unused
333 */
334 int bit_rate_tolerance;
335
336 /**
337 * CODEC_FLAG_*
338 * encoding: set by user.
339 * decoding: set by user.
340 */
de6d9b64 341 int flags;
b71901e6
MN
342
343 /**
344 * some codecs needs additionnal format info. It is stored here
345 * encoding: set by user.
346 * decoding: set by lavc. (FIXME is this ok?)
347 */
348 int sub_id;
349
350 /**
351 * motion estimation algorithm used for video coding
1e491e29 352 * encoding: MUST be set by user.
b71901e6
MN
353 * decoding: unused
354 */
355 int me_method;
356
357 /**
358 * some codecs need / can use extra-data like huffman tables
359 * mjpeg: huffman tables
360 * rv10: additional flags
b704e742 361 * mpeg4: global headers (they can be in the bitstream or here)
c5d309f2
MN
362 * encoding: set/allocated/freed by lavc.
363 * decoding: set/allocated/freed by user.
b71901e6 364 */
e84c31dc
A
365 void *extradata;
366 int extradata_size;
367
de6d9b64 368 /* video only */
b71901e6
MN
369 /**
370 * frames per sec multiplied by FRAME_RATE_BASE
371 * for variable fps this is the precission, so if the timestamps
372 * can be specified in msec precssion then this is 1000*FRAME_RATE_BASE
1e491e29 373 * encoding: MUST be set by user
b71901e6
MN
374 * decoding: set by lavc. 0 or the frame_rate if available
375 */
376 int frame_rate;
377
378 /**
1e491e29 379 * encoding: MUST be set by user.
b71901e6
MN
380 * decoding: set by user, some codecs might override / change it during playback
381 */
de6d9b64 382 int width, height;
b71901e6 383
2efe097a
MN
384#define FF_ASPECT_SQUARE 1
385#define FF_ASPECT_4_3_625 2
386#define FF_ASPECT_4_3_525 3
387#define FF_ASPECT_16_9_625 4
388#define FF_ASPECT_16_9_525 5
e769f053 389#define FF_ASPECT_EXTENDED 15
b71901e6
MN
390
391 /**
392 * the number of pictures in a group of pitures, or 0 for intra_only
393 * encoding: set by user.
394 * decoding: unused
395 */
396 int gop_size;
397
398 /**
399 * pixel format, see PIX_FMT_xxx
400 * encoding: unused
401 * decoding: set by lavc.
402 */
403 enum PixelFormat pix_fmt;
2ec23b6d 404
b71901e6
MN
405 /**
406 * if non NULL, 'draw_horiz_band' is called by the libavcodec
407 * decoder to draw an horizontal band. It improve cache usage. Not
408 * all codecs can do that. You must check the codec capabilities
409 * before
410 * encoding: unused
411 * decoding: set by user.
412 */
bf89e6b1 413 void (*draw_horiz_band)(struct AVCodecContext *s,
0c1a9eda 414 uint8_t **src_ptr, int linesize,
bf89e6b1
FB
415 int y, int width, int height);
416
de6d9b64
FB
417 /* audio only */
418 int sample_rate; /* samples per sec */
419 int channels;
a96b68b7 420 int sample_fmt; /* sample format, currenly unused */
de6d9b64
FB
421
422 /* the following data should not be initialized */
9cd3766f
J
423 int frame_size; /* in samples, initialized when calling 'init' */
424 int frame_number; /* audio or video frame number */
425 int real_pict_num; /* returns the real picture number of
426 previous encoded frame */
1e491e29 427
b71901e6 428 /**
b71901e6
MN
429 * number of frames the decoded output will be delayed relative to
430 * the encoded input
431 * encoding: set by lavc.
432 * decoding: unused
433 */
434 int delay;
1ff662cc
MN
435
436 /* encoding parameters */
9cdd6a24
MN
437 float qcompress; /* amount of qscale change between easy & hard scenes (0.0-1.0)*/
438 float qblur; /* amount of qscale smoothing over time (0.0-1.0) */
b71901e6
MN
439
440 /**
441 * minimum quantizer
442 * encoding: set by user.
443 * decoding: unused
444 */
445 int qmin;
446
447 /**
448 * maximum quantizer
449 * encoding: set by user.
450 * decoding: unused
451 */
452 int qmax;
453
454 /**
455 * maximum quantizer difference etween frames
456 * encoding: set by user.
457 * decoding: unused
458 */
459 int max_qdiff;
460
461 /**
462 * maximum number of b frames between non b frames
463 * note: the output will be delayed by max_b_frames+1 relative to the input
464 * encoding: set by user.
465 * decoding: unused
466 */
467 int max_b_frames;
468
469 /**
470 * qscale factor between ip and b frames
471 * encoding: set by user.
472 * decoding: unused
473 */
474 float b_quant_factor;
475
476 /** obsolete FIXME remove */
477 int rc_strategy;
8b4c7dbc 478 int b_frame_strategy;
9dbcbd92 479
b71901e6
MN
480 /**
481 * encoding: unused
347ae22e 482 * decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
b71901e6
MN
483 */
484 int hurry_up;
2417652e 485
de6d9b64 486 struct AVCodec *codec;
b71901e6 487
de6d9b64
FB
488 void *priv_data;
489
644d98a4 490 /* The following data is for RTP friendly coding */
1f6b6e50 491 /* By now only H.263/H.263+/MPEG4 coder honours this */
644d98a4
J
492 int rtp_mode; /* 1 for activate RTP friendly-mode */
493 /* highers numbers represent more error-prone */
494 /* enviroments, by now just "1" exist */
495
496 int rtp_payload_size; /* The size of the RTP payload, the coder will */
497 /* do it's best to deliver a chunk with size */
498 /* below rtp_payload_size, the chunk will start */
499 /* with a start code on some codecs like H.263 */
500 /* This doesn't take account of any particular */
501 /* headers inside the transmited RTP payload */
81401c1f
J
502
503
504 /* The RTP callcack: This function is called */
505 /* every time the encoder as a packet to send */
506 /* Depends on the encoder if the data starts */
507 /* with a Start Code (it should) H.263 does */
508 void (*rtp_callback)(void *data, int size, int packet_number);
509
098eefe1
MN
510 /* statistics, used for 2-pass encoding */
511 int mv_bits;
512 int header_bits;
513 int i_tex_bits;
514 int p_tex_bits;
515 int i_count;
516 int p_count;
517 int skip_count;
b71901e6
MN
518 int misc_bits;
519
520 /**
521 * number of bits used for the previously encoded frame
522 * encoding: set by lavc
8350df97 523 * decoding: - for audio - bits_per_sample
b71901e6 524 */
098eefe1 525 int frame_bits;
644d98a4 526
b71901e6
MN
527 /**
528 * private data of the user, can be used to carry app specific stuff
529 * encoding: set by user
530 * decoding: set by user
531 */
532 void *opaque;
533
de6d9b64 534 char codec_name[32];
4a663d80
PG
535 enum CodecType codec_type; /* see CODEC_TYPE_xxx */
536 enum CodecID codec_id; /* see CODEC_ID_xxx */
de6d9b64 537 unsigned int codec_tag; /* codec tag, only used if unknown codec */
92ba5ffb 538
b71901e6 539 /**
4d2858de 540 * workaround bugs in encoders which sometimes cannot be detected automatically
b71901e6
MN
541 * encoding: unused
542 * decoding: set by user
543 */
544 int workaround_bugs;
4d2858de
MN
545#define FF_BUG_AUTODETECT 1 //autodetection
546#define FF_BUG_OLD_MSMPEG4 2
547#define FF_BUG_XVID_ILACE 4
548#define FF_BUG_UMP4 8
549#define FF_BUG_NO_PADDING 16
550#define FF_BUG_AC_VLC 32
03e93d35 551#define FF_BUG_QPEL_CHROMA 64
db794953 552#define FF_BUG_STD_QPEL 128
36df8805 553#define FF_BUG_QPEL_CHROMA2 256
c40c3482 554#define FF_BUG_DIRECT_BLOCKSIZE 512
4d2858de
MN
555//#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
556
b71901e6
MN
557 /**
558 * encoding: set by user
559 * decoding: unused
560 */
1f6b6e50 561 int luma_elim_threshold;
b71901e6
MN
562
563 /**
564 * encoding: set by user
565 * decoding: unused
566 */
1f6b6e50 567 int chroma_elim_threshold;
b71901e6
MN
568
569 /**
570 * strictly follow the std (MPEG4, ...)
571 * encoding: set by user
572 * decoding: unused
573 */
574 int strict_std_compliance;
575
576 /**
577 * qscale offset between ip and b frames
b3a391e8
MN
578 * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
579 * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
b71901e6
MN
580 * encoding: set by user.
581 * decoding: unused
582 */
583 float b_quant_offset;
584
585 /**
ce3bcaed 586 * error resilience higher values will detect more errors but may missdetect
b71901e6
MN
587 * some more or less valid parts as errors
588 * encoding: unused
589 * decoding: set by user
590 */
1f6b6e50 591 int error_resilience;
ce3bcaed
MN
592#define FF_ER_CAREFULL 1
593#define FF_ER_COMPLIANT 2
594#define FF_ER_AGGRESSIVE 3
595#define FF_ER_VERY_AGGRESSIVE 4
ae72cda6 596
6b72ac63 597 /**
1e491e29
MN
598 * called at the beginning of each frame to get a buffer for it.
599 * if pic.reference is set then the frame will be read later by lavc
b71901e6 600 * encoding: unused
1e491e29 601 * decoding: set by lavc, user can override
b71901e6 602 */
492cd3a9 603 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
b71901e6
MN
604
605 /**
1e491e29
MN
606 * called to release buffers which where allocated with get_buffer.
607 * a released buffer can be reused in get_buffer()
608 * pic.data[*] must be set to NULL
b71901e6 609 * encoding: unused
1e491e29 610 * decoding: set by lavc, user can override
b71901e6 611 */
492cd3a9 612 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
0fd90455 613
b71901e6
MN
614 /**
615 * is 1 if the decoded stream contains b frames, 0 otherwise
616 * encoding: unused
617 * decoding: set by lavc
618 */
619 int has_b_frames;
b71901e6 620
bc8d1857 621 int block_align; /* used by some WAV based audio codecs */
ce980a95 622
917e06c8
FB
623 int parse_only; /* decoding only: if true, only parsing is done
624 (function avcodec_parse_frame()). The frame
625 data is returned. Only MPEG codecs support this now. */
ce980a95 626
b71901e6
MN
627 /**
628 * 0-> h263 quant 1-> mpeg quant
629 * encoding: set by user.
630 * decoding: unused
631 */
632 int mpeg_quant;
ce980a95 633
b71901e6
MN
634 /**
635 * pass1 encoding statistics output buffer
636 * encoding: set by lavc
637 * decoding: unused
638 */
ce980a95 639 char *stats_out; /* encoding statistics output buffer */
b71901e6
MN
640
641 /**
642 * pass2 encoding statistics input buffer.
643 * concatenated stuff from stats_out of pass1 should be placed here
644 * encoding: allocated/set/freed by user
645 * decoding: unused
646 */
647 char *stats_in;
648
649 /**
650 * ratecontrol qmin qmax limiting method
651 * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax
652 * encoding: set by user.
653 * decoding: unused
654 */
ce980a95 655 float rc_qsquish;
b71901e6 656
ce980a95
MN
657 float rc_qmod_amp;
658 int rc_qmod_freq;
b71901e6
MN
659
660 /**
661 * ratecontrol override, see RcOverride
662 * encoding: allocated/set/freed by user.
663 * decoding: unused
664 */
ce980a95
MN
665 RcOverride *rc_override;
666 int rc_override_count;
b71901e6
MN
667
668 /**
669 * rate control equation
670 * encoding: set by user
671 * decoding: unused
672 */
ce980a95 673 char *rc_eq;
b71901e6
MN
674
675 /**
676 * maximum bitrate
677 * encoding: set by user.
678 * decoding: unused
679 */
ce980a95 680 int rc_max_rate;
b71901e6
MN
681
682 /**
683 * minimum bitrate
684 * encoding: set by user.
685 * decoding: unused
686 */
ce980a95 687 int rc_min_rate;
b71901e6
MN
688
689 /**
690 * decoder bitstream buffer size
691 * encoding: set by user.
692 * decoding: unused
693 */
ce980a95
MN
694 int rc_buffer_size;
695 float rc_buffer_aggressivity;
b71901e6
MN
696
697 /**
698 * qscale factor between p and i frames
699 * encoding: set by user.
700 * decoding: unused
701 */
702 float i_quant_factor;
703
704 /**
705 * qscale offset between p and i frames
b3a391e8
MN
706 * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
707 * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
b71901e6
MN
708 * encoding: set by user.
709 * decoding: unused
710 */
711 float i_quant_offset;
712
713 /**
714 * initial complexity for pass1 ratecontrol
715 * encoding: set by user.
716 * decoding: unused
717 */
ce980a95 718 float rc_initial_cplx;
917e06c8 719
b71901e6 720 /**
b71901e6
MN
721 * dct algorithm, see FF_DCT_* below
722 * encoding: set by user
723 * decoding: unused
724 */
28db7fce 725 int dct_algo;
c7e07931 726#define FF_DCT_AUTO 0
28db7fce 727#define FF_DCT_FASTINT 1
c7e07931
MO
728#define FF_DCT_INT 2
729#define FF_DCT_MMX 3
730#define FF_DCT_MLIB 4
05c4072b 731#define FF_DCT_ALTIVEC 5
c5d309f2
MN
732
733 /**
734 * luminance masking (0-> disabled)
735 * encoding: set by user
736 * decoding: unused
737 */
738 float lumi_masking;
739
740 /**
741 * temporary complexity masking (0-> disabled)
742 * encoding: set by user
743 * decoding: unused
744 */
745 float temporal_cplx_masking;
746
747 /**
748 * spatial complexity masking (0-> disabled)
749 * encoding: set by user
750 * decoding: unused
751 */
752 float spatial_cplx_masking;
753
754 /**
755 * p block masking (0-> disabled)
756 * encoding: set by user
757 * decoding: unused
758 */
759 float p_masking;
15415af4 760
5e746b99
MN
761 /**
762 * darkness masking (0-> disabled)
763 * encoding: set by user
764 * decoding: unused
765 */
766 float dark_masking;
0c2dd16e
MN
767
768 /**
769 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A')
770 * this is used to workaround some encoder bugs
771 * encoding: unused
202ef8b8 772 * decoding: set by user, will be converted to upper case by lavc during init
0c2dd16e
MN
773 */
774 int fourcc;
5e746b99 775
2ad1516a
MN
776 /**
777 * idct algorithm, see FF_IDCT_* below
778 * encoding: set by user
779 * decoding: set by user
780 */
781 int idct_algo;
782#define FF_IDCT_AUTO 0
783#define FF_IDCT_INT 1
784#define FF_IDCT_SIMPLE 2
785#define FF_IDCT_SIMPLEMMX 3
786#define FF_IDCT_LIBMPEG2MMX 4
787#define FF_IDCT_PS2 5
788#define FF_IDCT_MLIB 6
789#define FF_IDCT_ARM 7
05c4072b 790#define FF_IDCT_ALTIVEC 8
2ad1516a 791
144f0625
MN
792 /**
793 * slice count
794 * encoding: set by lavc
795 * decoding: set by user (or 0)
796 */
797 int slice_count;
798 /**
799 * slice offsets in the frame in bytes
800 * encoding: set/allocated by lavc
801 * decoding: set/allocated by user (or NULL)
802 */
803 int *slice_offset;
804
4d2858de
MN
805 /**
806 * error concealment flags
807 * encoding: unused
808 * decoding: set by user
809 */
810 int error_concealment;
811#define FF_EC_GUESS_MVS 1
812#define FF_EC_DEBLOCK 2
813
6b72ac63 814 /**
8350df97
ZK
815 * dsp_mask could be used to disable unwanted
816 * CPU features (i.e. MMX, SSE. ...)
817 */
818 unsigned dsp_mask;
11f18faf
MN
819
820 /**
821 * bits per sample/pixel from the demuxer (needed for huffyuv)
1e491e29 822 * encoding: set by lavc
11f18faf
MN
823 * decoding: set by user
824 */
825 int bits_per_sample;
826
827 /**
828 * prediction method (needed for huffyuv)
1e491e29 829 * encoding: set by user
11f18faf
MN
830 * decoding: unused
831 */
832 int prediction_method;
833#define FF_PRED_LEFT 0
834#define FF_PRED_PLANE 1
835#define FF_PRED_MEDIAN 2
5d3cea3a
MN
836
837 /**
838 * aspect ratio. (0 if unknown)
839 * encoding: set by user.
840 * decoding: set by lavc.
841 */
842 float aspect_ratio;
1e491e29
MN
843
844 /**
845 * the picture in the bitstream
846 * encoding: set by lavc
847 * decoding: set by lavc
848 */
492cd3a9 849 AVFrame *coded_frame;
c8c437bc
MN
850
851 /**
852 * debug
853 * encoding: set by user.
854 * decoding: set by user.
855 */
856 int debug;
857#define FF_DEBUG_PICT_INFO 1
858#define FF_DEBUG_RC 2
859#define FF_DEBUG_BITSTREAM 4
860#define FF_DEBUG_MB_TYPE 8
861#define FF_DEBUG_QP 16
862#define FF_DEBUG_MV 32
41773b73
MN
863#define FF_DEBUG_VIS_MV 0x00000040
864#define FF_DEBUG_SKIP 0x00000080
865#define FF_DEBUG_STARTCODE 0x00000100
866#define FF_DEBUG_PTS 0x00000200
140cb663
MN
867
868 /**
869 * error
870 * encoding: set by lavc if flags&CODEC_FLAG_PSNR
871 * decoding: unused
872 */
873 uint64_t error[4];
17a70fde
MN
874
875 /**
876 * minimum MB quantizer
877 * encoding: set by user.
878 * decoding: unused
879 */
880 int mb_qmin;
881
882 /**
883 * maximum MB quantizer
884 * encoding: set by user.
885 * decoding: unused
886 */
887 int mb_qmax;
1457ab52
MN
888
889 /**
890 * motion estimation compare function
891 * encoding: set by user.
892 * decoding: unused
893 */
894 int me_cmp;
895 /**
896 * subpixel motion estimation compare function
897 * encoding: set by user.
898 * decoding: unused
899 */
900 int me_sub_cmp;
901 /**
902 * macroblock compare function (not supported yet)
903 * encoding: set by user.
904 * decoding: unused
905 */
906 int mb_cmp;
907#define FF_CMP_SAD 0
908#define FF_CMP_SSE 1
909#define FF_CMP_SATD 2
910#define FF_CMP_DCT 3
911#define FF_CMP_PSNR 4
912#define FF_CMP_BIT 5
913#define FF_CMP_RD 6
914#define FF_CMP_ZERO 7
915#define FF_CMP_CHROMA 256
916
917 /**
b07a5980 918 * ME diamond size & shape
1457ab52
MN
919 * encoding: set by user.
920 * decoding: unused
921 */
922 int dia_size;
b07a5980
MN
923
924 /**
925 * amount of previous MV predictors (2a+1 x 2a+1 square)
926 * encoding: set by user.
927 * decoding: unused
928 */
929 int last_predictor_count;
70ac76c0 930
f5fb6b34
MN
931 /**
932 * pre pass for motion estimation
933 * encoding: set by user.
934 * decoding: unused
935 */
936 int pre_me;
b07a5980 937
70ac76c0
MN
938 /**
939 * motion estimation pre pass compare function
940 * encoding: set by user.
941 * decoding: unused
942 */
943 int me_pre_cmp;
826f429a 944
70ac76c0
MN
945 /**
946 * ME pre pass diamond size & shape
947 * encoding: set by user.
948 * decoding: unused
949 */
950 int pre_dia_size;
951
826f429a
MN
952 /**
953 * subpel ME quality
954 * encoding: set by user.
955 * decoding: unused
956 */
957 int me_subpel_quality;
958
a33c7159
MN
959 /**
960 * callback to negotiate the pixelFormat
961 * @param fmt is the list of formats which are supported by the codec,
962 * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
963 * the first is allways the native one
964 * @return the choosen format
965 * encoding: unused
966 * decoding: set by user, if not set then the native format will always be choosen
967 */
968 enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
e2f9490e
FB
969
970 /**
971 * DTG active format information (additionnal aspect ratio
972 * information only used in DVB MPEG2 transport streams). 0 if
973 * not set.
974 *
975 * encoding: unused.
976 * decoding: set by decoder
977 */
978 int dtg_active_format;
979#define FF_DTG_AFD_SAME 8
980#define FF_DTG_AFD_4_3 9
981#define FF_DTG_AFD_16_9 10
982#define FF_DTG_AFD_14_9 11
983#define FF_DTG_AFD_4_3_SP_14_9 13
984#define FF_DTG_AFD_16_9_SP_14_9 14
985#define FF_DTG_AFD_SP_4_3 15
986
ebbcdc9a
MN
987 int me_range;
988 /**
989 * Maximum motion estimation search range in subpel units.
990 * if 0 then no limit
991 *
992 * encoding: set by user.
993 * decoding: unused.
994 */
995
de6d9b64
FB
996} AVCodecContext;
997
97d96aaa
ZK
998//void avcodec_getopt(AVCodecContext* avctx, const char* str, avc_config_t** config);
999
1000typedef struct AVOption {
1001 /** options' name */
1002 const char *name; /* if name is NULL, it indicates a link to next */
1003 /** short English text help */
1004 const char *help;
1005 /** offset to context structure where the parsed value should be stored */
1006 int offset;
1007 /** options' type */
1008 int type;
1009#define FF_OPT_TYPE_BOOL 1 // boolean - true,1,on (or simply presence)
1010#define FF_OPT_TYPE_DOUBLE 2 // double
1011#define FF_OPT_TYPE_INT 3 // integer
1012#define FF_OPT_TYPE_STRING 4 // string (finished with \0)
1013#define FF_OPT_TYPE_MASK 0x1f // mask for types - upper bits are various flags
1014//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
1015#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
1016#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
1017 /** min value (min == max -> no limits) */
1018 double min;
1019 /** maximum value for double/int */
1020 double max;
1021 /** default boo [0,1]l/double/int value */
1022 double defval;
1023 /**
1024 * default string value (with optional semicolon delimited extra option-list
1025 * i.e. option1;option2;option3
1026 * defval might select other then first argument as default
1027 */
1028 const char *defstr;
1029 const struct AVOption *sub; /* used when name is NULL */
1030 /* when it's NULL return to previous level (or finish reading) */
1031#define FF_OPT_MAX_DEPTH 10
1032} AVOption;
1033
de6d9b64 1034typedef struct AVCodec {
18f77016 1035 const char *name;
de6d9b64
FB
1036 int type;
1037 int id;
1038 int priv_data_size;
1039 int (*init)(AVCodecContext *);
0c1a9eda 1040 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
de6d9b64 1041 int (*close)(AVCodecContext *);
0fd90455 1042 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
0c1a9eda 1043 uint8_t *buf, int buf_size);
bf89e6b1 1044 int capabilities;
97d96aaa 1045 const AVOption *options;
de6d9b64
FB
1046 struct AVCodec *next;
1047} AVCodec;
1048
97d96aaa 1049/**
d7425f59
MN
1050 * four components are given, that's all.
1051 * the last component is alpha
1052 */
de6d9b64 1053typedef struct AVPicture {
0c1a9eda 1054 uint8_t *data[4];
d7425f59 1055 int linesize[4];
de6d9b64
FB
1056} AVPicture;
1057
1058extern AVCodec ac3_encoder;
1059extern AVCodec mp2_encoder;
9d36bdc9 1060extern AVCodec mp3lame_encoder;
81e0d0b4 1061extern AVCodec oggvorbis_encoder;
de6d9b64
FB
1062extern AVCodec mpeg1video_encoder;
1063extern AVCodec h263_encoder;
1064extern AVCodec h263p_encoder;
1065extern AVCodec rv10_encoder;
1066extern AVCodec mjpeg_encoder;
bf89e6b1 1067extern AVCodec mpeg4_encoder;
84afee34
MN
1068extern AVCodec msmpeg4v1_encoder;
1069extern AVCodec msmpeg4v2_encoder;
1070extern AVCodec msmpeg4v3_encoder;
0151a6f5
MN
1071extern AVCodec wmv1_encoder;
1072extern AVCodec wmv2_encoder;
11f18faf 1073extern AVCodec huffyuv_encoder;
de6d9b64
FB
1074
1075extern AVCodec h263_decoder;
bf89e6b1 1076extern AVCodec mpeg4_decoder;
84afee34
MN
1077extern AVCodec msmpeg4v1_decoder;
1078extern AVCodec msmpeg4v2_decoder;
1079extern AVCodec msmpeg4v3_decoder;
e1a9dbff 1080extern AVCodec wmv1_decoder;
0151a6f5 1081extern AVCodec wmv2_decoder;
de6d9b64
FB
1082extern AVCodec mpeg_decoder;
1083extern AVCodec h263i_decoder;
1084extern AVCodec rv10_decoder;
be8ffec9 1085extern AVCodec svq1_decoder;
020fcc94
FB
1086extern AVCodec dvvideo_decoder;
1087extern AVCodec dvaudio_decoder;
bc8d1857
FB
1088extern AVCodec wmav1_decoder;
1089extern AVCodec wmav2_decoder;
4e66ab3b 1090extern AVCodec mjpeg_decoder;
b135d9fb 1091extern AVCodec mjpegb_decoder;
4b1f4f23 1092extern AVCodec mp2_decoder;
a96b68b7 1093extern AVCodec mp3_decoder;
3f95e843
FR
1094extern AVCodec mace3_decoder;
1095extern AVCodec mace6_decoder;
11f18faf 1096extern AVCodec huffyuv_decoder;
3aca208a 1097extern AVCodec oggvorbis_decoder;
f70f7c6d 1098extern AVCodec cyuv_decoder;
de6d9b64 1099
a96b68b7
FB
1100/* pcm codecs */
1101#define PCM_CODEC(id, name) \
1102extern AVCodec name ## _decoder; \
f11d3f23 1103extern AVCodec name ## _encoder
a96b68b7
FB
1104
1105PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
1106PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
1107PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
1108PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
1109PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
1110PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
1111PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
1112PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
1113
0147f198
FR
1114/* adpcm codecs */
1115
1116PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
1117PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
1118PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
1119
a96b68b7
FB
1120#undef PCM_CODEC
1121
1122/* dummy raw video codec */
de6d9b64
FB
1123extern AVCodec rawvideo_codec;
1124
1125/* the following codecs use external GPL libs */
de6d9b64
FB
1126extern AVCodec ac3_decoder;
1127
1128/* resample.c */
1129
1130struct ReSampleContext;
1131
1132typedef struct ReSampleContext ReSampleContext;
1133
1134ReSampleContext *audio_resample_init(int output_channels, int input_channels,
1135 int output_rate, int input_rate);
1136int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
1137void audio_resample_close(ReSampleContext *s);
1138
1139/* YUV420 format is assumed ! */
1140
1141struct ImgReSampleContext;
1142
1143typedef struct ImgReSampleContext ImgReSampleContext;
1144
1145ImgReSampleContext *img_resample_init(int output_width, int output_height,
1146 int input_width, int input_height);
ab6d194a
MN
1147
1148ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
1149 int iwidth, int iheight,
1150 int topBand, int bottomBand,
1151 int leftBand, int rightBand);
1152
de6d9b64
FB
1153void img_resample(ImgReSampleContext *s,
1154 AVPicture *output, AVPicture *input);
1155
1156void img_resample_close(ImgReSampleContext *s);
1157
0c1a9eda 1158int avpicture_fill(AVPicture *picture, uint8_t *ptr,
2d1a4094 1159 int pix_fmt, int width, int height);
219b06c6 1160int avpicture_get_size(int pix_fmt, int width, int height);
dab64ebc
FB
1161void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
1162const char *avcodec_get_pix_fmt_name(int pix_fmt);
219b06c6
FB
1163
1164/* convert among pixel formats */
1165int img_convert(AVPicture *dst, int dst_pix_fmt,
1166 AVPicture *src, int pix_fmt,
1167 int width, int height);
1168
1169/* deinterlace a picture */
1170int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
de6d9b64
FB
1171 int pix_fmt, int width, int height);
1172
1173/* external high level API */
1174
1175extern AVCodec *first_avcodec;
1176
156e5023 1177/* returns LIBAVCODEC_VERSION_INT constant */
51a49663 1178unsigned avcodec_version(void);
8bceb6af 1179/* returns LIBAVCODEC_BUILD constant */
51a49663 1180unsigned avcodec_build(void);
de6d9b64
FB
1181void avcodec_init(void);
1182
1183void register_avcodec(AVCodec *format);
1184AVCodec *avcodec_find_encoder(enum CodecID id);
98f3b098 1185AVCodec *avcodec_find_encoder_by_name(const char *name);
de6d9b64
FB
1186AVCodec *avcodec_find_decoder(enum CodecID id);
1187AVCodec *avcodec_find_decoder_by_name(const char *name);
1188void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
1189
1e491e29 1190void avcodec_get_context_defaults(AVCodecContext *s);
7ffbb60e 1191AVCodecContext *avcodec_alloc_context(void);
492cd3a9 1192AVFrame *avcodec_alloc_frame(void);
1e491e29 1193
492cd3a9
MN
1194int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
1195void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
1e491e29 1196
de6d9b64 1197int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
0c1a9eda 1198int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
de6d9b64 1199 int *frame_size_ptr,
0c1a9eda 1200 uint8_t *buf, int buf_size);
492cd3a9 1201int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
de6d9b64 1202 int *got_picture_ptr,
0c1a9eda
ZK
1203 uint8_t *buf, int buf_size);
1204int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
917e06c8 1205 int *data_size_ptr,
0c1a9eda
ZK
1206 uint8_t *buf, int buf_size);
1207int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
de6d9b64 1208 const short *samples);
0c1a9eda 1209int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
492cd3a9 1210 const AVFrame *pict);
de6d9b64
FB
1211
1212int avcodec_close(AVCodecContext *avctx);
1213
1214void avcodec_register_all(void);
a96b68b7 1215
1c2a8c7f
MN
1216void avcodec_flush_buffers(AVCodecContext *avctx);
1217
628d601b 1218
628d601b 1219
e8f14793
ZK
1220/**
1221 * Interface for 0.5.0 version
1222 *
1223 * do not even think about it's usage for this moment
1224 */
1225
1226typedef struct {
1227 // compressed size used from given memory buffer
1228 int size;
1229 /// I/P/B frame type
1230 int frame_type;
1231} avc_enc_result_t;
1232
1233/**
1234 * Commands
1235 * order can't be changed - once it was defined
1236 */
1237typedef enum {
1238 // general commands
1239 AVC_OPEN_BY_NAME = 0xACA000,
1240 AVC_OPEN_BY_CODEC_ID,
1241 AVC_OPEN_BY_FOURCC,
1242 AVC_CLOSE,
1243
1244 AVC_FLUSH,
1245 // pin - struct { uint8_t* src, uint_t src_size }
1246 // pout - struct { AVPicture* img, consumed_bytes,
1247 AVC_DECODE,
1248 // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
1249 // pout - uint_t used_from_dest_size
1250 AVC_ENCODE,
1251
1252 // query/get video commands
1253 AVC_GET_VERSION = 0xACB000,
1254 AVC_GET_WIDTH,
1255 AVC_GET_HEIGHT,
1256 AVC_GET_DELAY,
1257 AVC_GET_QUANT_TABLE,
1258 // ...
1259
1260 // query/get audio commands
1261 AVC_GET_FRAME_SIZE = 0xABC000,
1262
1263 // maybe define some simple structure which
1264 // might be passed to the user - but they can't
1265 // contain any codec specific parts and these
1266 // calls are usualy necessary only few times
1267
1268 // set video commands
1269 AVC_SET_WIDTH = 0xACD000,
1270 AVC_SET_HEIGHT,
1271
1272 // set video encoding commands
1273 AVC_SET_FRAME_RATE = 0xACD800,
1274 AVC_SET_QUALITY,
1275 AVC_SET_HURRY_UP,
1276
1277 // set audio commands
1278 AVC_SET_SAMPLE_RATE = 0xACE000,
1279 AVC_SET_CHANNELS,
1280
1281} avc_cmd_t;
1282
1283/**
1284 * \param handle allocated private structure by libavcodec
1285 * for initialization pass NULL - will be returned pout
1286 * user is supposed to know nothing about its structure
1287 * \param cmd type of operation to be performed
1288 * \param pint input parameter
1289 * \param pout output parameter
1290 *
1291 * \returns command status - eventually for query command it might return
1292 * integer resulting value
1293 */
1294int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
1295
544eb99c 1296/* memory */
18f77016
ZK
1297void *av_malloc(unsigned int size);
1298void *av_mallocz(unsigned int size);
8e1e6f31 1299void *av_realloc(void *ptr, unsigned int size);
544eb99c 1300void av_free(void *ptr);
8e1e6f31 1301char *av_strdup(const char *s);
544eb99c
FB
1302void __av_freep(void **ptr);
1303#define av_freep(p) __av_freep((void **)(p))
97d96aaa 1304void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
855ea723
ZK
1305/* for static data only */
1306/* call av_free_static to release all staticaly allocated tables */
628d601b 1307void av_free_static(void);
855ea723
ZK
1308void *__av_mallocz_static(void** location, unsigned int size);
1309#define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
544eb99c 1310
02d697aa
ZK
1311#ifdef __cplusplus
1312}
1313#endif
1314
a96b68b7 1315#endif /* AVCODEC_H */