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;
相關文章
相關標籤/搜索