32 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 18432
34 /* motion estimation type */
35 extern int motion_estimation_method;
41 /* encoding support */
43 #define CODEC_FLAG_HQ 0x0001 /* high quality (non real time) encoding */
44 #define CODEC_FLAG_QSCALE 0x0002 /* use fixed qscale */
46 #define FRAME_RATE_BASE 10000
48 typedef struct AVCodecContext {
51 int sub_id; /* some codecs needs additionnal format info. It is
54 int frame_rate; /* frames per sec multiplied by FRAME_RATE_BASE */
56 int gop_size; /* 0 = intra only */
57 int pix_fmt; /* pixel format, see PIX_FMT_xxx */
59 int sample_rate; /* samples per sec */
62 /* the following data should not be initialized */
63 int frame_size; /* in samples, initialized when calling 'init' */
64 int frame_number; /* audio or video frame number */
65 int key_frame; /* true if the previous compressed frame was
66 a key frame (intra, or seekable) */
67 int quality; /* quality of the previous encoded frame
68 (between 1 (good) and 31 (bad)) */
69 struct AVCodec *codec;
72 /* the following fields are ignored */
74 int codec_type; /* see CODEC_TYPE_xxx */
75 int codec_id; /* see CODEC_ID_xxx */
76 unsigned int codec_tag; /* codec tag, only used if unknown codec */
79 typedef struct AVCodec {
84 int (*init)(AVCodecContext *);
85 int (*encode)(AVCodecContext *, UINT8 *buf, int buf_size, void *data);
86 int (*close)(AVCodecContext *);
87 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
88 UINT8 *buf, int buf_size);
92 /* three components are given, that's all */
93 typedef struct AVPicture {
98 extern AVCodec ac3_encoder;
99 extern AVCodec mp2_encoder;
100 extern AVCodec mpeg1video_encoder;
101 extern AVCodec h263_encoder;
102 extern AVCodec h263p_encoder;
103 extern AVCodec rv10_encoder;
104 extern AVCodec mjpeg_encoder;
105 extern AVCodec opendivx_encoder;
106 extern AVCodec msmpeg4_encoder;
108 extern AVCodec h263_decoder;
109 extern AVCodec opendivx_decoder;
110 extern AVCodec msmpeg4_decoder;
111 extern AVCodec mpeg_decoder;
112 extern AVCodec h263i_decoder;
113 extern AVCodec rv10_decoder;
115 /* dummy raw codecs */
116 extern AVCodec pcm_codec;
117 extern AVCodec rawvideo_codec;
119 /* the following codecs use external GPL libs */
120 extern AVCodec mp3_decoder;
121 extern AVCodec ac3_decoder;
125 struct ReSampleContext;
127 typedef struct ReSampleContext ReSampleContext;
129 ReSampleContext *audio_resample_init(int output_channels, int input_channels,
130 int output_rate, int input_rate);
131 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
132 void audio_resample_close(ReSampleContext *s);
134 /* YUV420 format is assumed ! */
136 struct ImgReSampleContext;
138 typedef struct ImgReSampleContext ImgReSampleContext;
140 ImgReSampleContext *img_resample_init(int output_width, int output_height,
141 int input_width, int input_height);
142 void img_resample(ImgReSampleContext *s,
143 AVPicture *output, AVPicture *input);
145 void img_resample_close(ImgReSampleContext *s);
147 int img_convert_to_yuv420(UINT8 *img_out, UINT8 *img,
148 int pix_fmt, int width, int height);
150 /* external high level API */
152 extern AVCodec *first_avcodec;
154 void avcodec_init(void);
156 void register_avcodec(AVCodec *format);
157 AVCodec *avcodec_find_encoder(enum CodecID id);
158 AVCodec *avcodec_find_decoder(enum CodecID id);
159 AVCodec *avcodec_find_decoder_by_name(const char *name);
160 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
162 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
163 int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples,
165 UINT8 *buf, int buf_size);
166 int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture,
167 int *got_picture_ptr,
168 UINT8 *buf, int buf_size);
169 int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size,
170 const short *samples);
171 int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size,
172 const AVPicture *pict);
174 int avcodec_close(AVCodecContext *avctx);
176 void avcodec_register_all(void);
177 void avcodec_register_more(void);