av_register_all()
该函数在所有基于ffmpeg的应用程序中几乎都是第一个被调用的。只有调用了该函数,才能使用复用器,编码器等。
av_register_all()调用了avcodec_register_all()。avcodec_register_all()注册了和编解码器有关的组件:硬件加速器,解码器,编码器,Parser,Bitstream Filter。av_register_all()除了调用avcodec_register_all()之外,还注册了复用器,解复用器,协议处理器。
下面附上复用器,解复用器,协议处理器的代码。
注册复用器的函数是av_register_output_format()。
void av_register_output_format(AVOutputFormat *format)
{
AVOutputFormat **p;
p = &first_oformat;
while (*p != NULL) p = &(*p)->next;
*p = format;
format->next = NULL;
}
注册解复用器的函数是av_register_input_format()。
//遍历链表并把当前的Input Format加到链表的尾部。
void av_register_input_format(AVInputFormat *format)
{
AVInputFormat **p;
p = &first_iformat;
while (*p != NULL) p = &(*p)->next;
*p = format;
format->next = NULL;
}
注册协议处理器的函数是ffurl_register_protocol()。
int ffurl_register_protocol(URLProtocol *protocol)
{
URLProtocol **p;
p = &first_protocol;
while (*p)
p = &(*p)->next;
*p = pr

本文详细介绍了ffmpeg库中av_register_all()和avcodec_register_all()函数的作用及实现,这两个函数分别用于注册多媒体处理的各种组件,包括复用器、解复用器、协议处理器、编解码器等。avcodec_register_all()专注于编解码器相关的硬件加速器、解码器、编码器等的注册,而av_register_all()则涵盖了更多组件的注册。
5276

被折叠的 条评论
为什么被折叠?



