45 #ifndef vpV4l2Grabber_hh 46 #define vpV4l2Grabber_hh 48 #include <visp3/core/vpConfig.h> 53 #include <linux/videodev2.h> 55 #include <visp3/core/vpFrameGrabber.h> 56 #include <visp3/core/vpImage.h> 57 #include <visp3/core/vpRGBa.h> 58 #include <visp3/core/vpRect.h> 174 #ifndef DOXYGEN_SHOULD_SKIP_THIS 175 struct ng_video_fmt {
176 unsigned int pixelformat;
179 unsigned int bytesperline;
182 struct ng_video_buf {
183 struct ng_video_fmt fmt;
231 vpV4l2FramerateType getFramerate();
249 void setFramerate(vpV4l2FramerateType framerate);
257 inline void setWidth(
unsigned w) { this->width = w; }
277 inline void setNBuffers(
unsigned nbuffers) { this->m_nbuffers = nbuffers; }
285 inline void setDevice(
const std::string &devname) { sprintf(device,
"%s", devname.c_str()); }
296 this->m_pixelformat = pixelformat;
297 if (this->m_pixelformat >= V4L2_MAX_FORMAT)
298 this->m_pixelformat = V4L2_RGB24_FORMAT;
312 inline void setFrameFormat(vpV4l2FrameFormatType frameformat) { this->m_frameformat = frameformat; }
314 void getCapabilities();
315 void startStreaming();
316 void stopStreaming();
317 unsigned char *waiton(__u32 &index,
struct timeval ×tamp);
320 void printBufInfo(
struct v4l2_buffer buf);
323 char device[FILENAME_MAX];
325 struct v4l2_capability cap;
326 struct v4l2_streamparm streamparm;
327 struct v4l2_input *inp;
328 struct v4l2_standard *
std;
329 struct v4l2_fmtdesc *fmt;
330 struct v4l2_queryctrl *ctl;
333 struct v4l2_format fmt_v4l2;
334 struct ng_video_fmt fmt_me;
335 struct v4l2_requestbuffers reqbufs;
336 struct v4l2_buffer *buf_v4l2;
337 struct ng_video_buf *buf_me;
339 unsigned int waiton_cpt;
348 vpV4l2FramerateType m_framerate;
349 vpV4l2FrameFormatType m_frameformat;
350 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