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

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;  
        
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值