Mercurial > libavcodec.hg
annotate avcodec.h @ 39:f6806d3e2d37 libavcodec
updated scans
| author | glantau |
|---|---|
| date | Tue, 07 Aug 2001 22:47:28 +0000 |
| parents | b8723ec6c80f |
| children | 0d1f70657c73 |
| rev | line source |
|---|---|
| 0 | 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 CODEC_ID_OPENDIVX, | |
| 12 CODEC_ID_PCM, | |
| 13 CODEC_ID_RAWVIDEO, | |
| 14 CODEC_ID_MSMPEG4, | |
| 15 CODEC_ID_H263P, | |
| 16 CODEC_ID_H263I, | |
| 17 }; | |
| 18 | |
| 19 enum CodecType { | |
| 20 CODEC_TYPE_VIDEO, | |
| 21 CODEC_TYPE_AUDIO, | |
| 22 }; | |
| 23 | |
| 24 enum PixelFormat { | |
| 25 PIX_FMT_YUV420P, | |
| 26 PIX_FMT_YUV422, | |
| 27 PIX_FMT_RGB24, | |
| 28 PIX_FMT_BGR24, | |
|
27
b8723ec6c80f
added 422P and 444P formats (need to patch ffmpeg.c so that it is handled in all the program)
glantau
parents:
24
diff
changeset
|
29 PIX_FMT_YUV422P, |
|
b8723ec6c80f
added 422P and 444P formats (need to patch ffmpeg.c so that it is handled in all the program)
glantau
parents:
24
diff
changeset
|
30 PIX_FMT_YUV444P, |
| 0 | 31 }; |
| 32 | |
| 33 /* in bytes */ | |
| 34 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 18432 | |
| 35 | |
| 36 /* motion estimation type */ | |
| 37 extern int motion_estimation_method; | |
| 38 #define ME_ZERO 0 | |
| 39 #define ME_FULL 1 | |
| 40 #define ME_LOG 2 | |
| 41 #define ME_PHODS 3 | |
| 42 | |
| 43 /* encoding support */ | |
| 44 | |
| 45 #define CODEC_FLAG_HQ 0x0001 /* high quality (non real time) encoding */ | |
| 46 #define CODEC_FLAG_QSCALE 0x0002 /* use fixed qscale */ | |
| 47 | |
| 48 #define FRAME_RATE_BASE 10000 | |
| 49 | |
| 50 typedef struct AVCodecContext { | |
| 51 int bit_rate; | |
| 52 int flags; | |
| 53 int sub_id; /* some codecs needs additionnal format info. It is | |
| 54 stored there */ | |
| 55 /* video only */ | |
| 56 int frame_rate; /* frames per sec multiplied by FRAME_RATE_BASE */ | |
| 57 int width, height; | |
| 58 int gop_size; /* 0 = intra only */ | |
| 59 int pix_fmt; /* pixel format, see PIX_FMT_xxx */ | |
| 60 /* audio only */ | |
| 61 int sample_rate; /* samples per sec */ | |
| 62 int channels; | |
| 63 | |
| 64 /* the following data should not be initialized */ | |
| 65 int frame_size; /* in samples, initialized when calling 'init' */ | |
| 66 int frame_number; /* audio or video frame number */ | |
| 67 int key_frame; /* true if the previous compressed frame was | |
| 68 a key frame (intra, or seekable) */ | |
| 69 int quality; /* quality of the previous encoded frame | |
| 70 (between 1 (good) and 31 (bad)) */ | |
| 71 struct AVCodec *codec; | |
| 72 void *priv_data; | |
| 73 | |
| 74 /* the following fields are ignored */ | |
| 75 char codec_name[32]; | |
| 76 int codec_type; /* see CODEC_TYPE_xxx */ | |
| 77 int codec_id; /* see CODEC_ID_xxx */ | |
| 78 unsigned int codec_tag; /* codec tag, only used if unknown codec */ | |
| 79 } AVCodecContext; | |
| 80 | |
| 81 typedef struct AVCodec { | |
| 82 char *name; | |
| 83 int type; | |
| 84 int id; | |
| 85 int priv_data_size; | |
| 86 int (*init)(AVCodecContext *); | |
| 87 int (*encode)(AVCodecContext *, UINT8 *buf, int buf_size, void *data); | |
| 88 int (*close)(AVCodecContext *); | |
| 89 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, | |
| 90 UINT8 *buf, int buf_size); | |
| 91 struct AVCodec *next; | |
| 92 } AVCodec; | |
| 93 | |
| 94 /* three components are given, that's all */ | |
| 95 typedef struct AVPicture { | |
| 96 UINT8 *data[3]; | |
| 97 int linesize[3]; | |
| 98 } AVPicture; | |
| 99 | |
| 100 extern AVCodec ac3_encoder; | |
| 101 extern AVCodec mp2_encoder; | |
| 102 extern AVCodec mpeg1video_encoder; | |
| 103 extern AVCodec h263_encoder; | |
| 104 extern AVCodec h263p_encoder; | |
| 105 extern AVCodec rv10_encoder; | |
| 106 extern AVCodec mjpeg_encoder; | |
| 107 extern AVCodec opendivx_encoder; | |
| 108 extern AVCodec msmpeg4_encoder; | |
| 109 | |
| 110 extern AVCodec h263_decoder; | |
| 111 extern AVCodec opendivx_decoder; | |
| 112 extern AVCodec msmpeg4_decoder; | |
| 113 extern AVCodec mpeg_decoder; | |
| 114 extern AVCodec h263i_decoder; | |
| 115 extern AVCodec rv10_decoder; | |
| 24 | 116 extern AVCodec mjpeg_decoder; |
| 0 | 117 |
| 118 /* dummy raw codecs */ | |
| 119 extern AVCodec pcm_codec; | |
| 120 extern AVCodec rawvideo_codec; | |
| 121 | |
| 122 /* the following codecs use external GPL libs */ | |
| 123 extern AVCodec mp3_decoder; | |
| 124 extern AVCodec ac3_decoder; | |
| 125 | |
| 126 /* resample.c */ | |
| 127 | |
| 128 struct ReSampleContext; | |
| 129 | |
| 130 typedef struct ReSampleContext ReSampleContext; | |
| 131 | |
| 132 ReSampleContext *audio_resample_init(int output_channels, int input_channels, | |
| 133 int output_rate, int input_rate); | |
| 134 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); | |
| 135 void audio_resample_close(ReSampleContext *s); | |
| 136 | |
| 137 /* YUV420 format is assumed ! */ | |
| 138 | |
| 139 struct ImgReSampleContext; | |
| 140 | |
| 141 typedef struct ImgReSampleContext ImgReSampleContext; | |
| 142 | |
| 143 ImgReSampleContext *img_resample_init(int output_width, int output_height, | |
| 144 int input_width, int input_height); | |
| 145 void img_resample(ImgReSampleContext *s, | |
| 146 AVPicture *output, AVPicture *input); | |
| 147 | |
| 148 void img_resample_close(ImgReSampleContext *s); | |
| 149 | |
| 150 int img_convert_to_yuv420(UINT8 *img_out, UINT8 *img, | |
| 151 int pix_fmt, int width, int height); | |
| 152 | |
| 153 /* external high level API */ | |
| 154 | |
| 155 extern AVCodec *first_avcodec; | |
| 156 | |
| 157 void avcodec_init(void); | |
| 158 | |
| 159 void register_avcodec(AVCodec *format); | |
| 160 AVCodec *avcodec_find_encoder(enum CodecID id); | |
| 161 AVCodec *avcodec_find_decoder(enum CodecID id); | |
| 162 AVCodec *avcodec_find_decoder_by_name(const char *name); | |
| 163 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); | |
| 164 | |
| 165 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); | |
| 166 int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples, | |
| 167 int *frame_size_ptr, | |
| 168 UINT8 *buf, int buf_size); | |
| 169 int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture, | |
| 170 int *got_picture_ptr, | |
| 171 UINT8 *buf, int buf_size); | |
| 172 int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size, | |
| 173 const short *samples); | |
| 174 int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size, | |
| 175 const AVPicture *pict); | |
| 176 | |
| 177 int avcodec_close(AVCodecContext *avctx); | |
| 178 | |
| 179 void avcodec_register_all(void); |
