rk3399_arm_lvds/capimage/gvideo.h

50 lines
956 B
C++

#pragma once
#include <string>
#include <vector>
#include <mutex>
class gVideo
{
public:
gVideo();
virtual ~gVideo();
bool is_open();
void close();
void open(int width, int height);
void start();
void stop();
void grab(int color, bool bcrrect = false, int timeout = 1000, int flatpara = 0);
bool hasframe();
virtual void *read_frame(int timeout);
void set_size(int width, int height);
void set_buf_count(int count);
protected:
bool wait(int msTimeout);
virtual void stop_capturing(void);
virtual void start_capturing(void);
virtual void uninit_device(void);
virtual void init_mmap(void);
virtual void init_device(void);
void close_device(void);
void open_device(void);
struct buffer
{
void *start;
size_t length;
};
int v4l_buffer_count = 3;
int v4l_width = 3100;
int v4l_height = 3100;
std::string dev_name;
int fd;
std::vector<buffer> buffers;
unsigned int n_buffers;
std::mutex m_lock;
volatile bool bStart;
};