45 #ifndef vpV4l2Grabber_hh
46 #define vpV4l2Grabber_hh
48 #include <visp3/core/vpConfig.h>
52 #include <linux/types.h>
53 #include <linux/kernel.h>
54 #include <linux/videodev2.h>
57 #include <visp3/core/vpImage.h>
58 #include <visp3/core/vpFrameGrabber.h>
59 #include <visp3/core/vpRGBa.h>
60 #include <visp3/core/vpRect.h>
153 } vpV4l2FramerateType;
162 } vpV4l2FrameFormatType;
174 } vpV4l2PixelFormatType;
176 #ifndef DOXYGEN_SHOULD_SKIP_THIS
177 struct ng_video_fmt {
178 unsigned int pixelformat;
181 unsigned int bytesperline;
185 struct ng_video_buf {
186 struct ng_video_fmt fmt;
233 vpV4l2FramerateType getFramerate();
243 return (this->m_pixelformat);
254 this->m_verbose = verbose;
256 void setFramerate(vpV4l2FramerateType framerate);
292 this->m_nbuffers = nbuffers;
303 sprintf(device,
"%s", devname.c_str());
315 this->m_pixelformat = pixelformat;
316 if (this->m_pixelformat >= V4L2_MAX_FORMAT)
317 this->m_pixelformat = V4L2_RGB24_FORMAT;
332 inline void setFrameFormat(vpV4l2FrameFormatType frameformat)
334 this->m_frameformat = frameformat;
337 void getCapabilities();
338 void startStreaming();
339 void stopStreaming();
340 unsigned char * waiton(__u32 &index,
struct timeval ×tamp);
343 void printBufInfo(
struct v4l2_buffer buf);
346 char device[FILENAME_MAX];
348 struct v4l2_capability cap;
349 struct v4l2_streamparm streamparm;
350 struct v4l2_input *inp;
351 struct v4l2_standard *std;
352 struct v4l2_fmtdesc *fmt;
353 struct v4l2_queryctrl *ctl;
356 struct v4l2_format fmt_v4l2;
357 struct ng_video_fmt fmt_me;
358 struct v4l2_requestbuffers reqbufs;
359 struct v4l2_buffer *buf_v4l2;
360 struct ng_video_buf *buf_me;
362 unsigned int waiton_cpt;
371 vpV4l2FramerateType m_framerate;
372 vpV4l2FrameFormatType m_frameformat;
373 vpV4l2PixelFormatType m_pixelformat;
static const unsigned int MAX_CTRL
static const __u32 MAX_FORMAT
void setDevice(const std::string &devname)
vpV4l2PixelFormatType getPixelFormat()
void setVerboseMode(bool verbose)
static const unsigned int DEFAULT_INPUT
virtual void open(vpImage< unsigned char > &I)=0
static const unsigned int FRAME_SIZE
void setHeight(unsigned h)
static const __u32 MAX_INPUTS
void setWidth(unsigned w)
static const __u32 MAX_NORM
Base class for all video devices. It is designed to provide a front end to video sources.
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
Defines a rectangle in the plane.
virtual void acquire(vpImage< unsigned char > &I)=0
void setNBuffers(unsigned nbuffers)
void setPixelFormat(vpV4l2PixelFormatType pixelformat)
static const unsigned int DEFAULT_SCALE
static const unsigned int MAX_BUFFERS