📄 avcodec.h
字号:
int has_b_frames; /** * stride of the chrominance part of the dr buffer * encoding: unused * decoding: set by user */ int dr_uvstride; /** * number of dr buffers * encoding: unused * decoding: set by user */ int dr_ip_buffer_count; int block_align; /* used by some WAV based audio codecs */ int parse_only; /* decoding only: if true, only parsing is done (function avcodec_parse_frame()). The frame data is returned. Only MPEG codecs support this now. */ /** * 0-> h263 quant 1-> mpeg quant * encoding: set by user. * decoding: unused */ int mpeg_quant; /** * pass1 encoding statistics output buffer * encoding: set by lavc * decoding: unused */ char *stats_out; /* encoding statistics output buffer */ /** * pass2 encoding statistics input buffer. * concatenated stuff from stats_out of pass1 should be placed here * encoding: allocated/set/freed by user * decoding: unused */ char *stats_in; /** * ratecontrol qmin qmax limiting method * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax * encoding: set by user. * decoding: unused */ float rc_qsquish; float rc_qmod_amp; int rc_qmod_freq; /** * ratecontrol override, see RcOverride * encoding: allocated/set/freed by user. * decoding: unused */ RcOverride *rc_override; int rc_override_count; /** * rate control equation * encoding: set by user * decoding: unused */ char *rc_eq; /** * maximum bitrate * encoding: set by user. * decoding: unused */ int rc_max_rate; /** * minimum bitrate * encoding: set by user. * decoding: unused */ int rc_min_rate; /** * decoder bitstream buffer size * encoding: set by user. * decoding: unused */ int rc_buffer_size; float rc_buffer_aggressivity; /** * qscale factor between p and i frames * encoding: set by user. * decoding: unused */ float i_quant_factor; /** * qscale offset between p and i frames * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) * encoding: set by user. * decoding: unused */ float i_quant_offset; /** * initial complexity for pass1 ratecontrol * encoding: set by user. * decoding: unused */ float rc_initial_cplx; /** * Obsolete, will be removed */ int aspected_width; int aspected_height; /** * dct algorithm, see FF_DCT_* below * encoding: set by user * decoding: unused */ int dct_algo;#define FF_DCT_AUTO 0#define FF_DCT_FASTINT 1#define FF_DCT_INT 2#define FF_DCT_MMX 3#define FF_DCT_MLIB 4#define FF_DCT_ALTIVEC 5 /** * presentation timestamp in micro seconds (time when frame should be shown to user) * if 0 then the frame_rate will be used as reference * encoding: set by user * decoding; set by lavc */ long long int pts; /** * luminance masking (0-> disabled) * encoding: set by user * decoding: unused */ float lumi_masking; /** * temporary complexity masking (0-> disabled) * encoding: set by user * decoding: unused */ float temporal_cplx_masking; /** * spatial complexity masking (0-> disabled) * encoding: set by user * decoding: unused */ float spatial_cplx_masking; /** * p block masking (0-> disabled) * encoding: set by user * decoding: unused */ float p_masking; /** * darkness masking (0-> disabled) * encoding: set by user * decoding: unused */ float dark_masking; /** * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A') * this is used to workaround some encoder bugs * encoding: unused * decoding: set by user, will be converted to upper case by lavc during init */ int fourcc; /** * idct algorithm, see FF_IDCT_* below * encoding: set by user * decoding: set by user */ int idct_algo;#define FF_IDCT_AUTO 0#define FF_IDCT_INT 1#define FF_IDCT_SIMPLE 2#define FF_IDCT_SIMPLEMMX 3#define FF_IDCT_LIBMPEG2MMX 4#define FF_IDCT_PS2 5#define FF_IDCT_MLIB 6#define FF_IDCT_ARM 7#define FF_IDCT_ALTIVEC 8 /** * slice count * encoding: set by lavc * decoding: set by user (or 0) */ int slice_count; /** * slice offsets in the frame in bytes * encoding: set/allocated by lavc * decoding: set/allocated by user (or NULL) */ int *slice_offset; /** * error concealment flags * encoding: unused * decoding: set by user */ int error_concealment;#define FF_EC_GUESS_MVS 1#define FF_EC_DEBLOCK 2 /** * QP table of the currently decoded frame * encoding; unused * decoding: set by lavc */ int8_t *current_qscale_table; /** * QP table of the currently displayed frame * encoding; unused * decoding: set by lavc */ int8_t *display_qscale_table; /** * force specific pict_type. * encoding; set by user (I/P/B_TYPE) * decoding: unused */ int force_type; /** * dsp_mask could be used to disable unwanted * CPU features (i.e. MMX, SSE. ...) */ unsigned dsp_mask; /** * bits per sample/pixel from the demuxer (needed for huffyuv) * encoding; set by lavc * decoding: set by user */ int bits_per_sample; /** * prediction method (needed for huffyuv) * encoding; set by user * decoding: unused */ int prediction_method;#define FF_PRED_LEFT 0#define FF_PRED_PLANE 1#define FF_PRED_MEDIAN 2 /** * aspect ratio. (0 if unknown) * encoding: set by user. * decoding: set by lavc. */ float aspect_ratio;} AVCodecContext;typedef struct AVCodec { const char *name; int type; int id; int priv_data_size; int (*init)(AVCodecContext *); int (*encode)(AVCodecContext *, UINT8 *buf, int buf_size, void *data); int (*close)(AVCodecContext *); int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, UINT8 *buf, int buf_size); int capabilities; struct AVCodec *next;} AVCodec;/** * four components are given, that's all. * the last component is alpha */typedef struct AVPicture { UINT8 *data[4]; int linesize[4];} AVPicture;extern AVCodec ac3_encoder;extern AVCodec mp2_encoder;extern AVCodec mp3lame_encoder;extern AVCodec oggvorbis_encoder;extern AVCodec mpeg1video_encoder;extern AVCodec h263_encoder;extern AVCodec h263p_encoder;extern AVCodec rv10_encoder;extern AVCodec mjpeg_encoder;extern AVCodec mpeg4_encoder;extern AVCodec msmpeg4v1_encoder;extern AVCodec msmpeg4v2_encoder;extern AVCodec msmpeg4v3_encoder;extern AVCodec wmv1_encoder;extern AVCodec wmv2_encoder;extern AVCodec huffyuv_encoder;extern AVCodec h263_decoder;extern AVCodec mpeg4_decoder;extern AVCodec msmpeg4v1_decoder;extern AVCodec msmpeg4v2_decoder;extern AVCodec msmpeg4v3_decoder;extern AVCodec wmv1_decoder;extern AVCodec wmv2_decoder;extern AVCodec mpeg_decoder;extern AVCodec h263i_decoder;extern AVCodec rv10_decoder;extern AVCodec svq1_decoder;extern AVCodec dvvideo_decoder;extern AVCodec dvaudio_decoder;extern AVCodec wmav1_decoder;extern AVCodec wmav2_decoder;extern AVCodec mjpeg_decoder;extern AVCodec mjpegb_decoder;extern AVCodec mp2_decoder;extern AVCodec mp3_decoder;extern AVCodec mace3_decoder;extern AVCodec mace6_decoder;extern AVCodec huffyuv_decoder;/* pcm codecs */#define PCM_CODEC(id, name) \extern AVCodec name ## _decoder; \extern AVCodec name ## _encoderPCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);/* adpcm codecs */PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);#undef PCM_CODEC/* dummy raw video codec */extern AVCodec rawvideo_codec;/* the following codecs use external GPL libs */extern AVCodec ac3_decoder;/* resample.c */struct ReSampleContext;typedef struct ReSampleContext ReSampleContext;ReSampleContext *audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate);int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);void audio_resample_close(ReSampleContext *s);/* YUV420 format is assumed ! */struct ImgReSampleContext;typedef struct ImgReSampleContext ImgReSampleContext;ImgReSampleContext *img_resample_init(int output_width, int output_height, int input_width, int input_height);ImgReSampleContext *img_resample_full_init(int owidth, int oheight, int iwidth, int iheight, int topBand, int bottomBand, int leftBand, int rightBand);void img_resample(ImgReSampleContext *s, AVPicture *output, AVPicture *input);void img_resample_close(ImgReSampleContext *s);void avpicture_fill(AVPicture *picture, UINT8 *ptr, int pix_fmt, int width, int height);int avpicture_get_size(int pix_fmt, int width, int height);/* convert among pixel formats */int img_convert(AVPicture *dst, int dst_pix_fmt, AVPicture *src, int pix_fmt, int width, int height);/* deinterlace a picture */int avpicture_deinterlace(AVPicture *dst, AVPicture *src, int pix_fmt, int width, int height);/* external high level API */extern AVCodec *first_avcodec;/* returns LIBAVCODEC_VERSION_INT constant */unsigned avcodec_version(void);/* returns LIBAVCODEC_BUILD constant */unsigned avcodec_build(void);void avcodec_init(void);void avcodec_set_bit_exact(void);void register_avcodec(AVCodec *format);AVCodec *avcodec_find_encoder(enum CodecID id);AVCodec *avcodec_find_encoder_by_name(const char *name);AVCodec *avcodec_find_decoder(enum CodecID id);AVCodec *avcodec_find_decoder_by_name(const char *name);void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);AVCodecContext *avcodec_alloc_context(void);int avcodec_open(AVCodecContext *avctx, AVCodec *codec);int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples, int *frame_size_ptr, UINT8 *buf, int buf_size);int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture, int *got_picture_ptr, UINT8 *buf, int buf_size);int avcodec_parse_frame(AVCodecContext *avctx, UINT8 **pdata, int *data_size_ptr, UINT8 *buf, int buf_size);int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size, const short *samples);int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size, const AVPicture *pict);int avcodec_close(AVCodecContext *avctx);void avcodec_register_all(void);void avcodec_flush_buffers(AVCodecContext *avctx);/** * Interface for 0.5.0 version * * do not even think about it's usage for this moment */typedef struct { // compressed size used from given memory buffer int size; /// I/P/B frame type int frame_type;} avc_enc_result_t;/** * Commands * order can't be changed - once it was defined */typedef enum { // general commands AVC_OPEN_BY_NAME = 0xACA000, AVC_OPEN_BY_CODEC_ID, AVC_OPEN_BY_FOURCC, AVC_CLOSE, AVC_FLUSH, // pin - struct { uint8_t* src, uint_t src_size } // pout - struct { AVPicture* img, consumed_bytes, AVC_DECODE, // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size } // pout - uint_t used_from_dest_size AVC_ENCODE, // query/get video commands AVC_GET_VERSION = 0xACB000, AVC_GET_WIDTH, AVC_GET_HEIGHT, AVC_GET_DELAY, AVC_GET_QUANT_TABLE, // ... // query/get audio commands AVC_GET_FRAME_SIZE = 0xABC000, // maybe define some simple structure which // might be passed to the user - but they can't // contain any codec specific parts and these // calls are usualy necessary only few times // set video commands AVC_SET_WIDTH = 0xACD000, AVC_SET_HEIGHT, // set video encoding commands AVC_SET_FRAME_RATE = 0xACD800, AVC_SET_QUALITY, AVC_SET_HURRY_UP, // set audio commands AVC_SET_SAMPLE_RATE = 0xACE000, AVC_SET_CHANNELS,} avc_cmd_t;/** * \param handle allocated private structure by libavcodec * for initialization pass NULL - will be returned pout * user is supposed to know nothing about its structure * \param cmd type of operation to be performed * \param pint input parameter * \param pout output parameter * * \returns command status - eventually for query command it might return * integer resulting value */int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);/* memory */void *av_malloc(unsigned int size);void *av_mallocz(unsigned int size);void av_free(void *ptr);void __av_freep(void **ptr);#define av_freep(p) __av_freep((void **)(p))#endif /* AVCODEC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -