1、結構 ?
? ? ? ? ? typedef struct FrameQueue {
? ? ? ? ? ? ? ? ? Frame queue[FRAME_QUEUE_SIZE];
? ? ? ? ? ? ? ? ? ?int rindex;//queue數(shù)組的讀取位
? ? ? ? ? ? ? ? ? ?int windex;//queue數(shù)組的寫入位
? ? ? ? ? ? ? ? ? ? int size;? //queue實際有數(shù)據(jù)個數(shù)
? ? ? ? ? ? ? ? ? ? int max_size;//queue最大個數(shù)
? ? ? ? ? ? ? ? ? ? int keep_last;//看初始化
? ? ? ? ? ? ? ? ? ? int rindex_shown;//已經(jīng)讀取的個數(shù),讀數(shù)之后一直為1
? ? ? ? ? ? ? ? ? ? SDL_mutex *mutex;
? ? ? ? ? ? ? ? ? ? ?SDL_cond *cond;
? ? ? ? ? ? ? ? ? ? ?PacketQueue *pktq;
? ? ? ? ? ? ? ? } FrameQueue;
? ? ? ? ? if (frame_queue_init(&is->pictq, &is->videoq, VIDEO_PICTURE_QUEUE_SIZE, 1) < 0)
? ? ? ? ? ? goto fail;
? ? ? ? ? ?if (frame_queue_init(&is->subpq, &is->subtitleq, SUBPICTURE_QUEUE_SIZE, 0) < 0)
? ? ? ? ? ? goto fail;
? ? ? ? ? ?if (frame_queue_init(&is->sampq, &is->audioq, SAMPLE_QUEUE_SIZE, 1) < 0)
? ? ? ? ? ?goto fail;
? ? ? ? ? 初始化得知視頻是數(shù)組個數(shù)為三,rindex標記讀取位,windex標記插入位,則數(shù)組三個循環(huán)讀取寫入。
2、static int queue_picture() 寫入幀、static Frame *frame_queue_peek_last() 讀取幀
? ? ?static void frame_queue_push() size計數(shù)加1 、static void frame_queue_next() size計數(shù)減1