Initial Commit
This commit is contained in:
commit
f4fa723863
22 changed files with 1402 additions and 0 deletions
31
src/frame_queue.h
Normal file
31
src/frame_queue.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef FRAME_QUEUE_H
|
||||
#define FRAME_QUEUE_H
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#define FRAME_QUEUE_CAPACITY 4
|
||||
|
||||
typedef struct FrameData {
|
||||
unsigned char *pixels;
|
||||
int width;
|
||||
int height;
|
||||
int stride;
|
||||
double pts_seconds;
|
||||
} FrameData;
|
||||
|
||||
typedef struct FrameQueue {
|
||||
FrameData frames[FRAME_QUEUE_CAPACITY];
|
||||
int head;
|
||||
int count;
|
||||
SDL_mutex *mutex;
|
||||
SDL_cond *cond;
|
||||
} FrameQueue;
|
||||
|
||||
int frame_queue_init(FrameQueue *queue);
|
||||
void frame_queue_destroy(FrameQueue *queue);
|
||||
void frame_queue_clear(FrameQueue *queue);
|
||||
int frame_queue_push(FrameQueue *queue, FrameData *frame);
|
||||
int frame_queue_pop_latest(FrameQueue *queue, FrameData *out);
|
||||
void frame_data_free(FrameData *frame);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue