Statistics
| Branch: | Revision:

ffmpeg / libavcodec / avcodec.h @ bec89a84

History | View | Annotate | Download (37.8 KB)

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

    
16
#define LIBAVCODEC_VERSION_INT 0x000406
17
#define LIBAVCODEC_VERSION     "0.4.6"
18
#define LIBAVCODEC_BUILD       4660
19
#define LIBAVCODEC_BUILD_STR   "4660"
20

    
21
enum CodecID {
22
    CODEC_ID_NONE, 
23
    CODEC_ID_MPEG1VIDEO,
24
    CODEC_ID_H263,
25
    CODEC_ID_RV10,
26
    CODEC_ID_MP2,
27
    CODEC_ID_MP3LAME,
28
    CODEC_ID_VORBIS,
29
    CODEC_ID_AC3,
30
    CODEC_ID_MJPEG,
31
    CODEC_ID_MJPEGB,
32
    CODEC_ID_MPEG4,
33
    CODEC_ID_RAWVIDEO,
34
    CODEC_ID_MSMPEG4V1,
35
    CODEC_ID_MSMPEG4V2,
36
    CODEC_ID_MSMPEG4V3,
37
    CODEC_ID_WMV1,
38
    CODEC_ID_WMV2,
39
    CODEC_ID_H263P,
40
    CODEC_ID_H263I,
41
    CODEC_ID_SVQ1,
42
    CODEC_ID_DVVIDEO,
43
    CODEC_ID_DVAUDIO,
44
    CODEC_ID_WMAV1,
45
    CODEC_ID_WMAV2,
46
    CODEC_ID_MACE3,
47
    CODEC_ID_MACE6,
48
    CODEC_ID_HUFFYUV,
49
    CODEC_ID_CYUV,
50

    
51
    /* various pcm "codecs" */
52
    CODEC_ID_PCM_S16LE,
53
    CODEC_ID_PCM_S16BE,
54
    CODEC_ID_PCM_U16LE,
55
    CODEC_ID_PCM_U16BE,
56
    CODEC_ID_PCM_S8,
57
    CODEC_ID_PCM_U8,
58
    CODEC_ID_PCM_MULAW,
59
    CODEC_ID_PCM_ALAW,
60

    
61
    /* various adpcm codecs */
62
    CODEC_ID_ADPCM_IMA_QT,
63
    CODEC_ID_ADPCM_IMA_WAV,
64
    CODEC_ID_ADPCM_MS,
65
};
66

    
67
enum CodecType {
68
    CODEC_TYPE_UNKNOWN = -1,
69
    CODEC_TYPE_VIDEO,
70
    CODEC_TYPE_AUDIO,
71
};
72

    
73
/**
74
 * Pixel format.
75
 */
76
enum PixelFormat {
77
    PIX_FMT_YUV420P,
78
    PIX_FMT_YUV422,
79
    PIX_FMT_RGB24,     ///< 3 bytes, R is first 
80
    PIX_FMT_BGR24,     ///< 3 bytes, B is first 
81
    PIX_FMT_YUV422P,
82
    PIX_FMT_YUV444P,
83
    PIX_FMT_RGBA32,    ///< always stored in cpu endianness 
84
    PIX_FMT_YUV410P,
85
    PIX_FMT_YUV411P,
86
    PIX_FMT_RGB565,    ///< always stored in cpu endianness 
87
    PIX_FMT_RGB555,    ///< always stored in cpu endianness, most significant bit to 1 
88
    PIX_FMT_GRAY8,
89
    PIX_FMT_MONOWHITE, ///< 0 is white 
90
    PIX_FMT_MONOBLACK, ///< 0 is black 
91
    PIX_FMT_PAL8,      ///< 8 bit with RGBA palette 
92
    PIX_FMT_NB,
93
};
94

    
95
/* currently unused, may be used if 24/32 bits samples ever supported */
96
enum SampleFormat {
97
    SAMPLE_FMT_S16 = 0,         ///< signed 16 bits 
98
};
99

    
100
/* in bytes */
101
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072
102

    
103
/**
104
 * Required number of zero bytes at the end of the input bitstream for decoding.
105
 * to avoid overreading (and possibly segfaulting)
106
 */
107
#define FF_INPUT_BUFFER_PADDING_SIZE 8
108

    
109
/* motion estimation type, EPZS by default */
110
enum Motion_Est_ID {
111
    ME_ZERO = 1,
112
    ME_FULL,
113
    ME_LOG,
114
    ME_PHODS,
115
    ME_EPZS,
116
    ME_X1
117
};
118

    
119
typedef struct RcOverride{
120
    int start_frame;
121
    int end_frame;
122
    int qscale; // if this is 0 then quality_factor will be used instead
123
    float quality_factor;
124
} RcOverride;
125

    
126
/* only for ME compatiblity with old apps */
127
extern int motion_estimation_method;
128

    
129
/* ME algos sorted by quality */
130
static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG, 
131
                                       ME_X1, ME_EPZS, ME_FULL };
132

    
133

    
134
#define FF_MAX_B_FRAMES 8
135

    
136
/* encoding support
137
   these flags can be passed in AVCodecContext.flags before initing 
138
   Note: note not everything is supported yet 
139
*/
140

    
141
#define CODEC_FLAG_HQ     0x0001  ///< brute force MB-type decission mode (slow) 
142
#define CODEC_FLAG_QSCALE 0x0002  ///< use fixed qscale 
143
#define CODEC_FLAG_4MV    0x0004  ///< 4 MV per MB allowed 
144
#define CODEC_FLAG_QPEL   0x0010  ///< use qpel MC 
145
#define CODEC_FLAG_GMC    0x0020  ///< use GMC 
146
#define CODEC_FLAG_PART   0x0080  ///< use data partitioning 
147
/* parent program gurantees that the input for b-frame containing streams is not written to 
148
   for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
149
#define CODEC_FLAG_INPUT_PRESERVED 0x0100
150
#define CODEC_FLAG_PASS1 0x0200   ///< use internal 2pass ratecontrol in first  pass mode 
151
#define CODEC_FLAG_PASS2 0x0400   ///< use internal 2pass ratecontrol in second pass mode 
152
#define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) 
153
#define CODEC_FLAG_GRAY  0x2000   ///< only decode/encode grayscale 
154
#define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges 
155
#define CODEC_FLAG_PSNR           0x8000 ///< error[?] variables will be set during encoding 
156
#define CODEC_FLAG_TRUNCATED  0x00010000 /** input bitstream might be truncated at a random location instead 
157
                                            of only at frame boundaries */
