2021-06-26 21:02:18 +08:00
|
|
|
#ifndef SC_VIDEO_BUFFER_H
|
|
|
|
#define SC_VIDEO_BUFFER_H
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2021-01-09 02:24:51 +08:00
|
|
|
#include "common.h"
|
|
|
|
|
2019-03-03 06:52:22 +08:00
|
|
|
#include <stdbool.h>
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2021-07-04 18:39:03 +08:00
|
|
|
#include "frame_buffer.h"
|
2018-02-07 19:25:52 +08:00
|
|
|
|
2017-12-12 22:12:07 +08:00
|
|
|
// forward declarations
|
|
|
|
typedef struct AVFrame AVFrame;
|
|
|
|
|
2021-06-26 21:02:18 +08:00
|
|
|
struct sc_video_buffer {
|
2021-07-04 18:39:03 +08:00
|
|
|
struct sc_frame_buffer fb;
|
2021-07-04 18:42:22 +08:00
|
|
|
|
|
|
|
const struct sc_video_buffer_callbacks *cbs;
|
|
|
|
void *cbs_userdata;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sc_video_buffer_callbacks {
|
|
|
|
void (*on_new_frame)(struct sc_video_buffer *vb, bool previous_skipped,
|
|
|
|
void *userdata);
|
2017-12-12 22:12:07 +08:00
|
|
|
};
|
|
|
|
|
2019-03-03 06:52:22 +08:00
|
|
|
bool
|
2021-07-04 18:42:22 +08:00
|
|
|
sc_video_buffer_init(struct sc_video_buffer *vb,
|
|
|
|
const struct sc_video_buffer_callbacks *cbs,
|
|
|
|
void *cbs_userdata);
|
2019-03-03 03:09:56 +08:00
|
|
|
|
|
|
|
void
|
2021-06-26 21:02:18 +08:00
|
|
|
sc_video_buffer_destroy(struct sc_video_buffer *vb);
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2021-04-11 21:01:05 +08:00
|
|
|
bool
|
2021-07-04 18:42:22 +08:00
|
|
|
sc_video_buffer_push(struct sc_video_buffer *vb, const AVFrame *frame);
|
2018-02-09 02:23:24 +08:00
|
|
|
|
2021-04-11 21:01:05 +08:00
|
|
|
void
|
2021-06-26 21:02:18 +08:00
|
|
|
sc_video_buffer_consume(struct sc_video_buffer *vb, AVFrame *dst);
|
2017-12-12 22:12:07 +08:00
|
|
|
|
|
|
|
#endif
|