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>
151 } vpV4l2FramerateType;
160 } vpV4l2FrameFormatType;
172 } vpV4l2PixelFormatType;
174 #ifndef DOXYGEN_SHOULD_SKIP_THIS
175 struct ng_video_fmt {
176 unsigned int pixelformat;
179 unsigned int bytesperline;
183 struct ng_video_buf {
184 struct ng_video_fmt fmt;
229 vpV4l2FramerateType getFramerate();
239 return (this->m_pixelformat);
246 this->m_verbose = verbose;
248 void setFramerate(vpV4l2FramerateType framerate);
284 this->m_nbuffers = nbuffers;
295 sprintf(device,
"%s", devname.c_str());
307 this->m_pixelformat = pixelformat;
308 if (this->m_pixelformat >= V4L2_MAX_FORMAT)
309 this->m_pixelformat = V4L2_RGB24_FORMAT;
324 inline void setFrameFormat(vpV4l2FrameFormatType frameformat)
326 this->m_frameformat = frameformat;
329 void getCapabilities();
330 void startStreaming();
331 void stopStreaming();
332 unsigned char * waiton(__u32 &index,
struct timeval ×tamp);
335 void printBufInfo(
struct v4l2_buffer buf);
339 char device[FILENAME_MAX];
341 struct v4l2_capability cap;
342 struct v4l2_streamparm streamparm;
343 struct v4l2_input *inp;
344 struct v4l2_standard *
std;
345 struct v4l2_fmtdesc *fmt;
346 struct v4l2_queryctrl *ctl;
350 struct v4l2_format fmt_v4l2;
351 struct ng_video_fmt fmt_me;
352 struct v4l2_requestbuffers reqbufs;
353 struct v4l2_buffer *buf_v4l2;
354 struct ng_video_buf *buf_me;
356 unsigned int waiton_cpt;
365 vpV4l2FramerateType m_framerate;
366 vpV4l2FrameFormatType m_frameformat;
367 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 for the Video4Linux2 video device.
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