158
#define CODEC_FLAG_NORMALIZE_AQP  0x00020000 ///< normalize adaptive quantization 
159
#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct 
160
#define CODEC_FLAG_LOW_DELAY      0x00080000 ///< force low delay / will fail on b frames 
161
#define CODEC_FLAG_ALT_SCAN       0x00100000 ///< use alternate scan 
162
#define CODEC_FLAG_TRELLIS_QUANT  0x00200000 ///< use trellis quantization 
163
#define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< place global headers in extradata instead of every keyframe 
164
#define CODEC_FLAG_BITEXACT       0x00800000 ///< use only bitexact stuff (except (i)dct) 
165
/* Fx : Flag for h263+ extra options */
166
#define CODEC_FLAG_H263P_AIC      0x01000000 ///< Advanced intra coding 
167
#define CODEC_FLAG_H263P_UMV      0x02000000 ///< Unlimited motion vector  
168
/* For advanced prediction mode, we reuse the 4MV flag */
169
/* Unsupported options :
170
 *                 Syntax Arithmetic coding (SAC)
171
 *                 Deblocking filter internal loop
172
 *                 Slice structured
173
 *                 Reference Picture Selection
174
 *                 Independant Segment Decoding
175
 *                 Alternative Inter *                 VLC
176
 *                 Modified Quantization */
177
/* /Fx */
178
/* codec capabilities */
179

    
180
#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback 
181
#define CODEC_CAP_DR1             0x0002 ///< direct rendering method 1 
182
/* if 'parse_only' field is true, then avcodec_parse_frame() can be
183
   used */
184
#define CODEC_CAP_PARSE_ONLY      0x0004
185
#define CODEC_CAP_TRUNCATED       0x0008
186

    
187
#define FRAME_RATE_BASE 10010
188

    
189
#define FF_COMMON_FRAME \
190
    uint8_t *data[4];\
191
    int linesize[4];\
192
    /**\
193
     * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
194
     * this isnt used by lavc unless the default get/release_buffer() is used\
195
     * - encoding: \
196
     * - decoding: \
197
     */\
198
    uint8_t *base[4];\
199
    /**\
200
     * 1 -> keyframe, 0-> not\
201
     * - encoding: set by lavc\
202
     * - decoding: set by lavc\
203
     */\
204
    int key_frame;\
205
\
206
    /**\
207
     * picture type of the frame, see ?_TYPE below\
208
     * - encoding: set by lavc for coded_picture (and set by user for input)\
209
     * - decoding: set by lavc\
210
     */\
211
    int pict_type;\
212
\
213
    /**\
214
     * presentation timestamp in micro seconds (time when frame should be shown to user)\
215
     * if 0 then the frame_rate will be used as reference\
216
     * - encoding: MUST be set by user\
217
     * - decoding: set by lavc\
218
     */\
219
    long long int pts;\
220
\
221
    /**\
222
     * picture number in bitstream order.\
223
     * - encoding: set by\
224
     * - decoding: set by lavc\
225
     */\
226
    int coded_picture_number;\
227
    /**\
228
     * picture number in display order.\
229
     * - encoding: set by\
230
     * - decoding: set by lavc\
231
     */\
232
    int display_picture_number;\
233
\
234
    /**\
235
     * quality (between 1 (good) and 31 (bad)) \
236
     * - encoding: set by lavc for coded_picture (and set by user for input)\
237
     * - decoding: set by lavc\
238
     */\
239
    float quality; \
240
\
241
    /**\
242
     * buffer age (1->was last buffer and dint change, 2->..., ...).\
243
     * set to something large if the buffer has not been used yet \
244
     * - encoding: unused\
245
     * - decoding: MUST be set by get_buffer()\
246
     */\
247
    int age;\
248
\
249
    /**\
250
     * is this picture used as reference\
251
     * - encoding: unused\
252
     * - decoding: set by lavc (before get_buffer() call))\
253
     */\
254
    int reference;\
255
\
256
    /**\
257
     * QP table\
258
     * - encoding: unused\
259
     * - decoding: set by lavc\
260
     */\
261
    int8_t *qscale_table;\
262
    /**\
263
     * QP store stride\
264
     * - encoding: unused\
265
     * - decoding: set by lavc\
266
     */\
267
    int qstride;\
268
\
269
    /**\
270
     * mbskip_table[mb]>=1 if MB didnt change\
271
     * stride= mb_width = (width+15)>>4\
272
     * - encoding: unused\
273
     * - decoding: set by lavc\
274
     */\
275
    uint8_t *mbskip_table;\
276
\
277
    /**\
278
     * for some private data of the user\
279
     * - encoding: unused\
280
     * - decoding: set by user\
281
     */\
282
    void *opaque;\
283
\
284
    /**\
285
     * error\
286
     * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\
287
     * - decoding: unused\
288
     */\
289
    uint64_t error[4];\
290
\
291
    /**\
292
     * type of the buffer (to keep track of who has to dealloc data[*])\
293
     * - encoding: set by the one who allocs it\
294
     * - decoding: set by the one who allocs it\
295
     * Note: user allocated (direct rendering) & internal buffers can not coexist currently\ 
296
     */\
297
    int type;\
298
    \
