1 AVIOInterruptCB结构体定义
在/usr/include/libavformat/avio.h中有如下的结构体定义,根据头文件中的注释:这是一个回调函数和参数的结构体。有些函数是在阻塞的,用这个回调函数来检查是否中断这个阻塞函数,如果回调函数返回1,那么这个正在阻塞的操作将被中止。那么就用这个结构体里的参数opaque来回调其中的callback函数。如果阻塞函数被中断了,那么阻塞函数的返回值为AVERROR_EXIT。
1/** 2 * Callback for checking whether to abort blocking functions. 3 * AVERROR_EXIT is returned in this case by the interrupted 4 * function. During blocking operations, callback is called with 5 * opaque as parameter. If the callback returns 1, the 6 * blocking operation will be aborted. 7 * 8 * No members can be added to this struct without a major bump, if 9 * new elements have been added after this struct in AVFormatContext 10 * or AVIOContext. 11 */ 12typedef struct AVIOInterruptCB { 13 int (*callback)(void*); 14 void *opaque; 15} AVIOInterruptCB;