]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blob - libav/avcodec.h
test
[frescor/ffmpeg.git] / libav / avcodec.h
1 #include "common.h"
2
3 enum CodecID {
4     CODEC_ID_NONE, 
5     CODEC_ID_MPEG1VIDEO,
6     CODEC_ID_H263,
7     CODEC_ID_RV10,
8     CODEC_ID_MP2,
9     CODEC_ID_AC3,
10     CODEC_ID_MJPEG,
11 };
12
13 enum CodecType {
14     CODEC_TYPE_VIDEO,
15     CODEC_TYPE_AUDIO,
16 };
17     
18 typedef struct AVEncodeContext {
19     int bit_rate;
20     int rate; /* frames per sec or samples per sec */
21
22     /* video only */
23     int width, height;
24     int gop_size; /* 0 = intra only */
25     
26     /* audio only */
27     int channels;
28
29     /* the following data should not be initialized */
30     int frame_size; /* in samples, initialized when calling 'init' */
31     int frame_number; /* audio or video frame number */
32     int key_frame;    /* true if the previous compressed frame was 
33                          a key frame (intra, or seekable) */
34     struct AVEncoder *codec;
35     void *priv_data;
36 } AVEncodeContext;
37
38 typedef struct AVEncoder {
39     char *name;
40     int type;
41     int id;
42     int priv_data_size;
43     int (*init)(AVEncodeContext *);
44     int (*encode)(AVEncodeContext *, UINT8 *buf, int buf_size, void *data);
45     int (*close)(AVEncodeContext *);
46     struct AVEncoder *next;
47 } AVEncoder;
48
49 extern AVEncoder ac3_encoder;
50 extern AVEncoder mp2_encoder;
51 extern AVEncoder mpeg1video_encoder;
52 extern AVEncoder h263_encoder;
53 extern AVEncoder rv10_encoder;
54 extern AVEncoder mjpeg_encoder;
55
56 /* resample.c */
57
58 typedef struct {
59     /* fractional resampling */
60     UINT32 incr; /* fractional increment */
61     UINT32 frac;
62     int last_sample;
63     /* integer down sample */
64     int iratio;  /* integer divison ratio */
65     int icount, isum;
66     int inv;
67 } ReSampleChannelContext;
68
69 typedef struct {
70     ReSampleChannelContext channel_ctx[2];
71     float ratio;
72     /* channel convert */
73     int input_channels, output_channels;
74 } ReSampleContext;
75
76 int audio_resample_init(ReSampleContext *s, 
77                         int output_channels, int input_channels, 
78                         int output_rate, int input_rate);
79 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);