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->pixelformat);
234 this->verbose = verbose;
236 void setFramerate(vpV4l2FramerateType framerate);
246 this->_width =
width;
272 this->nbuffers = nbuffers;
283 sprintf(device,
"%s", devname);
295 this->pixelformat = pixelformat;
296 if (this->pixelformat >= V4L2_MAX_FORMAT)
297 this->pixelformat = V4L2_RGB24_FORMAT;
312 inline void setFrameFormat(vpV4l2FrameFormatType frameformat)
314 this->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;
355 vpV4l2FramerateType framerate;
356 vpV4l2FrameFormatType frameformat;
357 vpV4l2PixelFormatType pixelformat;
static const unsigned int MAX_CTRL
static const __u32 MAX_FORMAT
void setDevice(const char *devname)
void setWidth(unsigned width)
vpV4l2PixelFormatType getPixelFormat()
void setVerboseMode(bool verbose)
static const unsigned int DEFAULT_INPUT
virtual void open(vpImage< unsigned char > &I)=0
void setHeight(unsigned height)
static const unsigned int FRAME_SIZE
unsigned int height
Number of rows in the image.
static const __u32 MAX_INPUTS
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)
unsigned int width
Number of columns in the image.
void setPixelFormat(vpV4l2PixelFormatType pixelformat)
static const unsigned int DEFAULT_SCALE
static const unsigned int MAX_BUFFERS