1 AVPacketList结构
typedef struct AVPacketList {
AVPacket pkt;
struct AVPacketList *next;
} AVPacketList;
2 AVPacketQueue结构
位于源码的libavdevice/cklink_common.h中的结构体,这个不是给程序员用的(仅仅给开发这个开源项目的人员使用),所以只存在于源码的头文件中,并没有在install的include目录下。
typedef struct AVPacketQueue {
AVPacketList *first_pkt, *last_pkt;
int nb_packets;
unsigned long long size;
int abort_request;
pthread_mutex_t mutex;
pthread_cond_t cond;
AVFormatContext *avctx;
} AVPacketQueue;
但是,在我们学习ffmpge官网的那个SDL的tutorial的时候,在其中提到了PacketQueue结构,这个是应用程序员自己定义的,结构体如下,很显然是参考了上面的这个AVPacketQueue。
typedef struct PacketQueue {
AVPacketList *first_pkt, *last_pkt; //有点像链表的表头和表尾指针
int nb_packets;
int size;
SDL_mutex *mutex;
SDL_cond *cond; //两把锁用来实现这个全局结构体的访问控制
} PacketQueue;