ffmpeg源码简析(二)av_register_all(),avcodec_register_all()

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

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;  
        
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值