299
    /**\
300
     * when decoding, this signal how much the picture must be delayed.\
301
     * extra_delay = repeat_pict / (2*fps)\
302
     * - encoding: unused\
303
     * - decoding: set by lavc\
304
     */\
305
    int repeat_pict;
306

    
307

    
308
#define FF_BUFFER_TYPE_INTERNAL 1
309
#define FF_BUFFER_TYPE_USER     2 // Direct rendering buffers
310
#define FF_BUFFER_TYPE_SHARED   4 // input frame for encoding(wont be dealloced)
311

    
312

    
313
#define FF_I_TYPE 1 // Intra
314
#define FF_P_TYPE 2 // Predicted
315
#define FF_B_TYPE 3 // Bi-dir predicted
316
#define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
317

    
318
typedef struct AVFrame {
319
    FF_COMMON_FRAME
320
} AVFrame;
321

    
322

    
323
/**
324
 * main external api structure.
325
 */
326
typedef struct AVCodecContext {
327
    /**
328
     * the average bitrate.
329
     * - encoding: set by user. unused for constant quantizer encoding
330
     * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream 
331
     */
332
    int bit_rate;
333

    
334
    /**
335
     * number of bits the bitstream is allowed to diverge from the reference.
336
     *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
337
     * - encoding: set by user. unused for constant quantizer encoding
338
     * - decoding: unused
339
     */
340
    int bit_rate_tolerance; 
341

    
342
    /**
343
     * CODEC_FLAG_*.
344
     * - encoding: set by user.
345
     * - decoding: set by user.
346
     */
347
    int flags;
348

    
349
    /**
350
     * some codecs needs additionnal format info. It is stored here
351
     * - encoding: set by user. 
352
     * - decoding: set by lavc. (FIXME is this ok?)
353
     */
354
    int sub_id;
355

    
356
    /**
357
     * motion estimation algorithm used for video coding.
358
     * - encoding: MUST be set by user.
359
     * - decoding: unused
360
     */
361
    int me_method;
362

    
363
    /**
364
     * some codecs need / can use extra-data like huffman tables.
365
     * mjpeg: huffman tables
366
     * rv10: additional flags
367
     * mpeg4: global headers (they can be in the bitstream or here)
368
     * - encoding: set/allocated/freed by lavc.
369
     * - decoding: set/allocated/freed by user.
370
     */
371
    void *extradata;
372
    int extradata_size;
373
    
374
    /* video only */
375
    /**
376
     * frames per sec multiplied by FRAME_RATE_BASE.
377
     * for variable fps this is the precission, so if the timestamps 
378
     * can be specified in msec precssion then this is 1000*FRAME_RATE_BASE
379
     * - encoding: MUST be set by user
380
     * - decoding: set by lavc. 0 or the frame_rate if available
381
     */
382
    int frame_rate;
383

    
384
    /**
385
     * width / height.
386
     * - encoding: MUST be set by user. 
387
     * - decoding: set by user, some codecs might override / change it during playback
388
     */
389
    int width, height;
390
    
391
#define FF_ASPECT_SQUARE 1
392
#define FF_ASPECT_4_3_625 2
393
#define FF_ASPECT_4_3_525 3
394
#define FF_ASPECT_16_9_625 4
395
#define FF_ASPECT_16_9_525 5
396
#define FF_ASPECT_EXTENDED 15
397

    
398
    /**
399
     * the number of pictures in a group of pitures, or 0 for intra_only.
400
     * - encoding: set by user.
401
     * - decoding: unused
402
     */
403
    int gop_size;
404

    
405
    /**
406
     * pixel format, see PIX_FMT_xxx.
407
     * - encoding: unused
408
     * - decoding: set by lavc.
409
     */
410
    enum PixelFormat pix_fmt;
411
 
412
    /**
413
     * Frame rate emulation. If not zero lower layer (i.e. format handler) 
414
     * has to read frames at native frame rate.
415
     * - encoding: set by user.
416
     * - decoding: unused.
417
     */
418
    int rate_emu;
419
       
420
    /**
421
     * if non NULL, 'draw_horiz_band' is called by the libavcodec
422
     * decoder to draw an horizontal band. It improve cache usage. Not
423
     * all codecs can do that. You must check the codec capabilities
424
     * before
425
     * - encoding: unused
426
     * - decoding: set by user.
427
     */
428
    void (*draw_horiz_band)(struct AVCodecContext *s,
429
                            uint8_t **src_ptr, int linesize,
430
                            int y, int width, int height);
431

    
432
    /* audio only */
433
    int sample_rate; ///< samples per sec 
434
    int channels;
435
    int sample_fmt;  ///< sample format, currenly unused 
436

    
437
    /* the following data should not be initialized */
438
    int frame_size;     ///< in samples, initialized when calling 'init' 
439
    int frame_number;   ///< audio or video frame number 
440
    int real_pict_num;  ///< returns the real picture number of previous encoded frame 
441
    
442
    /**
443
     * number of frames the decoded output will be delayed relative to 
444
     * the encoded input.
445
     * - encoding: set by lavc.
446
     * - decoding: unused
447
     */
448
    int delay;
449
    
450
    /* - encoding parameters */
451
    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
452
    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0) 
453
    
454
    /**
455
     * minimum quantizer.
456
     * - encoding: set by user.
457
     * - decoding: unused
458
     */
459
    int qmin;
460

    
461
    /**
462
     * maximum quantizer.
463
     * - encoding: set by user.
464
     * - decoding: unused
465
     */
466
    int qmax;
467

    
468
    /**
469
     * maximum quantizer difference etween frames.
470
     * - encoding: set by user.
471
     * - decoding: unused
472
     */
473
    int max_qdiff;
474

    
475
    /**
476
     * maximum number of b frames between non b frames.
477
     * note: the output will be delayed by max_b_frames+1 relative to the input
478
     * - encoding: set by user.
479
     * - decoding: unused
480
     */
481
    int max_b_frames;
482

    
483
    /**
484
     * qscale factor between ip and b frames.
485
     * - encoding: set by user.
486
     * - decoding: unused
487
     */
488
    float b_quant_factor;
489
    
490
    /** obsolete FIXME remove */
491
    int rc_strategy;
492
    int b_frame_strategy;
493

    
494
    /**
495
     * hurry up amount.
496
     * - encoding: unused
497
     * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
498
     */
499
    int hurry_up;
500
    
501
    struct AVCodec *codec;
502
    
503
    void *priv_data;
504

    
505
    /* The following data is for RTP friendly coding */
506
    /* By now only H.263/H.263+/MPEG4 coder honours this   */
507
    int rtp_mode;   /* 1 for activate RTP friendly-mode           */
508
                    /* highers numbers represent more error-prone */
509
                    /* enviroments, by now just "1" exist         */
510
    
511
    int rtp_payload_size;   /* The size of the RTP payload, the coder will  */
512
                            /* do it's best to deliver a chunk with size    */
513
                            /* below rtp_payload_size, the chunk will start */
514
                            /* with a start code on some codecs like H.263  */
515
                            /* This doesn't take account of any particular  */
516
                            /* headers inside the transmited RTP payload    */
517

    
518
    
519
    /* The RTP callcack: This function is called  */
520
    /* every time the encoder as a packet to send */
521
    /* Depends on the encoder if the data starts  */
522
    /* with a Start Code (it should) H.263 does   */
523
    void (*rtp_callback)(void *data, int size, int packet_number); 
524

    
525
    /* statistics, used for 2-pass encoding */
526
    int mv_bits;
527
    int header_bits;
528
    int i_tex_bits;
529
    int p_tex_bits;
530
    int i_count;
531
    int p_count;
532
    int skip_count;
533
    int misc_bits;
534
    
535
    /**
536
     * number of bits used for the previously encoded frame.
537
     * - encoding: set by lavc
538
     * - decoding: - for audio - bits_per_sample
539
     */
540
    int frame_bits;
541
                 
542
    /**
543
     * private data of the user, can be used to carry app specific stuff.
544
     * - encoding: set by user
545
     * - decoding: set by user
546
     */
547
    void *opaque;
548

    
549
    char codec_name[32];
550
    enum CodecType codec_type; /* see CODEC_TYPE_xxx */
551
    enum CodecID codec_id; /* see CODEC_ID_xxx */
552
    unsigned int codec_tag;  ///< codec tag, only used if unknown codec
553
    
554
    /**
555
     * workaround bugs in encoders which sometimes cannot be detected automatically.
556
     * - encoding: unused
557
     * - decoding: set by user
558
     */
559
    int workaround_bugs;
560
#define FF_BUG_AUTODETECT       1  ///< autodetection
561
#define FF_BUG_OLD_MSMPEG4      2
562
#define FF_BUG_XVID_ILACE       4
563
#define FF_BUG_UMP4             8
564
#define FF_BUG_NO_PADDING       16
565
#define FF_BUG_AC_VLC           32
566
#define FF_BUG_QPEL_CHROMA      64
567
#define FF_BUG_STD_QPEL         128
568
#define FF_BUG_QPEL_CHROMA2     256
569
#define FF_BUG_DIRECT_BLOCKSIZE 512
570
//#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
571
        
572
    /**
573
     * luma single coeff elimination threshold.
574
     * - encoding: set by user
575
     * - decoding: unused
576
     */
577
    int luma_elim_threshold;
578
    
579
    /**
580
     * chroma single coeff elimination threshold.
581
     * - encoding: set by user
582
     * - decoding: unused
583
     */
584
    int chroma_elim_threshold;
585
    
586
    /**
587
     * strictly follow the std (MPEG4, ...).
588
     * - encoding: set by user
589
     * - decoding: unused
590
     */
591
    int strict_std_compliance;
592
    
593
    /**
594
     * qscale offset between ip and b frames.
595
     * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
596
     * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
597
     * - encoding: set by user.
598
     * - decoding: unused
599
     */
600
    float b_quant_offset;
601
    
602
    /**
603
     * error resilience higher values will detect more errors but may missdetect
604
     * some more or less valid parts as errors.
605
     * - encoding: unused
606
     * - decoding: set by user
607
     */
608
    int error_resilience;
609
#define FF_ER_CAREFULL        1
610
#define FF_ER_COMPLIANT       2
611
#define FF_ER_AGGRESSIVE      3
612
#define FF_ER_VERY_AGGRESSIVE 4
613
    
614
    /**
615
     * called at the beginning of each frame to get a buffer for it.
616
     * if pic.reference is set then the frame will be read later by lavc
617
     * - encoding: unused
618
     * - decoding: set by lavc, user can override
619
     */
620
    int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
621
    
622
    /**
623
     * called to release buffers which where allocated with get_buffer.
624
     * a released buffer can be reused in get_buffer()
625
     * pic.data[*] must be set to NULL
626
     * - encoding: unused
627
     * - decoding: set by lavc, user can override
628
     */
629
    void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
630

    
631
    /**
632
     * is 1 if the decoded stream contains b frames, 0 otherwise.
633
     * - encoding: unused
634
     * - decoding: set by lavc
635
     */
636
    int has_b_frames;
637
    
638
    int block_align; ///< used by some WAV based audio codecs
639
    
640
    int parse_only; /* - decoding only: if true, only parsing is done
641
                       (function avcodec_parse_frame()). The frame
642
                       data is returned. Only MPEG codecs support this now. */
643
    
644
    /**
645
     * 0-> h263 quant 1-> mpeg quant.
646
     * - encoding: set by user.
647
     * - decoding: unused
648
     */
649
    int mpeg_quant;
650
    
651
    /**
652
     * pass1 encoding statistics output buffer.
653
     * - encoding: set by lavc
654
     * - decoding: unused
655
     */
