【发布时间】:2012-09-30 10:22:18
【问题描述】:
在新的 ffmpeg 版本中不推荐使用 avio_set_interrupt_cb 吗? 什么是替代品?
【问题讨论】:
标签: ffmpeg libav libavformat
在新的 ffmpeg 版本中不推荐使用 avio_set_interrupt_cb 吗? 什么是替代品?
【问题讨论】:
标签: ffmpeg libav libavformat
我自己找到了答案。这是它的完成方式
你定义回调
int decode_interrupt_cb(void * ctx) {
return isQuit;
}
做一个回调结构
const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
在读取任何文件之前将其分配给您AVFormatContext 的interrupt_callback
pFormatCtx->interrupt_callback = int_cb;
如果您使用“avio_open2”打开文件,请像这样使用它:
int errCode = avio_open2(&pFormatCtx->pb, filename, AVIO_FLAG_READ, &pFormatCtx->interrupt_callback, NULL);
希望有人觉得它有帮助。
【讨论】: