Statistics
| Branch: | Revision:

ffmpeg / libavcodec / avcodec.h @ 46b4feec

History | View | Annotate | Download (38.6 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       4662
19
#define LIBAVCODEC_BUILD_STR   "4662"
20

    
21
#define LIBAVCODEC_IDENT        "FFmpeg" LIBAVCODEC_VERSION "b" LIBAVCODEC_BUILD_STR
22

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

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

    
63
    /* various adpcm codecs */
64
    CODEC_ID_ADPCM_IMA_QT,
65
    CODEC_ID_ADPCM_IMA_WAV,
66
    CODEC_ID_ADPCM_MS,
67
};
68

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

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

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

    
102
/* in bytes */
103
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072
104

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

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

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

    
128
/* only for ME compatiblity with old apps */
129
extern int motion_estimation_method;
130

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

    
135

    
136
#define FF_MAX_B_FRAMES 8
137

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

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

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

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

    
313

    
314
#define FF_BUFFER_TYPE_INTERNAL 1
315
#define FF_BUFFER_TYPE_USER     2 ///< Direct rendering buffers
316
#define FF_BUFFER_TYPE_SHARED   4 ///< buffer from somewher else, dont dealloc
317

    
318

    
319
#define FF_I_TYPE 1 // Intra
320
#define FF_P_TYPE 2 // Predicted
321
#define FF_B_TYPE 3 // Bi-dir predicted
322
#define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
323

    
324
typedef struct AVFrame {
325
    FF_COMMON_FRAME
326
} AVFrame;
327

    
328
#define DEFAULT_FRAME_RATE_BASE 1001000
329

    
330
/**
331
 * main external api structure.
332
 */
333
typedef struct AVCodecContext {
334
    /**
335
     * the average bitrate.
336
     * - encoding: set by user. unused for constant quantizer encoding
337
     * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream 
338
     */
339
    int bit_rate;
340

    
341
    /**
342
     * number of bits the bitstream is allowed to diverge from the reference.
343
     *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
344
     * - encoding: set by user. unused for constant quantizer encoding
345
     * - decoding: unused
346
     */
347
    int bit_rate_tolerance; 
348

    
349
    /**
350
     * CODEC_FLAG_*.
351
     * - encoding: set by user.
352
     * - decoding: set by user.
353
     */
354
    int flags;
355

    
356
    /**
357
     * some codecs needs additionnal format info. It is stored here
358
     * - encoding: set by user. 
359
     * - decoding: set by lavc. (FIXME is this ok?)
360
     */
361
    int sub_id;
362

    
363
    /**
364
     * motion estimation algorithm used for video coding.
365
     * - encoding: MUST be set by user.
366
     * - decoding: unused
367
     */
368
    int me_method;
369

    
370
    /**
371
     * some codecs need / can use extra-data like huffman tables.
372
     * mjpeg: huffman tables
373
     * rv10: additional flags
374
     * mpeg4: global headers (they can be in the bitstream or here)
375
     * - encoding: set/allocated/freed by lavc.
376
     * - decoding: set/allocated/freed by user.
377
     */
378
    void *extradata;
379
    int extradata_size;
380
    
381
    /* video only */
382
    /**
383
     * frames per sec multiplied by frame_rate_base.
384
     * for variable fps this is the precission, so if the timestamps 
385
     * can be specified in msec precssion then this is 1000*frame_rate_base
386
     * - encoding: MUST be set by user
387
     * - decoding: set by lavc. 0 or the frame_rate if available
388
     */
389
    int frame_rate;
390
    
391
    /**
392
     * frame_rate_base.
393
     * for variable fps this is 1
394
     * - encoding: set by user.
395
     * - decoding: set by lavc.
396
     */
397
    int frame_rate_base;
398

    
399
    /**
400
     * width / height.
401
     * - encoding: MUST be set by user. 
402
     * - decoding: set by user, some codecs might override / change it during playback
403
     */
404
    int width, height;
405
    
406
#define FF_ASPECT_SQUARE 1
407
#define FF_ASPECT_4_3_625 2
408
#define FF_ASPECT_4_3_525 3
409
#define FF_ASPECT_16_9_625 4
410
#define FF_ASPECT_16_9_525 5
411
#define FF_ASPECT_EXTENDED 15
412

    
413
    /**
414
     * the number of pictures in a group of pitures, or 0 for intra_only.
415
     * - encoding: set by user.
416
     * - decoding: unused
417
     */
418
    int gop_size;
419

    
420
    /**
421
     * pixel format, see PIX_FMT_xxx.
422
     * - encoding: unused
423
     * - decoding: set by lavc.
424
     */
425
    enum PixelFormat pix_fmt;
426
 
427
    /**
428
     * Frame rate emulation. If not zero lower layer (i.e. format handler) 
429
     * has to read frames at native frame rate.
430
     * - encoding: set by user.
431
     * - decoding: unused.
432
     */
433
    int rate_emu;
434
       
435
    /**
436
     * if non NULL, 'draw_horiz_band' is called by the libavcodec
437
     * decoder to draw an horizontal band. It improve cache usage. Not
438
     * all codecs can do that. You must check the codec capabilities
439
     * before
440
     * - encoding: unused
441
     * - decoding: set by user.
442
     */
443
    void (*draw_horiz_band)(struct AVCodecContext *s,
444
                            uint8_t **src_ptr, int linesize,
445
                            int y, int width, int height);
446

    
447
    /* audio only */
448
    int sample_rate; ///< samples per sec 
449
    int channels;
450
    int sample_fmt;  ///< sample format, currenly unused 
451

    
452
    /* the following data should not be initialized */
453
    int frame_size;     ///< in samples, initialized when calling 'init' 
454
    int frame_number;   ///< audio or video frame number 
455
    int real_pict_num;  ///< returns the real picture number of previous encoded frame 
456
    
457
    /**
458
     * number of frames the decoded output will be delayed relative to 
459
     * the encoded input.
460
     * - encoding: set by lavc.
461
     * - decoding: unused
462
     */
463
    int delay;
464
    
465
    /* - encoding parameters */
466
    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
467
    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0) 
468
    
469
    /**
470
     * minimum quantizer.
471
     * - encoding: set by user.
472
     * - decoding: unused
473
     */
474
    int qmin;
475

    
476
    /**
477
     * maximum quantizer.
478
     * - encoding: set by user.
479
     * - decoding: unused
480
     */
481
    int qmax;
482

    
483
    /**
484
     * maximum quantizer difference etween frames.
485
     * - encoding: set by user.
486
     * - decoding: unused
487
     */
488
    int max_qdiff;
489

    
490
    /**
491
     * maximum number of b frames between non b frames.
492
     * note: the output will be delayed by max_b_frames+1 relative to the input
493
     * - encoding: set by user.
494
     * - decoding: unused
495
     */
496
    int max_b_frames;
497

    
498
    /**
499
     * qscale factor between ip and b frames.
500
     * - encoding: set by user.
501
     * - decoding: unused
502
     */
503
    float b_quant_factor;
504
    
505
    /** obsolete FIXME remove */
506
    int rc_strategy;
507
    int b_frame_strategy;
508

    
509
    /**
510
     * hurry up amount.
511
     * - encoding: unused
512
     * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
513
     */
514
    int hurry_up;
515
    
516
    struct AVCodec *codec;
517
    
518
    void *priv_data;
519

    
520
    /* The following data is for RTP friendly coding */
521
    /* By now only H.263/H.263+/MPEG4 coder honours this   */
522
    int rtp_mode;   /* 1 for activate RTP friendly-mode           */
523
                    /* highers numbers represent more error-prone */
524
                    /* enviroments, by now just "1" exist         */
525
    
526
    int rtp_payload_size;   /* The size of the RTP payload, the coder will  */
527
                            /* do it's best to deliver a chunk with size    */
528
                            /* below rtp_payload_size, the chunk will start */
529
                            /* with a start code on some codecs like H.263  */
530
                            /* This doesn't take account of any particular  */
531
                            /* headers inside the transmited RTP payload    */
532

    
533
    
534
    /* The RTP callcack: This function is called  */
535
    /* every time the encoder as a packet to send */
536
    /* Depends on the encoder if the data starts  */
537
    /* with a Start Code (it should) H.263 does   */
538
    void (*rtp_callback)(void *data, int size, int packet_number); 
539

    
540
    /* statistics, used for 2-pass encoding */
541
    int mv_bits;
542
    int header_bits;
543
    int i_tex_bits;
544
    int p_tex_bits;
545
    int i_count;
546
    int p_count;
547
    int skip_count;
548
    int misc_bits;
549
    
550
    /**
551
     * number of bits used for the previously encoded frame.
552
     * - encoding: set by lavc
553
     * - decoding: unused
554
     */
555
    int frame_bits;
556

    
557
    /**
558
     * private data of the user, can be used to carry app specific stuff.
559
     * - encoding: set by user
560
     * - decoding: set by user
561
     */
562
    void *opaque;
563

    
564
    char codec_name[32];
565
    enum CodecType codec_type; /* see CODEC_TYPE_xxx */
566
    enum CodecID codec_id; /* see CODEC_ID_xxx */
567
    
568
    /**
569
     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
570
     * this is used to workaround some encoder bugs
571
     * - encoding: unused
572
     * - decoding: set by user, will be converted to upper case by lavc during init
573
     */
574
    unsigned int codec_tag;
575
    
576
    /**
577
     * workaround bugs in encoders which sometimes cannot be detected automatically.
578
     * - encoding: unused
579
     * - decoding: set by user
580
     */
581
    int workaround_bugs;
582
#define FF_BUG_AUTODETECT       1  ///< autodetection
583
#define FF_BUG_OLD_MSMPEG4      2
584
#define FF_BUG_XVID_ILACE       4
585
#define FF_BUG_UMP4             8
586
#define FF_BUG_NO_PADDING       16
587
#define FF_BUG_AC_VLC           32
588
#define FF_BUG_QPEL_CHROMA      64
589
#define FF_BUG_STD_QPEL         128
590
#define FF_BUG_QPEL_CHROMA2     256
591
#define FF_BUG_DIRECT_BLOCKSIZE 512
592
#define FF_BUG_EDGE             1024
593
//#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
594
        
595
    /**
596
     * luma single coeff elimination threshold.
597
     * - encoding: set by user
598
     * - decoding: unused
599
     */
600
    int luma_elim_threshold;
601
    
602
    /**
603
     * chroma single coeff elimination threshold.
604
     * - encoding: set by user
605
     * - decoding: unused
606
     */
607
    int chroma_elim_threshold;
608
    
609
    /**
610
     * strictly follow the std (MPEG4, ...).
611
     * - encoding: set by user
612
     * - decoding: unused
613
     */
614
    int strict_std_compliance;
615
    
616
    /**
617
     * qscale offset between ip and b frames.
618
     * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
619
     * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
620
     * - encoding: set by user.
621
     * - decoding: unused
622
     */
623
    float b_quant_offset;
624
    
625
    /**
626
     * error resilience higher values will detect more errors but may missdetect
627
     * some more or less valid parts as errors.
628
     * - encoding: unused
629
     * - decoding: set by user
630
     */
631
    int error_resilience;
632
#define FF_ER_CAREFULL        1
633
#define FF_ER_COMPLIANT       2
634
#define FF_ER_AGGRESSIVE      3
635
#define FF_ER_VERY_AGGRESSIVE 4
636
    
637
    /**
638
     * called at the beginning of each frame to get a buffer for it.
639
     * if pic.reference is set then the frame will be read later by lavc
640
     * - encoding: unused
641
     * - decoding: set by lavc, user can override
642
     */
643
    int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
644
    
645
    /**
646
     * called to release buffers which where allocated with get_buffer.
647
     * a released buffer can be reused in get_buffer()
648
     * pic.data[*] must be set to NULL
649
     * - encoding: unused
650
     * - decoding: set by lavc, user can override
651
     */
652
    void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
653

    
654
    /**
655
     * is 1 if the decoded stream contains b frames, 0 otherwise.
656
     * - encoding: unused
657
     * - decoding: set by lavc
658
     */
659
    int has_b_frames;
660
    
661
    int block_align; ///< used by some WAV based audio codecs
662
    
663
    int parse_only; /* - decoding only: if true, only parsing is done
664
                       (function avcodec_parse_frame()). The frame
665
                       data is returned. Only MPEG codecs support this now. */
666
    
667
    /**
668
     * 0-> h263 quant 1-> mpeg quant.
669
     * - encoding: set by user.
670
     * - decoding: unused
671
     */
672
    int mpeg_quant;
673
    
674
    /**
675
     * pass1 encoding statistics output buffer.
676
     * - encoding: set by lavc
677
     * - decoding: unused
678
     */
679
    char *stats_out;
680
    
681
    /**
682
     * pass2 encoding statistics input buffer.
683
     * concatenated stuff from stats_out of pass1 should be placed here
684
     * - encoding: allocated/set/freed by user
685
     * - decoding: unused
686
     */
687
    char *stats_in;
688
    
689
    /**
690
     * ratecontrol qmin qmax limiting method.
691
     * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax
692
     * - encoding: set by user.
693
     * - decoding: unused
694
     */
695
    float rc_qsquish;
696

    
697
    float rc_qmod_amp;
698
    int rc_qmod_freq;
699
    
700
    /**
701
     * ratecontrol override, see RcOverride.
702
     * - encoding: allocated/set/freed by user.
703
     * - decoding: unused
704
     */
705
    RcOverride *rc_override;
706
    int rc_override_count;
707
    
708
    /**
709
     * rate control equation.
710
     * - encoding: set by user
711
     * - decoding: unused
712
     */
713
    char *rc_eq;
714
    
715
    /**
716
     * maximum bitrate.
717
     * - encoding: set by user.
718
     * - decoding: unused
719
     */
720
    int rc_max_rate;
721
    
722
    /**
723
     * minimum bitrate.
724
     * - encoding: set by user.
725
     * - decoding: unused
726
     */
727
    int rc_min_rate;
728
    
729
    /**
730
     * decoder bitstream buffer size.
731
     * - encoding: set by user.
732
     * - decoding: unused
733
     */
734
    int rc_buffer_size;
735
    float rc_buffer_aggressivity;
736

    
737
    /**
738
     * qscale factor between p and i frames.
739
     * - encoding: set by user.
740
     * - decoding: unused
741
     */
742
    float i_quant_factor;
743
    
744
    /**
745
     * qscale offset between p and i frames.
746
     * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
747
     * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
748
     * - encoding: set by user.
749
     * - decoding: unused
750
     */
751
    float i_quant_offset;
752
    
753
    /**
754
     * initial complexity for pass1 ratecontrol.
755
     * - encoding: set by user.
756
     * - decoding: unused
757
     */
758
    float rc_initial_cplx;
759

    
760
    /**
761
     * dct algorithm, see FF_DCT_* below.
762
     * - encoding: set by user
763
     * - decoding: unused
764
     */
765
    int dct_algo;
766
#define FF_DCT_AUTO    0
767
#define FF_DCT_FASTINT 1
768
#define FF_DCT_INT     2
769
#define FF_DCT_MMX     3
770
#define FF_DCT_MLIB    4
771
#define FF_DCT_ALTIVEC 5
772
    
773
    /**
774
     * luminance masking (0-> disabled).
775
     * - encoding: set by user
776
     * - decoding: unused
777
     */
778
    float lumi_masking;
779
    
780
    /**
781
     * temporary complexity masking (0-> disabled).
782
     * - encoding: set by user
783
     * - decoding: unused
784
     */
785
    float temporal_cplx_masking;
786
    
787
    /**
788
     * spatial complexity masking (0-> disabled).
789
     * - encoding: set by user
790
     * - decoding: unused
791
     */
792
    float spatial_cplx_masking;
793
    
794
    /**
795
     * p block masking (0-> disabled).
796
     * - encoding: set by user
797
     * - decoding: unused
798
     */
799
    float p_masking;
800

    
801
    /**
802
     * darkness masking (0-> disabled).
803
     * - encoding: set by user
804
     * - decoding: unused
805
     */
806
    float dark_masking;
807
    
808
    /**
809
     * idct algorithm, see FF_IDCT_* below.
810
     * - encoding: set by user
811
     * - decoding: set by user
812
     */
813
    int idct_algo;
814
#define FF_IDCT_AUTO         0
815
#define FF_IDCT_INT          1
816
#define FF_IDCT_SIMPLE       2
817
#define FF_IDCT_SIMPLEMMX    3
818
#define FF_IDCT_LIBMPEG2MMX  4
819
#define FF_IDCT_PS2          5
820
#define FF_IDCT_MLIB         6
821
#define FF_IDCT_ARM          7
822
#define FF_IDCT_ALTIVEC      8
823

    
824
    /**
825
     * slice count.
826
     * - encoding: set by lavc
827
     * - decoding: set by user (or 0)
828
     */
829
    int slice_count;
830
    /**
831
     * slice offsets in the frame in bytes.
832
     * - encoding: set/allocated by lavc
833
     * - decoding: set/allocated by user (or NULL)
834
     */
835
    int *slice_offset;
836

    
837
    /**
838
     * error concealment flags.
839
     * - encoding: unused
840
     * - decoding: set by user
841
     */
842
    int error_concealment;