656
    char *stats_out;
657
    
658
    /**
659
     * pass2 encoding statistics input buffer.
660
     * concatenated stuff from stats_out of pass1 should be placed here
661
     * - encoding: allocated/set/freed by user
662
     * - decoding: unused
663
     */
664
    char *stats_in;
665
    
666
    /**
667
     * ratecontrol qmin qmax limiting method.
668
     * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax
669
     * - encoding: set by user.
670
     * - decoding: unused
671
     */
672
    float rc_qsquish;
673

    
674
    float rc_qmod_amp;
675
    int rc_qmod_freq;
676
    
677
    /**
678
     * ratecontrol override, see RcOverride.
679
     * - encoding: allocated/set/freed by user.
680
     * - decoding: unused
681
     */
682
    RcOverride *rc_override;
683
    int rc_override_count;
684
    
685
    /**
686
     * rate control equation.
687
     * - encoding: set by user
688
     * - decoding: unused
689
     */
690
    char *rc_eq;
691
    
692
    /**
693
     * maximum bitrate.
694
     * - encoding: set by user.
695
     * - decoding: unused
696
     */
697
    int rc_max_rate;
698
    
699
    /**
700
     * minimum bitrate.
701
     * - encoding: set by user.
702
     * - decoding: unused
703
     */
704
    int rc_min_rate;
705
    
706
    /**
707
     * decoder bitstream buffer size.
708
     * - encoding: set by user.
709
     * - decoding: unused
710
     */
711
    int rc_buffer_size;
712
    float rc_buffer_aggressivity;
713

    
714
    /**
715
     * qscale factor between p and i frames.
716
     * - encoding: set by user.
717
     * - decoding: unused
718
     */
719
    float i_quant_factor;
720
    
721
    /**
722
     * qscale offset between p and i frames.
723
     * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
724
     * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
725
     * - encoding: set by user.
726
     * - decoding: unused
727
     */
728
    float i_quant_offset;
729
    
730
    /**
731
     * initial complexity for pass1 ratecontrol.
732
     * - encoding: set by user.
733
     * - decoding: unused
734
     */
735
    float rc_initial_cplx;
736

    
737
    /**
738
     * dct algorithm, see FF_DCT_* below.
739
     * - encoding: set by user
740
     * - decoding: unused
741
     */
742
    int dct_algo;
743
#define FF_DCT_AUTO    0
744
#define FF_DCT_FASTINT 1
745
#define FF_DCT_INT     2
746
#define FF_DCT_MMX     3
747
#define FF_DCT_MLIB    4
748
#define FF_DCT_ALTIVEC 5
749
    
750
    /**
751
     * luminance masking (0-> disabled).
752
     * - encoding: set by user
753
     * - decoding: unused
754
     */
755
    float lumi_masking;
756
    
757
    /**
758
     * temporary complexity masking (0-> disabled).
759
     * - encoding: set by user
760
     * - decoding: unused
761
     */
762
    float temporal_cplx_masking;
763
    
764
    /**
765
     * spatial complexity masking (0-> disabled).
766
     * - encoding: set by user
767
     * - decoding: unused
768
     */
769
    float spatial_cplx_masking;
770
    
771
    /**
772
     * p block masking (0-> disabled).
773
     * - encoding: set by user
774
     * - decoding: unused
775
     */
776
    float p_masking;
777

    
778
    /**
779
     * darkness masking (0-> disabled).
780
     * - encoding: set by user
781
     * - decoding: unused
782
     */
783
    float dark_masking;
784
    
785
    /**
786
     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
787
     * this is used to workaround some encoder bugs
788
     * - encoding: unused
789
     * - decoding: set by user, will be converted to upper case by lavc during init
790
     */
791
    int fourcc;
792

    
793
    /**
794
     * idct algorithm, see FF_IDCT_* below.
795
     * - encoding: set by user
796
     * - decoding: set by user
797
     */
798
    int idct_algo;
799
#define FF_IDCT_AUTO         0
800
#define FF_IDCT_INT          1
801
#define FF_IDCT_SIMPLE       2
802
#define FF_IDCT_SIMPLEMMX    3
803
#define FF_IDCT_LIBMPEG2MMX  4
804
#define FF_IDCT_PS2          5
805
#define FF_IDCT_MLIB         6
806
#define FF_IDCT_ARM          7
807
#define FF_IDCT_ALTIVEC      8
808

    
809
    /**
810
     * slice count.
811
     * - encoding: set by lavc
812
     * - decoding: set by user (or 0)
813
     */
814
    int slice_count;
815
    /**
816
     * slice offsets in the frame in bytes.
817
     * - encoding: set/allocated by lavc
818
     * - decoding: set/allocated by user (or NULL)
819
     */
820
    int *slice_offset;
821

    
822
    /**
823
     * error concealment flags.
824
     * - encoding: unused
825
     * - decoding: set by user
826
     */
827
    int error_concealment;
828
#define FF_EC_GUESS_MVS   1
829
#define FF_EC_DEBLOCK     2
830

    
831
    /**
832
     * dsp_mask could be add used to disable unwanted CPU features
833
     * CPU features (i.e. MMX, SSE. ...)
834
     *
835
     * with FORCE flag you may instead enable given CPU features
836
     * (Dangerous: usable in case of misdetection, improper usage however will
837
     * result into program crash)
838
     */
839
    unsigned dsp_mask;
840
#define FF_MM_FORCE        0x80000000 /* force usage of selected flags (OR) */
841
    /* lower 16 bits - CPU features */
842
#ifdef HAVE_MMX
843
#define FF_MM_MMX        0x0001 /* standard MMX */
844
#define FF_MM_3DNOW        0x0004 /* AMD 3DNOW */
845
#define FF_MM_MMXEXT        0x0002 /* SSE integer functions or AMD MMX ext */
846
#define FF_MM_SSE        0x0008 /* SSE functions */
847
#define FF_MM_SSE2        0x0010 /* PIV SSE2 functions */
848
#endif /* HAVE_MMX */
849

    
850
    /**
851
     * bits per sample/pixel from the demuxer (needed for huffyuv).
852
     * - encoding: set by lavc
853
     * - decoding: set by user
854
     */
