45 #ifndef vpV4l2Grabber_hh 46 #define vpV4l2Grabber_hh 48 #include <visp3/core/vpConfig.h> 53 #include <linux/kernel.h> 54 #include <linux/types.h> 55 #include <linux/videodev2.h> 57 #include <visp3/core/vpFrameGrabber.h> 58 #include <visp3/core/vpImage.h> 59 #include <visp3/core/vpRGBa.h> 60 #include <visp3/core/vpRect.h> 176 #ifndef DOXYGEN_SHOULD_SKIP_THIS 177 struct ng_video_fmt {
178 unsigned int pixelformat;
181 unsigned int bytesperline;
184 struct ng_video_buf {
185 struct ng_video_fmt fmt;
233 vpV4l2FramerateType getFramerate();
251 void setFramerate(vpV4l2FramerateType framerate);
259 inline void setWidth(
unsigned w) { this->width = w; }
279 inline void setNBuffers(
unsigned nbuffers) { this->m_nbuffers = nbuffers; }
287 inline void setDevice(
const std::string &devname) { sprintf(device,
"%s", devname.c_str()); }
298 this->m_pixelformat = pixelformat;
299 if (this->m_pixelformat >= V4L2_MAX_FORMAT)
300 this->m_pixelformat = V4L2_RGB24_FORMAT;
314 inline void setFrameFormat(vpV4l2FrameFormatType frameformat) { this->m_frameformat = frameformat; }
316 void getCapabilities();
317 void startStreaming();
318 void stopStreaming();
319 unsigned char *waiton(__u32 &index,
struct timeval ×tamp);
322 void printBufInfo(
struct v4l2_buffer buf);
325 char device[FILENAME_MAX];
327 struct v4l2_capability cap;
328 struct v4l2_streamparm streamparm;
329 struct v4l2_input *inp;
330 struct v4l2_standard *
std;
331 struct v4l2_fmtdesc *fmt;
332 struct v4l2_queryctrl *ctl;
335 struct v4l2_format fmt_v4l2;
336 struct ng_video_fmt fmt_me;
337 struct v4l2_requestbuffers reqbufs;
338 struct v4l2_buffer *buf_v4l2;
339 struct ng_video_buf *buf_me;
341 unsigned int waiton_cpt;
350 vpV4l2FramerateType m_framerate;
351 vpV4l2FrameFormatType m_frameformat;
352 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
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.
void setNBuffers(unsigned nbuffers)
void setPixelFormat(vpV4l2PixelFormatType pixelformat)
static const unsigned int DEFAULT_SCALE
static const unsigned int MAX_BUFFERS