2021-04-04 06:10:44 +08:00
|
|
|
#ifndef SC_V4L2_SINK_H
|
|
|
|
#define SC_V4L2_SINK_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#include "coords.h"
|
|
|
|
#include "trait/frame_sink.h"
|
|
|
|
#include "video_buffer.h"
|
|
|
|
|
|
|
|
#include <libavformat/avformat.h>
|
|
|
|
|
|
|
|
struct sc_v4l2_sink {
|
|
|
|
struct sc_frame_sink frame_sink; // frame sink trait
|
|
|
|
|
|
|
|
struct video_buffer vb;
|
|
|
|
AVFormatContext *format_ctx;
|
|
|
|
AVCodecContext *encoder_ctx;
|
|
|
|
|
|
|
|
char *device_name;
|
|
|
|
struct size frame_size;
|
|
|
|
|
|
|
|
sc_thread thread;
|
|
|
|
sc_mutex mutex;
|
|
|
|
sc_cond cond;
|
|
|
|
bool stopped;
|
|
|
|
bool header_written;
|
|
|
|
|
|
|
|
AVFrame *frame;
|
2021-06-14 15:07:49 +08:00
|
|
|
AVPacket *packet;
|
2021-04-04 06:10:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
bool
|
|
|
|
sc_v4l2_sink_init(struct sc_v4l2_sink *vs, const char *device_name,
|
|
|
|
struct size frame_size);
|
|
|
|
|
|
|
|
void
|
|
|
|
sc_v4l2_sink_destroy(struct sc_v4l2_sink *vs);
|
|
|
|
|
|
|
|
#endif
|