855
     int bits_per_sample;
856
    
857
    /**
858
     * prediction method (needed for huffyuv).
859
     * - encoding: set by user
860
     * - decoding: unused
861
     */
862
     int prediction_method;
863
#define FF_PRED_LEFT   0
864
#define FF_PRED_PLANE  1
865
#define FF_PRED_MEDIAN 2
866
    
867
    /**
868
     * aspect ratio (0 if unknown).
869
     * - encoding: set by user.
870
     * - decoding: set by lavc.
871
     */
872
    float aspect_ratio;
873

    
874
    /**
875
     * the picture in the bitstream.
876
     * - encoding: set by lavc
877
     * - decoding: set by lavc
878
     */
879
    AVFrame *coded_frame;
880

    
881
    /**
882
     * debug.
883
     * - encoding: set by user.
884
     * - decoding: set by user.
885
     */
886
    int debug;
887
#define FF_DEBUG_PICT_INFO 1
888
#define FF_DEBUG_RC        2
889
#define FF_DEBUG_BITSTREAM 4
890
#define FF_DEBUG_MB_TYPE   8
891
#define FF_DEBUG_QP        16
892
#define FF_DEBUG_MV        32
893
#define FF_DEBUG_VIS_MV    0x00000040
894
#define FF_DEBUG_SKIP      0x00000080
895
#define FF_DEBUG_STARTCODE 0x00000100
896
#define FF_DEBUG_PTS       0x00000200
897
    
898
    /**
899
     * error.
900
     * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
901
     * - decoding: unused
902
     */
903
    uint64_t error[4];
904
    
905
    /**
906
     * minimum MB quantizer.
907
     * - encoding: set by user.
908
     * - decoding: unused
909
     */
910
    int mb_qmin;
911

    
912
    /**
913
     * maximum MB quantizer.
914
     * - encoding: set by user.
915
     * - decoding: unused
916
     */
917
    int mb_qmax;
918
    
919
    /**
920
     * motion estimation compare function.
921
     * - encoding: set by user.
922
     * - decoding: unused
923
     */
924
    int me_cmp;
925
    /**
926
     * subpixel motion estimation compare function.
927
     * - encoding: set by user.
928
     * - decoding: unused
929
     */
930
    int me_sub_cmp;
931
    /**
932
     * macroblock compare function (not supported yet).
933
     * - encoding: set by user.
934
     * - decoding: unused
935
     */
936
    int mb_cmp;
937
#define FF_CMP_SAD  0
938
#define FF_CMP_SSE  1
939
#define FF_CMP_SATD 2
940
#define FF_CMP_DCT  3
941
#define FF_CMP_PSNR 4
942
#define FF_CMP_BIT  5
943
#define FF_CMP_RD   6
944
#define FF_CMP_ZERO 7
945
#define FF_CMP_CHROMA 256
946
    
947
    /**
948
     * ME diamond size & shape.
949
     * - encoding: set by user.
950
     * - decoding: unused
951
     */
952
    int dia_size;
953

    
954
    /**
955
     * amount of previous MV predictors (2a+1 x 2a+1 square).
956
     * - encoding: set by user.
957
     * - decoding: unused
958
     */
959
    int last_predictor_count;
960

    
961
    /**
962
     * pre pass for motion estimation.
963
     * - encoding: set by user.
964
     * - decoding: unused
965
     */
966
    int pre_me;
967

    
968
    /**
969
     * motion estimation pre pass compare function.
970
     * - encoding: set by user.
971
     * - decoding: unused
972
     */
973
    int me_pre_cmp;
974

    
975
    /**
976
     * ME pre pass diamond size & shape.
977
     * - encoding: set by user.
978
     * - decoding: unused
979
     */
980
    int pre_dia_size;
981

    
982
    /**
983
     * subpel ME quality.
984
     * - encoding: set by user.
985
     * - decoding: unused
986
     */
987
    int me_subpel_quality;
988

    
989
    /**
990
     * callback to negotiate the pixelFormat.
991
     * @param fmt is the list of formats which are supported by the codec,
992
     * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
993
     * the first is allways the native one
994
     * @return the choosen format
995
     * - encoding: unused
996
     * - decoding: set by user, if not set then the native format will always be choosen
997
     */
998
    enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
999

    
1000
    /**
1001
     * DTG active format information (additionnal aspect ratio
1002
     * information only used in DVB MPEG2 transport streams). 0 if
1003
     * not set.
1004
     * 
1005
     * - encoding: unused.
1006
     * - decoding: set by decoder 
1007
     */
1008
    int dtg_active_format;
1009
#define FF_DTG_AFD_SAME         8
1010
#define FF_DTG_AFD_4_3          9
1011
#define FF_DTG_AFD_16_9         10
1012
#define FF_DTG_AFD_14_9         11
1013
#define FF_DTG_AFD_4_3_SP_14_9  13
1014
#define FF_DTG_AFD_16_9_SP_14_9 14
1015
#define FF_DTG_AFD_SP_4_3       15
1016

    
1017
    int me_range;
1018
    /**
1019
     * Maximum motion estimation search range in subpel units.
1020
     * if 0 then no limit
1021
     * 
1022
     * - encoding: set by user.
1023
     * - decoding: unused.
1024
     */
1025

    
1026
} AVCodecContext;
1027

    
1028

    
1029
/**
1030
 * AVOption.
1031
 */
