21 #ifndef GV_CAPTURE_V4L__H
22 #define GV_CAPTURE_V4L__H
34 class CaptureRequeuer ;
52 typedef std::vector<shared_ptr<Gv::CaptureBuffer> > CaptureBuffers ;
53 typedef unsigned long size_type ;
56 CaptureV4l(
const std::string & dev_name ,
const std::string & dev_config ) ;
65 virtual void start()
override ;
68 virtual void stop()
override ;
71 virtual bool simple()
const override ;
74 virtual bool read(
unsigned char * ,
size_t )
override ;
80 virtual int fd()
const override ;
83 virtual unsigned int dx()
const override ;
86 virtual unsigned int dy()
const override ;
89 virtual bool active()
const override ;
92 virtual std::string
info()
const override ;
100 static int open_device(
const std::string & dev_name ) ;
101 static io_method check_device(
int fd ,
const std::string & dev_config ) ;
103 void set_simple(
const std::string & dev_config ) ;
105 void create_buffers( size_type sizeimage ,
const std::string & dev_config ) ;
106 static void create_buffers_read( CaptureBuffers & buffers , size_type buffer_size ,
unsigned int nbuffers ) ;
107 static void create_buffers_mmap( CaptureBuffers & buffers ,
int fd ,
size_t ,
unsigned int nbuffers ) ;
108 static void create_buffers_userptr( CaptureBuffers & buffers ,
int fd , size_type buffer_size ,
unsigned int nbuffers ) ;
111 static void add_buffers_read() ;
112 static void add_buffers_mmap( CaptureBuffers & buffers ,
int fd ) ;
113 static void add_buffers_userptr( CaptureBuffers & buffers ,
int fd ) ;
115 static void start_capturing_read() ;
116 static void start_capturing_mmap(
int fd ) ;
117 static void start_capturing_userptr(
int fd ) ;
119 static void stop_capturing_read() ;
120 static void stop_capturing_mmap(
int fd ) ;
121 static void stop_capturing_userptr(
int fd ) ;
124 bool read_frame_read_simple(
unsigned char * p ,
size_t n ) ;
131 std::vector<shared_ptr<Gv::CaptureBuffer> > m_buffers ;
A video capture implementation for video-for-linux (v4l).
A RAII class to do ioctl(VIDIOC_QBUF) on a v4l buffer.
virtual unsigned int dy() const override
Override from Gv::Capture.
virtual bool simple() const override
Override from Gv::Capture.
virtual unsigned int dx() const override
Override from Gv::Capture.
virtual bool active() const override
Override from Gv::Capture.
CaptureV4l(const std::string &dev_name, const std::string &dev_config)
Constructor.
A structure holding capture buffer dimensions.
virtual bool read(unsigned char *, size_t) override
Override from Gv::Capture.
A callback interface for the Gv::Capture class.
A video capture abstract interface, exposing a file descriptor and a method to handle read events on ...
virtual std::string info() const override
Override from Gv::Capture.
virtual int fd() const override
Override from Gv::Capture.
virtual void stop() override
Override from Gv::Capture.
virtual void start() override
Override from Gv::Capture.