avcodec_register_all();
codec
=
avcodec_find_decoder(CODEC_ID_H264);
if ( ! codec)
exit( 1 );
context = avcodec_alloc_context();
if (avcodec_open(context, codec) < 0 )
exit( 1 );
if ( ! codec)
exit( 1 );
context = avcodec_alloc_context();
if (avcodec_open(context, codec) < 0 )
exit( 1 );
ffmpeg中编解码器是由链表结构管理的,链表的第一个节点是在文件libavcodec/util.c中声明的:
static AVCodec *first_avcodec = NULL;
对于编码器、与解码器的操作都是在围绕该链表执行的。
例如:AVCodec *avcodec_find_decoder(enum CodecID id); //遍历链表