1032
typedef struct AVOption {
1033
    /** options' name */
1034
    const char *name; /* if name is NULL, it indicates a link to next */
1035
    /** short English text help or const struct AVOption* subpointer */
1036
    const char *help; //        const struct AVOption* sub;
1037
    /** offset to context structure where the parsed value should be stored */
1038
    int offset;
1039
    /** options' type */
1040
    int type;
1041
#define FF_OPT_TYPE_BOOL 1      ///< boolean - true,1,on  (or simply presence)
1042
#define FF_OPT_TYPE_DOUBLE 2    ///< double
1043
#define FF_OPT_TYPE_INT 3       ///< integer
1044
#define FF_OPT_TYPE_STRING 4    ///< string (finished with \0)
1045
#define FF_OPT_TYPE_MASK 0x1f        ///< mask for types - upper bits are various flags
1046
//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
1047
#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
1048
#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
1049
    /** min value  (min == max   ->  no limits) */
1050
    double min;
1051
    /** maximum value for double/int */
1052
    double max;
1053
    /** default boo [0,1]l/double/int value */
1054
    double defval;
1055
    /**
1056
     * default string value (with optional semicolon delimited extra option-list
1057
     * i.e.   option1;option2;option3
1058
     * defval might select other then first argument as default
1059
     */
1060
    const char *defstr;
1061
#define FF_OPT_MAX_DEPTH 10
1062
} AVOption;
1063

    
1064
/**
1065
 * Parse option(s) and sets fields in passed structure
1066
 * @param strct        structure where the parsed results will be written
1067
 * @param list  list with AVOptions
1068
 * @param opts        string with options for parsing
1069
 */
1070
int avoption_parse(void* strct, const AVOption* list, const char* opts);
1071

    
1072

    
1073
/**
1074
 * AVCodec.
1075
 */
1076
typedef struct AVCodec {
1077
    const char *name;
1078
    int type;
1079
    int id;
1080
    int priv_data_size;
1081
    int (*init)(AVCodecContext *);
1082
    int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
1083
    int (*close)(AVCodecContext *);
1084
    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
1085
                  uint8_t *buf, int buf_size);
1086
    int capabilities;
1087
    const AVOption *options;
1088
    struct AVCodec *next;
1089
} AVCodec;
1090

    
1091
/**
1092
 * four components are given, that's all.
1093
 * the last component is alpha
1094
 */
1095
typedef struct AVPicture {
1096
    uint8_t *data[4];
1097
    int linesize[4];
1098
} AVPicture;
1099

    
1100
extern AVCodec ac3_encoder;
1101
extern AVCodec mp2_encoder;
1102
extern AVCodec mp3lame_encoder;
1103
extern AVCodec oggvorbis_encoder;
1104
extern AVCodec mpeg1video_encoder;
1105
extern AVCodec h263_encoder;
1106
extern AVCodec h263p_encoder;
1107
extern AVCodec rv10_encoder;
1108
extern AVCodec mjpeg_encoder;
1109
extern AVCodec mpeg4_encoder;
1110
extern AVCodec msmpeg4v1_encoder;
1111
extern AVCodec msmpeg4v2_encoder;
1112
extern AVCodec msmpeg4v3_encoder;
1113
extern AVCodec wmv1_encoder;
1114
extern AVCodec wmv2_encoder;
1115
extern AVCodec huffyuv_encoder;
1116

    
1117
extern AVCodec h263_decoder;
1118
extern AVCodec mpeg4_decoder;
1119
extern AVCodec msmpeg4v1_decoder;
1120
extern AVCodec msmpeg4v2_decoder;
1121
extern AVCodec msmpeg4v3_decoder;
1122
extern AVCodec wmv1_decoder;
1123
extern AVCodec wmv2_decoder;
1124
extern AVCodec mpeg_decoder;
1125
extern AVCodec h263i_decoder;
1126
extern AVCodec rv10_decoder;
1127
extern AVCodec svq1_decoder;
1128
extern AVCodec dvvideo_decoder;
1129
extern AVCodec dvaudio_decoder;
1130
extern AVCodec wmav1_decoder;
1131
extern AVCodec wmav2_decoder;
1132
extern AVCodec mjpeg_decoder;
1133
extern AVCodec mjpegb_decoder;
1134
extern AVCodec mp2_decoder;
1135
extern AVCodec mp3_decoder;
1136
extern AVCodec mace3_decoder;
1137
extern AVCodec mace6_decoder;
1138
extern AVCodec huffyuv_decoder;
1139
extern AVCodec oggvorbis_decoder;
1140
extern AVCodec cyuv_decoder;
1141

    
1142
/* pcm codecs */
1143
#define PCM_CODEC(id, name) \
1144
extern AVCodec name ## _decoder; \
1145
extern AVCodec name ## _encoder
1146

    
1147
PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
1148
PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
1149
PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
1150
PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
1151
PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
1152
PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
1153
PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
1154
PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
1155

    
1156
/* adpcm codecs */
1157

    
1158
PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
1159
PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
1160
PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
1161

    
1162
#undef PCM_CODEC
1163

    
1164
/* dummy raw video codec */
1165
extern AVCodec rawvideo_codec;
1166

    
1167
/* the following codecs use external GPL libs */
1168
extern AVCodec ac3_decoder;
1169

    
1170
/* resample.c */
1171

    
1172
struct ReSampleContext;
1173

    
1174
typedef struct ReSampleContext ReSampleContext;
1175

    
1176
ReSampleContext *audio_resample_init(int output_channels, int input_channels, 
1177
                                     int output_rate, int input_rate);
1178
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
1179
void audio_resample_close(ReSampleContext *s);
1180

    
1181
/* YUV420 format is assumed ! */
1182

    
1183
struct ImgReSampleContext;
1184

    
1185
typedef struct ImgReSampleContext ImgReSampleContext;
1186

    
1187
ImgReSampleContext *img_resample_init(int output_width, int output_height,
1188
                                      int input_width, int input_height);
1189

    
1190
ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
1191
                                      int iwidth, int iheight,
1192
                                      int topBand, int bottomBand,
1193
                                      int leftBand, int rightBand);
