TinyUVC 0.1.0
Header-only USB Video Class (UVC) device: turn an MCU into a USB webcam
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tinyuvc::UVCPayloadEncoder Class Reference

Produces the UVC payloads of one frame. Each payload starts with a 2 byte header (6 bytes with a presentation time stamp) that carries the frame id bit (FID, toggled per frame) and, in the last payload of the frame, the end of frame bit (EOF). More...

#include <UVCPayload.h>

Public Member Functions

void begin (const uint8_t *data, size_t len, PixelFormat fmt, bool fid, bool withPts=false, uint32_t pts=0)
 
uint8_t headerLength () const
 Header length in bytes.
 
size_t fill (uint8_t *buf, size_t maxLen)
 
bool active () const
 true while the frame still has data to send
 
void abort ()
 Aborts the current frame.
 
size_t outputLength () const
 Size of the frame data as it is sent (after any conversion)
 

Detailed Description

Produces the UVC payloads of one frame. Each payload starts with a 2 byte header (6 bytes with a presentation time stamp) that carries the frame id bit (FID, toggled per frame) and, in the last payload of the frame, the end of frame bit (EOF).

The source data is only read while fill() runs: once done() is true the caller may reuse the frame buffer. Raw pixel formats are converted to YUY2 on the fly.

Member Function Documentation

◆ abort()

void tinyuvc::UVCPayloadEncoder::abort ( )
inline

Aborts the current frame.

◆ active()

bool tinyuvc::UVCPayloadEncoder::active ( ) const
inline

true while the frame still has data to send

◆ begin()

void tinyuvc::UVCPayloadEncoder::begin ( const uint8_t *  data,
size_t  len,
PixelFormat  fmt,
bool  fid,
bool  withPts = false,
uint32_t  pts = 0 
)
inline

Starts a new frame. For JPEG/YUY2 sources the data is sent as is, other pixel formats are converted to YUY2 (len must then be pixels * bytesPerPixel(fmt), with an even number of pixels).

◆ fill()

size_t tinyuvc::UVCPayloadEncoder::fill ( uint8_t *  buf,
size_t  maxLen 
)
inline

Writes the next payload (max maxLen bytes) and returns its length. Returns 0 if the frame is complete.

◆ headerLength()

uint8_t tinyuvc::UVCPayloadEncoder::headerLength ( ) const
inline

Header length in bytes.

◆ outputLength()

size_t tinyuvc::UVCPayloadEncoder::outputLength ( ) const
inline

Size of the frame data as it is sent (after any conversion)


The documentation for this class was generated from the following file: