Is the avio_set_interrupt_cb deprecated in the new ffmpeg release? What is the substitute?

有帮助吗?

解决方案

I found the answer myself. Here is how it's done

You define the call back

int decode_interrupt_cb(void * ctx) {
    return isQuit;
}

Make a call back struct

const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };

Assign it to you AVFormatContext's interrupt_callback before any file reading

pFormatCtx->interrupt_callback = int_cb;

if you open file with 'avio_open2', use it like this:

int errCode = avio_open2(&pFormatCtx->pb, filename, AVIO_FLAG_READ, &pFormatCtx->interrupt_callback, NULL);

Hope someone find it helpful.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top