49 #ifndef vpV4l2Grabber_hh
50 #define vpV4l2Grabber_hh
52 #include <visp/vpConfig.h>
56 #include <linux/types.h>
57 #include <linux/kernel.h>
58 #include <linux/videodev2.h>
61 #include <visp/vpImage.h>
62 #include <visp/vpFrameGrabber.h>
63 #include <visp/vpRGBa.h>
158 } vpV4l2FramerateType;
167 } vpV4l2FrameFormatType;
179 } vpV4l2PixelFormatType;
181 #ifndef DOXYGEN_SHOULD_SKIP_THIS
182 struct ng_video_fmt {
183 unsigned int pixelformat;
186 unsigned int bytesperline;
190 struct ng_video_buf {
191 struct ng_video_fmt fmt;
217 vpV4l2FramerateType getFramerate();
227 return (this->m_pixelformat);
234 this->m_verbose = verbose;
236 void setFramerate(vpV4l2FramerateType framerate);
272 this->m_nbuffers = nbuffers;
283 sprintf(device,
"%s", devname.c_str());
295 this->m_pixelformat = pixelformat;
296 if (this->m_pixelformat >= V4L2_MAX_FORMAT)
297 this->m_pixelformat = V4L2_RGB24_FORMAT;
312 inline void setFrameFormat(vpV4l2FrameFormatType frameformat)
314 this->m_frameformat = frameformat;
317 void getCapabilities();
318 void startStreaming();
319 void stopStreaming();
320 unsigned char * waiton(__u32 &index,
struct timeval ×tamp);
323 void printBufInfo(
struct v4l2_buffer buf);
327 char device[FILENAME_MAX];
329 struct v4l2_capability cap;
330 struct v4l2_streamparm streamparm;
331 struct v4l2_input *inp;
332 struct v4l2_standard *
std;
333 struct v4l2_fmtdesc *fmt;
334 struct v4l2_queryctrl *ctl;
338 struct v4l2_format fmt_v4l2;
339 struct ng_video_fmt fmt_me;
340 struct v4l2_requestbuffers reqbufs;
341 struct v4l2_buffer *buf_v4l2;
342 struct ng_video_buf *buf_me;
344 unsigned int waiton_cpt;
353 vpV4l2FramerateType m_framerate;
354 vpV4l2FrameFormatType m_frameformat;
355 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