FFmpeg 协议初步学习

本文介绍了FFmpeg中协议的学习,特别是URLContext的priv_data部分,建议先了解URLProtocol以便更好地理解。
摘要由CSDN通过智能技术生成
typedef struct URLContext {
    const AVClass *av_class;    /**< information for av_log(). Set by url_open(). */
    struct URLProtocol *prot;
    void *priv_data;
    char *filename;             /**< specified URL */
    int flags;
    int max_packet_size;        /**< if non zero, the stream is packetized with this max packet size */
    int is_streamed;            /**< true if streamed (no seek possible), default = false */
    int is_connected;
    AVIOInterruptCB interrupt_callback;
    int64_t rw_timeout;         /**< maximum time to wait for (network) read/write operation completion, in mcs */
} URLContext;


1、context 当前运行的上下文环境,其实说白了就是C的全局变量,用来保存当前模块运行时的多个函数需要使用到的共同变量。每一个模块里面都会有一个 context 来表示运行上下文,模块里面的具体实现都要使用到和其对应的 context 。file 协议是在 file.c 中实现的,里面有一个 FileContext, 和一个 AVClass file_class

2、URLContext  中的 av_class 是它自身的 AVClass ffurl_context_class

3、URLContext 中的 prot 是指向具体的协议的,URLProtocol 抽象出了一些接口,上层使用这些接口去操作数据,而在不同的协议里面实现了这些接口。打开的是一个文件协议的话,此时的 prot 就是指向 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值