avio_set_interrupt_cb的替代是什么?

jAc*_*OdE 3 ffmpeg libav libavformat

是否在新的ffmpeg版本中弃用了avio_set_interrupt_cb?替补是什么?

jAc*_*OdE 6

我自己找到了答案.这是如何完成的

您定义回调

int decode_interrupt_cb(void * ctx) {
    return isQuit;
}
Run Code Online (Sandbox Code Playgroud)

回调结构

const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
Run Code Online (Sandbox Code Playgroud)

其分配给您AVFormatContextinterrupt_callback任何文件前必读

pFormatCtx->interrupt_callback = int_cb;
Run Code Online (Sandbox Code Playgroud)

如果您使用'avio_open2'打开文件,请像这样使用它:

int errCode = avio_open2(&pFormatCtx->pb, filename, AVIO_FLAG_READ, &pFormatCtx->interrupt_callback, NULL);
Run Code Online (Sandbox Code Playgroud)

希望有人觉得有帮助.