843
#define FF_EC_GUESS_MVS   1
844
#define FF_EC_DEBLOCK     2
845

    
846
    /**
847
     * dsp_mask could be add used to disable unwanted CPU features
848
     * CPU features (i.e. MMX, SSE. ...)
849
     *
850
     * with FORCE flag you may instead enable given CPU features
851
     * (Dangerous: usable in case of misdetection, improper usage however will
852
     * result into program crash)
853
     */
854
    unsigned dsp_mask;
855
#define FF_MM_FORCE        0x80000000 /* force usage of selected flags (OR) */
856
    /* lower 16 bits - CPU features */
857
#ifdef HAVE_MMX
858
#define FF_MM_MMX        0x0001 /* standard MMX */
859
#define FF_MM_3DNOW        0x0004 /* AMD 3DNOW */
860
#define FF_MM_MMXEXT        0x0002 /* SSE integer functions or AMD MMX ext */
861
#define FF_MM_SSE        0x0008 /* SSE functions */
862
#define FF_MM_SSE2        0x0010 /* PIV SSE2 functions */
863
#endif /* HAVE_MMX */
864

    
865
    /**
866
     * bits per sample/pixel from the demuxer (needed for huffyuv).
867
     * - encoding: set by lavc
868
     * - decoding: set by user
869
     */
870
     int bits_per_sample;
871
    
872
    /**
873
     * prediction method (needed for huffyuv).
874
     * - encoding: set by user
875
     * - decoding: unused
876
     */
877
     int prediction_method;
878
#define FF_PRED_LEFT   0
879
#define FF_PRED_PLANE  1
880
#define FF_PRED_MEDIAN 2
881
    
882
    /**
883
     * aspect ratio (0 if unknown).
884
     * - encoding: set by user.
885
     * - decoding: set by lavc.
886
     */
887
    float aspect_ratio;
888

    
889
    /**
890
     * the picture in the bitstream.
891
     * - encoding: set by lavc
892
     * - decoding: set by lavc
893
     */
894
    AVFrame *coded_frame;
895

    
896
    /**
897
     * debug.
898
     * - encoding: set by user.
899
     * - decoding: set by user.
900
     */
901
    int debug;
902
#define FF_DEBUG_PICT_INFO 1
903
#define FF_DEBUG_RC        2
904
#define FF_DEBUG_BITSTREAM 4
905
#define FF_DEBUG_MB_TYPE   8
906
#define FF_DEBUG_QP        16
907
#define FF_DEBUG_MV        32
908
#define FF_DEBUG_VIS_MV    0x00000040
909
#define FF_DEBUG_SKIP      0x00000080
910
#define FF_DEBUG_STARTCODE 0x00000100
911
#define FF_DEBUG_PTS       0x00000200
912
#define FF_DEBUG_ER        0x00000400
913
    
914
    /**
915
     * error.
916
     * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
917
     * - decoding: unused
918
     */
919
    uint64_t error[4];
920
    
921
    /**
922
     * minimum MB quantizer.
923
     * - encoding: set by user.
924
     * - decoding: unused
925
     */
926
    int mb_qmin;
927

    
928
    /**
929
     * maximum MB quantizer.
930
     * - encoding: set by user.
931
     * - decoding: unused
932
     */
933
    int mb_qmax;
934
    
935
    /**
936
     * motion estimation compare function.
937
     * - encoding: set by user.
938
     * - decoding: unused
939
     */
940
    int me_cmp;
941
    /**
942
     * subpixel motion estimation compare function.
943
     * - encoding: set by user.
944
     * - decoding: unused
945
     */
946
    int me_sub_cmp;
947
    /**
948
     * macroblock compare function (not supported yet).
949
     * - encoding: set by user.
950
     * - decoding: unused
951
     */
952
    int mb_cmp;
953
#define FF_CMP_SAD  0
954
#define FF_CMP_SSE  1
955
#define FF_CMP_SATD 2
956
#define FF_CMP_DCT  3
957
#define FF_CMP_PSNR 4
958
#define FF_CMP_BIT  5
959
#define FF_CMP_RD   6
960
#define FF_CMP_ZERO 7
961
#define FF_CMP_CHROMA 256
962
    
963
    /**
964
     * ME diamond size & shape.
965
     * - encoding: set by user.
966
     * - decoding: unused
967
     */
968
    int dia_size;
969

    
970
    /**
971
     * amount of previous MV predictors (2a+1 x 2a+1 square).
972
     * - encoding: set by user.
973
     * - decoding: unused
974
     */
975
    int last_predictor_count;
