/**
* AVCodec.一個AVCodec結構體對應一個編解碼器,這個結構體表示編解碼器自己
*/
typedef struct AVCodec {
/**
* Name of the codec implementation. 編解碼實現的名字
* The name is globally unique among encoders and among decoders (but an
* encoder and a decoder can share the same name).
* This is the primary way to find a codec from the user perspective.
*/
const char *name; //編解碼器實現的名字,這個名字全局惟一(可是編解碼器能夠共用一個名字),從用戶方面去找編解碼器的主要方式
/**
* Descriptive name for the codec, meant to be more human readable than name.
* You should use the NULL_IF_CONFIG_SMALL() macro to define it.
*/
const char *long_name;//更接近人類可閱讀的編解碼器的描述名字,要使用NULL_IF_CONFIG_SMALL()這個宏定義來定義它數組
enum AVMediaType type;//媒體類型
enum AVCodecID id;//編解碼器的ID
/**
* Codec capabilities.
* see CODEC_CAP_*
*/
int capabilities;
const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}app
supported_framerates支持的幀率的數組,NULL表示任何的都支持,數組由{0,0}結束
const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1ide
pix_fmts支持的像素格式的數組,NULL表示未知,數組由-1結束
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0ui
supported_samples支持的聲音採樣頻率的數組,NULL表示未知,數組由0結束this
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1spa
sample_fmts支持的聲音採樣格式的數組,NULL表示未知,數組由-1結束
const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0.net
支持的聲音的通道數,NULL表示未知,由0結束
#if FF_API_LOWRES
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres()
#endif
const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}code
/*****************************************************************
* No fields below this line are part of the public API. They
* may not be used outside of libavcodec and can be changed and
* removed at will.
* New public fields should be added right above.
*****************************************************************
*/
int priv_data_size;
struct AVCodec *next;
/**
* @name Frame-level threading support functions
* @{
*/
/**
* If defined, called on thread contexts when they are created.
* If the codec allocates writable tables in init(), re-allocate them here.
* priv_data will be set to a copy of the original.
*/
int (*init_thread_copy)(AVCodecContext *);
/**
* Copy necessary context variables from a previous thread context to the current one.
* If not defined, the next thread will start automatically; otherwise, the codec
* must call ff_thread_finish_setup().
*
* dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
*/
int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
/** @} */orm
/**
* Private codec-specific defaults.
*/
const AVCodecDefault *defaults;ip
/**
* Initialize codec static data, called from avcodec_register().
*/
void (*init_static_data)(struct AVCodec *codec);
int (*init)(AVCodecContext *); int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, const struct AVSubtitle *sub); /** * Encode data to an AVPacket. * * @param avctx codec context * @param avpkt output AVPacket (may contain a user-provided buffer) * @param[in] frame AVFrame containing the raw data to be encoded * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a * non-empty packet was returned in avpkt. * @return 0 on success, negative error code on failure */ int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr); int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); int (*close)(AVCodecContext *); /** * Flush buffers. * Will be called when seeking */ void (*flush)(AVCodecContext *);} AVCodec;