42 #ifndef vpV4l2Grabber_hh
43 #define vpV4l2Grabber_hh
45 #include <visp3/core/vpConfig.h>
50 #include <linux/videodev2.h>
53 #include <visp3/core/vpFrameGrabber.h>
54 #include <visp3/core/vpImage.h>
55 #include <visp3/core/vpRGBa.h>
56 #include <visp3/core/vpRect.h>
150 } vpV4l2FramerateType;
158 } vpV4l2FrameFormatType;
170 } vpV4l2PixelFormatType;
172 #ifndef DOXYGEN_SHOULD_SKIP_THIS
173 struct ng_video_fmt {
174 unsigned int pixelformat;
177 unsigned int bytesperline;
180 struct ng_video_buf {
181 struct ng_video_fmt fmt;
229 vpV4l2FramerateType getFramerate();
247 void setFramerate(vpV4l2FramerateType framerate);
255 inline void setWidth(
unsigned w) { this->width = w; }
275 inline void setNBuffers(
unsigned nbuffers) { this->m_nbuffers = nbuffers; }
283 inline void setDevice(
const std::string &devname) { device = devname; }
294 this->m_pixelformat = pixelformat;
295 if (this->m_pixelformat >= V4L2_MAX_FORMAT)
296 this->m_pixelformat = V4L2_RGB24_FORMAT;
310 inline void setFrameFormat(vpV4l2FrameFormatType frameformat) { this->m_frameformat = frameformat; }
312 void getCapabilities();
313 void startStreaming();
314 void stopStreaming();
315 unsigned char *waiton(__u32 &index,
struct timeval ×tamp);
318 void printBufInfo(
struct v4l2_buffer buf);
323 struct v4l2_capability cap;
324 struct v4l2_streamparm streamparm;
325 struct v4l2_input *inp;
326 struct v4l2_standard *std;
327 struct v4l2_fmtdesc *fmt;
328 struct v4l2_queryctrl *ctl;
331 struct v4l2_format fmt_v4l2;
332 struct ng_video_fmt fmt_me;
333 struct v4l2_requestbuffers reqbufs;
334 struct v4l2_buffer *buf_v4l2;
335 struct ng_video_buf *buf_me;
337 unsigned int waiton_cpt;
346 vpV4l2FramerateType m_framerate;
347 vpV4l2FrameFormatType m_frameformat;
348 vpV4l2PixelFormatType m_pixelformat;
Base class for all video devices. It is designed to provide a front end to video sources.
virtual void open(vpImage< unsigned char > &I)=0
virtual void acquire(vpImage< unsigned char > &I)=0
Defines a rectangle in the plane.
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
@ framerate_50fps
50 frames per second
void setWidth(unsigned w)
static const __u32 MAX_NORM
static const unsigned int MAX_CTRL
static const unsigned int MAX_BUFFERS
static const __u32 MAX_INPUTS
void setVerboseMode(bool verbose)
vpV4l2PixelFormatType getPixelFormat()
static const unsigned int FRAME_SIZE
static const unsigned int DEFAULT_SCALE
static const unsigned int DEFAULT_INPUT
static const __u32 MAX_FORMAT
void setHeight(unsigned h)
void setPixelFormat(vpV4l2PixelFormatType pixelformat)
void setNBuffers(unsigned nbuffers)
void setDevice(const std::string &devname)