1194

    
1195
void img_resample(ImgReSampleContext *s, 
1196
                  AVPicture *output, AVPicture *input);
1197

    
1198
void img_resample_close(ImgReSampleContext *s);
1199

    
1200
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
1201
                   int pix_fmt, int width, int height);
1202
int avpicture_get_size(int pix_fmt, int width, int height);
1203
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
1204
const char *avcodec_get_pix_fmt_name(int pix_fmt);
1205

    
1206
/* convert among pixel formats */
1207
int img_convert(AVPicture *dst, int dst_pix_fmt,
1208
                AVPicture *src, int pix_fmt, 
1209
                int width, int height);
1210

    
1211
/* deinterlace a picture */
1212
int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
1213
                          int pix_fmt, int width, int height);
1214

    
1215
/* external high level API */
1216

    
1217
extern AVCodec *first_avcodec;
1218

    
1219
/* returns LIBAVCODEC_VERSION_INT constant */
1220
unsigned avcodec_version(void);
1221
/* returns LIBAVCODEC_BUILD constant */
1222
unsigned avcodec_build(void);
1223
void avcodec_init(void);
1224

    
1225
void register_avcodec(AVCodec *format);
1226
AVCodec *avcodec_find_encoder(enum CodecID id);
1227
AVCodec *avcodec_find_encoder_by_name(const char *name);
1228
AVCodec *avcodec_find_decoder(enum CodecID id);
1229
AVCodec *avcodec_find_decoder_by_name(const char *name);
1230
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
1231

    
1232
void avcodec_get_context_defaults(AVCodecContext *s);
1233
AVCodecContext *avcodec_alloc_context(void);
1234
AVFrame *avcodec_alloc_frame(void);
1235

    
1236
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
1237
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
1238

    
1239
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
1240
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, 
1241
                         int *frame_size_ptr,
1242
                         uint8_t *buf, int buf_size);
1243
int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, 
1244
                         int *got_picture_ptr,
1245
                         uint8_t *buf, int buf_size);
1246
int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, 
1247
                        int *data_size_ptr,
1248
                        uint8_t *buf, int buf_size);
1249
int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
1250
                         const short *samples);
1251
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
1252
                         const AVFrame *pict);
1253

    
1254
int avcodec_close(AVCodecContext *avctx);
1255

    
1256
void avcodec_register_all(void);
1257

    
1258
void avcodec_flush_buffers(AVCodecContext *avctx);
1259

    
1260

    
1261

    
1262
/**
1263
 * Interface for 0.5.0 version
1264
 *
1265
 * do not even think about it's usage for this moment
1266
 */
1267

    
1268
typedef struct {
1269
    /// compressed size used from given memory buffer
1270
    int size;
1271
    /// I/P/B frame type
1272
    int frame_type;
1273
} avc_enc_result_t;
1274

    
1275
/**
1276
 * Commands
1277
 * order can't be changed - once it was defined
1278
 */
1279
typedef enum {
1280
    // general commands
1281
    AVC_OPEN_BY_NAME = 0xACA000,
1282
    AVC_OPEN_BY_CODEC_ID,
1283
    AVC_OPEN_BY_FOURCC,
1284
    AVC_CLOSE,
1285

    
1286
    AVC_FLUSH,
1287
    // pin - struct { uint8_t* src, uint_t src_size }
1288
    // pout - struct { AVPicture* img, consumed_bytes,
1289
    AVC_DECODE,
1290
    // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
1291
    // pout - uint_t used_from_dest_size
1292
    AVC_ENCODE, 
1293

    
1294
    // query/get video commands
1295
    AVC_GET_VERSION = 0xACB000,
1296
    AVC_GET_WIDTH,
1297
    AVC_GET_HEIGHT,
1298
    AVC_GET_DELAY,
1299
    AVC_GET_QUANT_TABLE,
1300
    // ...
1301

    
1302
    // query/get audio commands
1303
    AVC_GET_FRAME_SIZE = 0xABC000,
1304

    
1305
    // maybe define some simple structure which
1306
    // might be passed to the user - but they can't
1307
    // contain any codec specific parts and these
1308
    // calls are usualy necessary only few times
1309

    
1310
    // set video commands
1311
    AVC_SET_WIDTH = 0xACD000,
1312
    AVC_SET_HEIGHT,
1313

    
1314
    // set video encoding commands
1315
    AVC_SET_FRAME_RATE = 0xACD800,
1316
    AVC_SET_QUALITY,
1317
    AVC_SET_HURRY_UP,
1318

    
1319
    // set audio commands
1320
    AVC_SET_SAMPLE_RATE = 0xACE000,
1321
    AVC_SET_CHANNELS,
1322

    
1323
} avc_cmd_t;
1324

    
1325
/**
1326
 * \param handle  allocated private structure by libavcodec
1327
 *                for initialization pass NULL - will be returned pout
1328
 *                user is supposed to know nothing about its structure
1329
 * \param cmd     type of operation to be performed
1330
 * \param pint    input parameter
1331
 * \param pout    output parameter
1332
 *
1333
 * \returns  command status - eventually for query command it might return
1334
 * integer resulting value
1335
 */
1336
int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
1337

    
1338
/* memory */
1339
void *av_malloc(unsigned int size);
1340
void *av_mallocz(unsigned int size);
1341
void *av_realloc(void *ptr, unsigned int size);
1342
void av_free(void *ptr);
1343
char *av_strdup(const char *s);
1344
void __av_freep(void **ptr);
1345
#define av_freep(p) __av_freep((void **)(p))
1346
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
1347
/* for static data only */
1348
/* call av_free_static to release all staticaly allocated tables */
1349
void av_free_static(void);
1350
void *__av_mallocz_static(void** location, unsigned int size);
1351
#define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
1352

    
1353
#ifdef __cplusplus
1354
}
1355
#endif
1356

    
1357
#endif /* AVCODEC_H */