|
|
@ -4,22 +4,26 @@ |
|
|
|
|
|
|
|
|
|
|
|
#ifndef VIDEOPLAYER_AVPACKET_QUEUE_H |
|
|
|
#ifndef VIDEOPLAYER_AVPACKET_QUEUE_H |
|
|
|
#define VIDEOPLAYER_AVPACKET_QUEUE_H |
|
|
|
#define VIDEOPLAYER_AVPACKET_QUEUE_H |
|
|
|
|
|
|
|
|
|
|
|
#include <pthread.h> |
|
|
|
#include <pthread.h> |
|
|
|
|
|
|
|
|
|
|
|
typedef struct AVPacketQueue { |
|
|
|
typedef struct AVPacketQueue { |
|
|
|
//队列大小
|
|
|
|
//the size of queue
|
|
|
|
int size; |
|
|
|
int size; |
|
|
|
//指针数组
|
|
|
|
//packet array
|
|
|
|
void **packets; |
|
|
|
void **packets; |
|
|
|
//下一个写入的packet
|
|
|
|
//the packet next to write
|
|
|
|
int next_to_write; |
|
|
|
int next_to_write; |
|
|
|
//下一个读取的packet
|
|
|
|
//the packet next to read
|
|
|
|
int next_to_read; |
|
|
|
int next_to_read; |
|
|
|
} AVPacketQueue; |
|
|
|
} AVPacketQueue; |
|
|
|
|
|
|
|
|
|
|
|
AVPacketQueue *queue_init(int size); |
|
|
|
AVPacketQueue *queue_init(int size); |
|
|
|
|
|
|
|
|
|
|
|
void queue_free(AVPacketQueue *queue); |
|
|
|
void queue_free(AVPacketQueue *queue); |
|
|
|
|
|
|
|
|
|
|
|
void *queue_push(AVPacketQueue *queue, pthread_mutex_t *mutex, pthread_cond_t *cond); |
|
|
|
void *queue_push(AVPacketQueue *queue, pthread_mutex_t *mutex, pthread_cond_t *cond); |
|
|
|
|
|
|
|
|
|
|
|
void *queue_pop(AVPacketQueue *queue, pthread_mutex_t *mutex, pthread_cond_t *cond); |
|
|
|
void *queue_pop(AVPacketQueue *queue, pthread_mutex_t *mutex, pthread_cond_t *cond); |
|
|
|
|
|
|
|
|
|
|
|
#endif //VIDEOPLAYER_AVPACKET_QUEUE_H
|
|
|
|
#endif //VIDEOPLAYER_AVPACKET_QUEUE_H
|