Advertisement

ffmpeg源码简析 avformat decoding functions

阅读量:

1.avformat_open_input

媒体的打开过程始于avformat_open_input;由此可见, 此函数的价值不容小觑.

在该函数中,FFMPEG完成了:

复制代码
    输入输出结构体AVIOContext的初始化;
    
    输入数据的协议(例如RTMP,或者file)的识别(通过一套评分机制):1判断文件名的后缀 2读取文件头的数据进行比对;
    
    使用获得最高分的文件协议对应的URLProtocol,通过函数指针的方式,与FFMPEG连接(非专业用词);
    
    剩下的就是调用该URLProtocol的函数进行open,read等操作了

URLProtocol结构如下,是一大堆函数指针的集合(avio.h文件)

复制代码
    typedef struct URLProtocol {  
    const char *name;  
    int (*url_open)(URLContext *h, const char *url, int flags);  
    int (*url_read)(URLContext *h, unsigned char *buf, int size);  
    int (*url_write)(URLContext *h, const unsign

全部评论 (0)

还没有任何评论哟~