2 #ifndef CVD_VIDEO_UVCBUFFER_H 3 #define CVD_VIDEO_UVCBUFFER_H 6 #include <cvd/colourspaces.h> 7 #include <cvd/localvideoframe.h> 9 #include <cvd/videobuffer.h> 10 #include <libuvc/libuvc.h> 23 using CVD::Exceptions::VideoBuffer::All::All;
30 Init(std::string dev, std::string err);
71 PutFrame(std::string dev, std::string msg);
77 GetFrame(std::string dev, std::string msg);
84 #ifndef DOXYGEN_IGNORE_INTERNAL 94 static const unsigned int fmt = UVC_FRAME_FORMAT_YUYV;
100 static const unsigned int fmt = UVC_FRAME_FORMAT_RGB;
108 RawUVCBuffer(
const std::string& dev,
unsigned int fmt,
ImageRef size,
double frame_per_second,
bool mjpeg,
bool verbose);
110 void fill_frame(
void*);
113 const std::string& device_name()
const;
120 uvc_context_t* ctx = 0;
121 uvc_device_t* dev = 0;
122 uvc_device_handle_t* devh = 0;
123 uvc_stream_ctrl_t ctrl = {};
124 uvc_stream_handle_t* strmh = 0;
142 UVCBuffer(
const std::string& dev,
ImageRef size,
int frames_per_second = 0,
bool mjpeg = 0,
bool verbose = 0)
157 fill_frame(frame.
data());
158 return new UVCFrame(0.0, std::move(frame));
163 UVCFrame* vf =
dynamic_cast<UVCFrame*
>(f);
181 return num_buffers();
197 void operator=(
const UVCBuffer&) =
delete;
Base class which provides untyped access to video grabber objects.
Definition: videobuffer.h:39
A colour consisting of red, green and blue components.
Definition: rgb.h:25
All classes and functions are within the CVD namespace.
Definition: argb.h:6
Error opening the device.
Definition: uvcbuffer.h:28
virtual double frame_rate()
What is the (expected) frame rate of this video buffer, in frames per second?
Definition: uvcbuffer.h:174
Definition: uvcbuffer.h:105
Error opening the device.
Definition: uvcbuffer.h:35
Base class for objects which provide a typed video stream.
Definition: videobuffer.h:88
Error setting up the device.
Definition: uvcbuffer.h:63
virtual VideoFrame< T > * get_frame()
Returns the next frame from the buffer. This function blocks until a frame is ready.
Definition: uvcbuffer.h:153
Error in a get_frame() call.
Definition: uvcbuffer.h:75
The buffer has live semantics: frames are throttled by something externa, but VideoBuffer::frame_pend...
Definition: videobuffer.h:23
virtual ImageRef size()
The size of the VideoFrames returned by this buffer.
Definition: uvcbuffer.h:148
A live video buffer which uses the Video for Linux 2 (V4L2) API.
Definition: uvcbuffer.h:139
ConstPointerType data() const
Returns the raw image data.
Definition: image.h:535
Error in a put_frame() call.
Definition: uvcbuffer.h:69
Definition: image_ref.h:29
unsigned char byte
An 8-bit datatype.
Definition: byte.h:8
Base class for all VideoBuffer exceptions.
Definition: videobuffer.h:153
Definition: uvcbuffer.h:21
A frame from a VideoBuffer.
Definition: videoframe.h:35
virtual bool frame_pending()
Is there a frame waiting in the buffer? This function does not block.
Definition: uvcbuffer.h:169
A full image which manages its own data.
Definition: image.h:623
Error opening the device.
Definition: uvcbuffer.h:49
A frame from a LocalVideoBuffer, which manages its own data rather than wrapping data owned by the sy...
Definition: localvideoframe.h:30
Error opening the device.
Definition: uvcbuffer.h:42
virtual void put_frame(VideoFrame< T > *f)
Tell the buffer that you are finished with this frame.
Definition: uvcbuffer.h:161
Error opening the device.
Definition: uvcbuffer.h:56
A datatype to represent yuv422 (yuyv) data.
Definition: colourspaces.h:192