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 | Protected Attributes | List of all members
tinyuvc::UVCFrameBuffer Class Reference

A growing byte buffer for one frame, allocated with UVCMemory (so in PSRAM where available). It grows in steps while a frame is written and keeps its memory when it is cleared, so after the first frames no more allocations happen. More...

#include <UVCMemory.h>

Public Member Functions

 UVCFrameBuffer ()=default
 
 UVCFrameBuffer (const UVCFrameBuffer &)=delete
 
UVCFrameBuffer & operator= (const UVCFrameBuffer &)=delete
 
 ~UVCFrameBuffer ()
 
void setMemoryType (UVCMemoryType type)
 
UVCMemoryType memoryType () const
 
bool reserve (size_t size)
 Makes sure that size bytes fit without a new allocation.
 
bool append (const uint8_t *data, size_t len)
 Appends data; false if no memory is left (the buffer is unchanged)
 
void clear ()
 
void release ()
 Frees the memory.
 
uint8_t * data ()
 
const uint8_t * data () const
 
size_t size () const
 
size_t capacity () const
 
bool empty () const
 

Protected Attributes

uint8_t * data_ = nullptr
 
size_t size_ = 0
 
size_t capacity_ = 0
 
UVCMemoryType type_ = UVCMemoryType::Auto
 

Detailed Description

A growing byte buffer for one frame, allocated with UVCMemory (so in PSRAM where available). It grows in steps while a frame is written and keeps its memory when it is cleared, so after the first frames no more allocations happen.

Constructor & Destructor Documentation

◆ UVCFrameBuffer() [1/2]

tinyuvc::UVCFrameBuffer::UVCFrameBuffer ( )
default

◆ UVCFrameBuffer() [2/2]

tinyuvc::UVCFrameBuffer::UVCFrameBuffer ( const UVCFrameBuffer &  )
delete

◆ ~UVCFrameBuffer()

tinyuvc::UVCFrameBuffer::~UVCFrameBuffer ( )
inline

Member Function Documentation

◆ append()

bool tinyuvc::UVCFrameBuffer::append ( const uint8_t *  data,
size_t  len 
)
inline

Appends data; false if no memory is left (the buffer is unchanged)

◆ capacity()

size_t tinyuvc::UVCFrameBuffer::capacity ( ) const
inline

◆ clear()

void tinyuvc::UVCFrameBuffer::clear ( )
inline

◆ data() [1/2]

uint8_t * tinyuvc::UVCFrameBuffer::data ( )
inline

◆ data() [2/2]

const uint8_t * tinyuvc::UVCFrameBuffer::data ( ) const
inline

◆ empty()

bool tinyuvc::UVCFrameBuffer::empty ( ) const
inline

◆ memoryType()

UVCMemoryType tinyuvc::UVCFrameBuffer::memoryType ( ) const
inline

◆ operator=()

UVCFrameBuffer & tinyuvc::UVCFrameBuffer::operator= ( const UVCFrameBuffer &  )
delete

◆ release()

void tinyuvc::UVCFrameBuffer::release ( )
inline

Frees the memory.

◆ reserve()

bool tinyuvc::UVCFrameBuffer::reserve ( size_t  size)
inline

Makes sure that size bytes fit without a new allocation.

◆ setMemoryType()

void tinyuvc::UVCFrameBuffer::setMemoryType ( UVCMemoryType  type)
inline

◆ size()

size_t tinyuvc::UVCFrameBuffer::size ( ) const
inline

Member Data Documentation

◆ capacity_

size_t tinyuvc::UVCFrameBuffer::capacity_ = 0
protected

◆ data_

uint8_t* tinyuvc::UVCFrameBuffer::data_ = nullptr
protected

◆ size_

size_t tinyuvc::UVCFrameBuffer::size_ = 0
protected

◆ type_

UVCMemoryType tinyuvc::UVCFrameBuffer::type_ = UVCMemoryType::Auto
protected

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