2 #ifndef CVD_V4LBUFFER_H 3 #define CVD_V4LBUFFER_H 7 #include <linux/videodev2.h> 10 #include <cvd/colourspaces.h> 13 #include <cvd/timer.h> 14 #include <cvd/videobuffer.h> 28 using Exceptions::VideoBuffer::All::All;
54 PutFrame(std::string dev, std::string msg);
60 GetFrame(std::string dev, std::string msg);
67 #ifndef DOXYGEN_IGNORE_INTERNAL 74 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_GREY;
80 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_SBGGR8;
85 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_SBGGR8;
91 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_YUYV;
97 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_UYVY;
103 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_YUV420;
109 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_RGB24;
115 static const unsigned int v4l2_fmt = V4L2_PIX_FMT_RGB32;
129 RawV4LBuffer(
const std::string& dev,
unsigned int fmt,
ImageRef size,
int input,
bool fields,
int frame_per_second,
bool verbose);
132 void releaseFrame(
int id);
142 const std::string& device_name()
const 165 V4LBuffer(
const std::string& dev,
ImageRef size,
int input = -1,
bool fields =
false,
int frames_per_second = 0,
bool verbose = 0)
179 return new V4LFrame(buffer.id, buffer.when, buffer.data, getSize());
184 V4LFrame* vf =
dynamic_cast<V4LFrame*
>(f);
195 return pendingFrame();
205 return num_buffers();
211 V4LFrame(
int i,
double t,
void* data,
ImageRef size)
Base class which provides untyped access to video grabber objects.
Definition: videobuffer.h:39
A datatype to represent yuv420p (yy...u...v) data.
Definition: colourspaces.h:202
A colour consisting of red, green and blue components.
Definition: rgb.h:25
Device was OK, but could not provide the requested colourspace.
Definition: v4lbuffer.h:39
All classes and functions are within the CVD namespace.
Definition: argb.h:6
virtual bool frame_pending()
Is there a frame waiting in the buffer? This function does not block.
Definition: v4lbuffer.h:193
Base class for objects which provide a typed video stream.
Definition: videobuffer.h:88
A live video buffer which uses the Video for Linux 2 (V4L2) API.
Definition: v4lbuffer.h:162
Definition: v4lbuffer.h:122
Definition: v4lbuffer.cc:129
Error in a put_frame() call.
Definition: v4lbuffer.h:52
A 32-bit colour.
Definition: rgb8.h:11
virtual double frame_rate()
What is the (expected) frame rate of this video buffer, in frames per second?
Definition: v4lbuffer.h:198
Error setting up the device.
Definition: v4lbuffer.h:46
A datatype to represent the other yuv422 (uyvy) data.
Definition: colourspaces.h:213
virtual ImageRef size()
The size of the VideoFrames returned by this buffer.
Definition: v4lbuffer.h:171
virtual VideoFrame< T > * get_frame()
Returns the next frame from the buffer. This function blocks until a frame is ready.
Definition: v4lbuffer.h:176
Definition: image_ref.h:29
Bayer datatype representing the colour filter pattern GRBG.
Definition: colourspaces.h:40
unsigned char byte
An 8-bit datatype.
Definition: byte.h:8
Base class for all VideoBuffer exceptions.
Definition: videobuffer.h:153
A frame from a VideoBuffer.
Definition: videoframe.h:35
Bayer datatype representing the colour filter pattern BGGR.
Definition: colourspaces.h:14
Definition: v4lbuffer.h:26
Error in a get_frame() call.
Definition: v4lbuffer.h:58
A datatype to represent yuv422 (yuyv) data.
Definition: colourspaces.h:192
The buffer is flushable: it is live and VideoBuffer::frame_pending() returns an accurate result...
Definition: videobuffer.h:26
Error opening the device.
Definition: v4lbuffer.h:32
Definition: v4lbuffer.h:119
virtual void put_frame(VideoFrame< T > *f)
Tell the buffer that you are finished with this frame.
Definition: v4lbuffer.h:182