976

    
977
    /**
978
     * pre pass for motion estimation.
979
     * - encoding: set by user.
980
     * - decoding: unused
981
     */
982
    int pre_me;
983

    
984
    /**
985
     * motion estimation pre pass compare function.
986
     * - encoding: set by user.
987
     * - decoding: unused
988
     */
989
    int me_pre_cmp;
990

    
991
    /**
992
     * ME pre pass diamond size & shape.
993
     * - encoding: set by user.
994
     * - decoding: unused
995
     */
996
    int pre_dia_size;
997

    
998
    /**
999
     * subpel ME quality.
1000
     * - encoding: set by user.
1001
     * - decoding: unused
1002
     */
1003
    int me_subpel_quality;
1004

    
1005
    /**
1006
     * callback to negotiate the pixelFormat.
1007
     * @param fmt is the list of formats which are supported by the codec,
1008
     * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
1009
     * the first is allways the native one
1010
     * @return the choosen format
1011
     * - encoding: unused
1012
     * - decoding: set by user, if not set then the native format will always be choosen
1013
     */
1014
    enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
1015

    
1016
    /**
1017
     * DTG active format information (additionnal aspect ratio
1018
     * information only used in DVB MPEG2 transport streams). 0 if
1019
     * not set.
1020
     * 
1021
     * - encoding: unused.
1022
     * - decoding: set by decoder 
1023
     */
1024
    int dtg_active_format;
1025
#define FF_DTG_AFD_SAME         8
1026
#define FF_DTG_AFD_4_3          9
1027
#define FF_DTG_AFD_16_9         10
1028
#define FF_DTG_AFD_14_9         11
1029
#define FF_DTG_AFD_4_3_SP_14_9  13
1030
#define FF_DTG_AFD_16_9_SP_14_9 14
1031
#define FF_DTG_AFD_SP_4_3       15
1032

    
1033
    /**
1034
     * Maximum motion estimation search range in subpel units.
1035
     * if 0 then no limit
1036
     * 
1037
     * - encoding: set by user.
1038
     * - decoding: unused.
1039
     */
1040
    int me_range;
1041

    
1042
} AVCodecContext;
1043

    
1044

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

    
1080
/**
1081
 * Parse option(s) and sets fields in passed structure
1082
 * @param strct        structure where the parsed results will be written
1083
 * @param list  list with AVOptions
1084
 * @param opts        string with options for parsing
1085
 */
1086
int avoption_parse(void* strct, const AVOption* list, const char* opts);
1087

    
1088

    
1089
/**
1090
 * AVCodec.
1091
 */
1092
typedef struct AVCodec {
1093
    const char *name;
1094
    int type;
1095
    int id;
1096
    int priv_data_size;
1097
    int (*init)(AVCodecContext *);
1098
    int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
1099
    int (*close)(AVCodecContext *);
1100
    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
1101
                  uint8_t *buf, int buf_size);
1102
    int capabilities;
1103
    const AVOption *options;
1104
    struct AVCodec *next;
1105
} AVCodec;
1106

    
1107
/**
1108
 * four components are given, that's all.
1109
 * the last component is alpha
1110
 */
