fmpeg 自定义IO中断 AVFormatContext::interrupt_callback ,AVIOInterruptCB具体处理方法

来源:互联网 发布:dwg转excel软件 编辑:程序博客网 时间:2024/06/10 08:00

ffmpeg在接收网络流时 例如rtsp ,rtmp流,如果没有数据过来会阻塞:

引用网上的两个例子:http://hi.baidu.com/mingyuejingque/item/d37f505cab9d35ddd48bacc2?qq-pf-to=pcqq.group

http://stackoverflow.com/questions/14558172/ffmpeg-av-read-frame-need-very-long-time-to-stop


有些用ffmpeg命令行的 参数不知道可以改源码

(如果敲代码的原理相同,ffmpeg对外有接口,这里不用改源码,在AVFormatContext *_formatCtx;

中 填写callback 函数 处理中断,

//Initialize intrrupt callback AVIOInterruptCB icb={interruptCallBack,(__bridge void *)(self)}; _formatCtx->interrupt_callback=icb;)
具体流程:看下图:在libavformat/network.c 中更改下列源码

0 0
原创粉丝点击