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>
153 } vpV4l2FramerateType;
162 } vpV4l2FrameFormatType;
174 } vpV4l2PixelFormatType;
176 #ifndef DOXYGEN_SHOULD_SKIP_THIS
177 struct ng_video_fmt {
178 unsigned int pixelformat;
181 unsigned int bytesperline;
185 struct ng_video_buf {
186 struct ng_video_fmt fmt;
212 vpV4l2FramerateType getFramerate();
222 return (this->pixelformat);
229 this->verbose = verbose;
231 void setFramerate(vpV4l2FramerateType framerate);
241 this->_width =
width;
267 this->nbuffers = nbuffers;
278 sprintf(device,
"%s", devname);
290 this->pixelformat = pixelformat;
291 if (this->pixelformat >= V4L2_MAX_FORMAT)
292 this->pixelformat = V4L2_RGB24_FORMAT;
307 inline void setFrameFormat(vpV4l2FrameFormatType frameformat)
309 this->frameformat = frameformat;
312 void getCapabilities();
313 void startStreaming();
314 void stopStreaming();
315 unsigned char * waiton(__u32 &index,
struct timeval ×tamp);
318 void printBufInfo(
struct v4l2_buffer buf);
322 char device[FILENAME_MAX];
324 struct v4l2_capability cap;
325 struct v4l2_streamparm streamparm;
326 struct v4l2_input *inp;
327 struct v4l2_standard *
std;
328 struct v4l2_fmtdesc *fmt;
329 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;
350 vpV4l2FramerateType framerate;
351 vpV4l2FrameFormatType frameformat;
352 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