1111
typedef struct AVPicture {
1112
    uint8_t *data[4];
1113
    int linesize[4];
1114
} AVPicture;
1115

    
1116
extern AVCodec ac3_encoder;
1117
extern AVCodec mp2_encoder;
1118
extern AVCodec mp3lame_encoder;
1119
extern AVCodec oggvorbis_encoder;
1120
extern AVCodec mpeg1video_encoder;
1121
extern AVCodec h263_encoder;
1122
extern AVCodec h263p_encoder;
1123
extern AVCodec rv10_encoder;
1124
extern AVCodec mjpeg_encoder;
1125
extern AVCodec mpeg4_encoder;
1126
extern AVCodec msmpeg4v1_encoder;
1127
extern AVCodec msmpeg4v2_encoder;
1128
extern AVCodec msmpeg4v3_encoder;
1129
extern AVCodec wmv1_encoder;
1130
extern AVCodec wmv2_encoder;
1131
extern AVCodec huffyuv_encoder;
1132

    
1133
extern AVCodec h263_decoder;
1134
extern AVCodec mpeg4_decoder;
1135
extern AVCodec msmpeg4v1_decoder;
1136
extern AVCodec msmpeg4v2_decoder;
1137
extern AVCodec msmpeg4v3_decoder;
1138
extern AVCodec wmv1_decoder;
1139
extern AVCodec wmv2_decoder;
1140
extern AVCodec mpeg_decoder;
1141
extern AVCodec h263i_decoder;
1142
extern AVCodec rv10_decoder;
1143
extern AVCodec svq1_decoder;
1144
extern AVCodec dvvideo_decoder;
1145
extern AVCodec dvaudio_decoder;
1146
extern AVCodec wmav1_decoder;
1147
extern AVCodec wmav2_decoder;
1148
extern AVCodec mjpeg_decoder;
1149
extern AVCodec mjpegb_decoder;
1150
extern AVCodec mp2_decoder;
1151
extern AVCodec mp3_decoder;
1152
extern AVCodec mace3_decoder;
1153
extern AVCodec mace6_decoder;
1154
extern AVCodec huffyuv_decoder;
1155
extern AVCodec oggvorbis_decoder;
1156
extern AVCodec cyuv_decoder;
1157

    
1158
/* pcm codecs */
1159
#define PCM_CODEC(id, name) \
1160
extern AVCodec name ## _decoder; \
1161
extern AVCodec name ## _encoder
1162

    
1163
PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
1164
PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
1165
PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
1166
PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
1167
PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
1168
PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
1169
PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
1170
PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
1171

    
1172
/* adpcm codecs */
1173

    
1174
PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
1175
PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
1176
PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
1177

    
1178
#undef PCM_CODEC
1179

    
1180
/* dummy raw video codec */
1181
extern AVCodec rawvideo_codec;
1182

    
1183
/* the following codecs use external GPL libs */
1184
extern AVCodec ac3_decoder;
1185

    
1186
/* resample.c */
1187

    
1188
struct ReSampleContext;
1189

    
1190
typedef struct ReSampleContext ReSampleContext;
1191

    
1192
ReSampleContext *audio_resample_init(int output_channels, int input_channels, 
1193
                                     int output_rate, int input_rate);
1194
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
1195
void audio_resample_close(ReSampleContext *s);
1196

    
1197
/* YUV420 format is assumed ! */
1198

    
1199
struct ImgReSampleContext;
1200

    
1201
typedef struct ImgReSampleContext ImgReSampleContext;
1202

    
1203
ImgReSampleContext *img_resample_init(int output_width, int output_height,
1204
                                      int input_width, int input_height);
1205

    
1206
ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
1207
                                      int iwidth, int iheight,
1208
                                      int topBand, int bottomBand,
1209
                                      int leftBand, int rightBand);
1210

    
1211
void img_resample(ImgReSampleContext *s, 
1212
                  AVPicture *output, AVPicture *input);
1213

    
1214
void img_resample_close(ImgReSampleContext *s);
1215

    
1216
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
1217
                   int pix_fmt, int width, int height);
1218
int avpicture_get_size(int pix_fmt, int width, int height);
1219
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
1220
const char *avcodec_get_pix_fmt_name(int pix_fmt);
1221

    
1222
/* convert among pixel formats */
1223
int img_convert(AVPicture *dst, int dst_pix_fmt,
1224
                AVPicture *src, int pix_fmt, 
1225
                int width, int height);
1226

    
1227
/* deinterlace a picture */
1228
int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
1229
                          int pix_fmt, int width, int height);
1230

    
1231
/* external high level API */
1232

    
1233
extern AVCodec *first_avcodec;
1234

    
1235
/* returns LIBAVCODEC_VERSION_INT constant */
1236
unsigned avcodec_version(void);
1237
/* returns LIBAVCODEC_BUILD constant */
1238
unsigned avcodec_build(void);
1239
void avcodec_init(void);
1240

    
1241
void register_avcodec(AVCodec *format);
1242
AVCodec *avcodec_find_encoder(enum CodecID id);
1243
AVCodec *avcodec_find_encoder_by_name(const char *name);
1244
AVCodec *avcodec_find_decoder(enum CodecID id);
1245
AVCodec *avcodec_find_decoder_by_name(const char *name);
1246
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
1247

    
1248
void avcodec_get_context_defaults(AVCodecContext *s);
1249
AVCodecContext *avcodec_alloc_context(void);
1250
AVFrame *avcodec_alloc_frame(void);
1251

    
1252
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
1253
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
1254

    
1255
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
1256
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, 
1257
                         int *frame_size_ptr,
1258
                         uint8_t *buf, int buf_size);
1259
int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, 
1260
                         int *got_picture_ptr,
