|
TinyUVC 0.1.0
Header-only USB Video Class (UVC) device: turn an MCU into a USB webcam
|
VideoOutput that sends every frame (write() calls up to flush()) to a UVCDevice. Two frame buffers are used: one is sent while the next one is written. More...
#include <AudioTools.h>


Public Member Functions | |
| UVCVideoOutput (UVCDevice &uvc, PixelFormat format=PixelFormat::MJPEG) | |
| void | setPixelFormat (PixelFormat format) |
| Pixel format of the frames written to this output. | |
| PixelFormat | pixelFormat () const |
| bool | setVideoFormat (audio_tools::VideoFormat format) |
| Same with an audio-tools VideoFormat; false if not supported. | |
| void | setTimeout (uint32_t ms) |
| void | setMaxFrameSize (size_t size) |
| Max frame size: bigger frames are dropped (default 512 KB) | |
| void | setMemoryType (UVCMemoryType type) |
| bool | reserve (size_t size) |
| void | release () |
| void | setPacing (bool pacing) |
| void | setFlushOnWrite (bool flushOnWrite) |
| Every write() is a complete frame (for writers that never call flush()) | |
| size_t | write (const uint8_t *data, size_t len) override |
| void | flush () override |
| Completes the frame and hands it to the UVC device. | |
| bool | hadOutput () const override |
| bool | isCompleteJpeg (const uint8_t *data, size_t len) const |
| true if data is a whole JPEG image (SOI ... EOI) | |
| uint32_t | frames () const |
| Frames handed to the device / dropped. | |
| uint32_t | dropped () const |
Protected Attributes | |
| UVCDevice & | uvc_ |
| PixelFormat | format_ |
| UVCFrameBuffer | buffers_ [2] |
| int | fill_ = 0 |
| size_t | maxFrameSize_ = 512 * 1024 |
| uint32_t | timeoutMs_ = 0 |
| bool | pacing_ = false |
| bool | flushOnWrite_ = false |
| bool | sent_ = false |
| uint32_t | lastUs_ = 0 |
| bool | overflow_ = false |
| bool | hadOutput_ = false |
| uint32_t | frames_ = 0 |
| uint32_t | dropped_ = 0 |
VideoOutput that sends every frame (write() calls up to flush()) to a UVCDevice. Two frame buffers are used: one is sent while the next one is written.
The frame buffers grow to the size of the biggest frame and are taken from PSRAM where the board has it (see setMemoryType(), reserve()).
Writers that deliver one complete frame per write() without calling flush() (e.g. MJPEGEncoder) are supported as well: a complete JPEG written in one call is sent right away, for other formats use setFlushOnWrite(true).
|
inlineexplicit |
|
inline |
|
inlineoverride |
Completes the frame and hands it to the UVC device.
|
inline |
Frames handed to the device / dropped.
|
inlineoverride |
true if data is a whole JPEG image (SOI ... EOI)
|
inline |
|
inline |
Frees the frame buffers; they are allocated again by the next frame. The frame that is still being sent keeps its buffer.
Allocates both frame buffers for frames of up to size bytes now, instead of growing them with the first frames. False if there is not enough memory.
Max frame size: bigger frames are dropped (default 512 KB)
|
inline |
Where the two frame buffers are allocated: UVCMemoryType::Auto (default: PSRAM if available, else RAM), PSRAMOnly or RAMOnly. Call it before the first frame or reserve().
flush() waits until the frame interval selected by the host has passed since the previous frame: plays files (e.g. from DemuxerAVI) at their frame rate instead of as fast as USB allows. Implies waiting for the device (see setTimeout()).
|
inline |
Pixel format of the frames written to this output.
How long flush() waits for the previous frame to be sent. 0 (default): drop the frame if the device is busy, which keeps live sources live.
|
inline |
Same with an audio-tools VideoFormat; false if not supported.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |