AVIOInterruptCB结构体分析

1 AVIOInterruptCB结构体定义 函数

在/usr/include/libavformat/avio.h中有以下的结构体定义,根据头文件中的注释:这是一个回调函数和参数的结构体。有些函数是在阻塞的,用这个回调函数来检查是否中断这个阻塞函数,若是回调函数返回1,那么这个正在阻塞的操做将被停止。那么就用这个结构体里的参数opaque来回调其中的callback函数。若是阻塞函数被中断了,那么阻塞函数的返回值为AVERROR_EXIT。 this

/**
 * Callback for checking whether to abort blocking functions.
 * AVERROR_EXIT is returned in this case by the interrupted
 * function. During blocking operations, callback is called with
 * opaque as parameter. If the callback returns 1, the
 * blocking operation will be aborted.
 *
 * No members can be added to this struct without a major bump, if
 * new elements have been added after this struct in AVFormatContext
 * or AVIOContext.
 */
typedef struct AVIOInterruptCB {
    int (*callback)(void*);
    void *opaque;
} AVIOInterruptCB;
相关文章
相关标签/搜索