1261
                         uint8_t *buf, int buf_size);
1262
int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, 
1263
                        int *data_size_ptr,
1264
                        uint8_t *buf, int buf_size);
1265
int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
1266
                         const short *samples);
1267
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
1268
                         const AVFrame *pict);
1269

    
1270
int avcodec_close(AVCodecContext *avctx);
1271

    
1272
void avcodec_register_all(void);
1273

    
1274
void avcodec_flush_buffers(AVCodecContext *avctx);
1275

    
1276
/* misc usefull functions */
1277
/**
1278
 * reduce a fraction.
1279
 * this is usefull for framerate calculations
1280
 * @param max the maximum allowed for dst_nom & dst_den
1281
 * @return 1 if exact, 0 otherwise
1282
 */
1283
int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
1284

    
1285
/**
1286
 * rescale a 64bit integer.
1287
 * a simple a*b/c isnt possible as it can overflow
1288
 */
1289
int64_t av_rescale(int64_t a, int b, int c);
1290

    
1291

    
1292
/**
1293
 * Interface for 0.5.0 version
1294
 *
1295
 * do not even think about it's usage for this moment
1296
 */
1297

    
1298
typedef struct {
1299
    /// compressed size used from given memory buffer
1300
    int size;
1301
    /// I/P/B frame type
1302
    int frame_type;
1303
} avc_enc_result_t;
1304

    
1305
/**
1306
 * Commands
1307
 * order can't be changed - once it was defined
1308
 */
1309
typedef enum {
1310
    // general commands
1311
    AVC_OPEN_BY_NAME = 0xACA000,
1312
    AVC_OPEN_BY_CODEC_ID,
1313
    AVC_OPEN_BY_FOURCC,
1314
    AVC_CLOSE,
1315

    
1316
    AVC_FLUSH,
1317
    // pin - struct { uint8_t* src, uint_t src_size }
1318
    // pout - struct { AVPicture* img, consumed_bytes,
1319
    AVC_DECODE,
1320
    // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
1321
    // pout - uint_t used_from_dest_size
1322
    AVC_ENCODE, 
1323

    
1324
    // query/get video commands
1325
    AVC_GET_VERSION = 0xACB000,
1326
    AVC_GET_WIDTH,
1327
    AVC_GET_HEIGHT,
1328
    AVC_GET_DELAY,
1329
    AVC_GET_QUANT_TABLE,
1330
    // ...
1331

    
1332
    // query/get audio commands
1333
    AVC_GET_FRAME_SIZE = 0xABC000,
1334

    
1335
    // maybe define some simple structure which
1336
    // might be passed to the user - but they can't
1337
    // contain any codec specific parts and these
1338
    // calls are usualy necessary only few times
1339

    
1340
    // set video commands
1341
    AVC_SET_WIDTH = 0xACD000,
1342
    AVC_SET_HEIGHT,
1343

    
1344
    // set video encoding commands
1345
    AVC_SET_FRAME_RATE = 0xACD800,
1346
    AVC_SET_QUALITY,
1347
    AVC_SET_HURRY_UP,
1348

    
1349
    // set audio commands
1350
    AVC_SET_SAMPLE_RATE = 0xACE000,
1351
    AVC_SET_CHANNELS,
1352

    
1353
} avc_cmd_t;
1354

    
1355
/**
1356
 * \param handle  allocated private structure by libavcodec
1357
 *                for initialization pass NULL - will be returned pout
1358
 *                user is supposed to know nothing about its structure
1359
 * \param cmd     type of operation to be performed
1360
 * \param pint    input parameter
1361
 * \param pout    output parameter
1362
 *
1363
 * \returns  command status - eventually for query command it might return
1364
 * integer resulting value
1365
 */
1366
int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
1367

    
1368
/* memory */
1369
void *av_malloc(unsigned int size);
1370
void *av_mallocz(unsigned int size);
1371
void *av_realloc(void *ptr, unsigned int size);
1372
void av_free(void *ptr);
1373
char *av_strdup(const char *s);
1374
void __av_freep(void **ptr);
1375
#define av_freep(p) __av_freep((void **)(p))
1376
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
1377
/* for static data only */
1378
/* call av_free_static to release all staticaly allocated tables */
1379
void av_free_static(void);
1380
void *__av_mallocz_static(void** location, unsigned int size);
1381
#define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
1382

    
1383
#ifdef __cplusplus
1384
}
1385
#endif
1386

    
1387
#endif /* AVCODEC_H */