av_register_all
avcodec_register_all --code encode
REGISTER_ENCDEC (AAC, aac);
#define REGISTER_ENCDEC(X, x) REGISTER_ENCODER(X, x); REGISTER_DECODER(X, x)
#define REGISTER_ENCODER(X, x) \
{ \
extern AVCodec ff_##x##_encoder; \ --extern AVCodec ff_aac_encoder;
if (CONFIG_##X##_ENCODER) \ --if (CONFIG_AAC_ENCODER)
avcodec_register(&ff_##x##_encoder);\ -- avcodec_register(&ff_aac_encoder)
}
AVCodec ff_libfdk_aac_encoder = {
.init = aac_encode_init,
.encode2 = aac_encode_frame,
.close = aac_encode_close,
};
avformat_alloc_output_context2 --out AVFormatContext AVFormatContext.AVOutputFormat
avformat_alloc_context
av_guess_format
avio_open2 --out AVIOContext
ffurl_open
ffio_fdopen
avformat_new_stream --out AVStream
av_mallocz
avcodec_alloc_context3
avcodec_find_encoder --out AVCodec
AVCodec *p = first_avcodec; /* code info init encode close etc*/
while(p){
p = p->next;
...
}
avcodec_open2
ret = avctx->codec->init(avctx); --ff_libfdk_aac_encoder.init
avformat_write_header
AVOutputFormat->write_header
avcodec_encode_audio2
AVCodec.encode2 ----ff_libfdk_aac_encoder.encode2
for(){
av_write_frame
}
av_write_trailer
for(){
write_packet
}
AVOutputFormat->write_trailer
avcodec_close
AVCodec->close ----ff_libfdk_aac_encoder.close
avformat_free_context
ff_free_stream
avio_close
avio_flush
ffurl_close