【问题标题】:what is the subtitute for avio_set_interrupt_cb?avio_set_interrupt_cb 的替代品是什么?
【发布时间】:2012-09-30 10:22:18
【问题描述】:

在新的 ffmpeg 版本中不推荐使用 avio_set_interrupt_cb 吗? 什么是替代品?

【问题讨论】:

    标签: ffmpeg libav libavformat


    【解决方案1】:

    我自己找到了答案。这是它的完成方式

    你定义回调

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

    做一个回调结构

    const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
    

    在读取任何文件之前将其分配给您AVFormatContextinterrupt_callback

    pFormatCtx->interrupt_callback = int_cb;
    

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

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

    希望有人觉得它有帮助。

    【讨论】:

    • 答案很有帮助:) 非常感谢。
    猜你喜欢
    • 2019-02-22
    • 2011-05-07
    • 2012-04-24
    • 2019-12-03
    • 2010-09-17
    • 2012-03-27
    • 2010-10-20
    • 2014-03-12
    • 1970-01-01
    相关资源
    最近更新 更多