Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
AERingBuffer Class Reference

#include <AERingBuffer.h>

Public Member Functions

 AERingBuffer ()=default
 
 AERingBuffer (unsigned int size, unsigned int planes=1)
 
 ~AERingBuffer ()
 
bool Create (int size, unsigned int planes=1)
 
void Reset ()
 
int Write (unsigned char *src, unsigned int size, unsigned int plane=0)
 
int Read (unsigned char *dest, unsigned int size, unsigned int plane=0)
 
void Dump ()
 
unsigned int GetWriteSize ()
 
unsigned int GetReadSize ()
 
unsigned int GetMaxSize ()
 
unsigned int NumPlanes () const
 

Detailed Description

This buffer can be used by one read and one write thread at any one time without the risk of data corruption. If you intend to call the Reset() method, please use Locks. All other operations are thread-safe.

Constructor & Destructor Documentation

◆ AERingBuffer() [1/2]

AERingBuffer::AERingBuffer ( )
default

◆ AERingBuffer() [2/2]

AERingBuffer::AERingBuffer ( unsigned int size,
unsigned int planes = 1 )
inline

◆ ~AERingBuffer()

AERingBuffer::~AERingBuffer ( )
inline

Member Function Documentation

◆ Create()

bool AERingBuffer::Create ( int size,
unsigned int planes = 1 )
inline

Allocates space for buffer, and sets it's contents to 0.

Returns
true on success, false otherwise

◆ Dump()

void AERingBuffer::Dump ( )
inline

Dumps the buffer.

◆ GetMaxSize()

unsigned int AERingBuffer::GetMaxSize ( )
inline

Returns the buffer size.

◆ GetReadSize()

unsigned int AERingBuffer::GetReadSize ( )
inline

Returns available space for reading from buffer. Attempt to read more bytes than available results in AE_RING_BUFFER_EMPTY.

◆ GetWriteSize()

unsigned int AERingBuffer::GetWriteSize ( )
inline

Returns available space for writing to buffer. Attempt to write more bytes than available results in AE_RING_BUFFER_FULL.

◆ NumPlanes()

unsigned int AERingBuffer::NumPlanes ( ) const
inline

Returns the number of planes

◆ Read()

int AERingBuffer::Read ( unsigned char * dest,
unsigned int size,
unsigned int plane = 0 )
inline

Reads data from buffer. Attempt to read more bytes than available results in RING_BUFFER_NOTAVAILABLE. Reading from empty buffer returns AE_RING_BUFFER_EMPTY

Returns
AE_RING_BUFFER_OK on success, otherwise an error code

◆ Reset()

void AERingBuffer::Reset ( )
inline

Fills the buffer with zeros and resets the pointers. This method is not thread-safe, so before using this method please acquire a Lock()

◆ Write()

int AERingBuffer::Write ( unsigned char * src,
unsigned int size,
unsigned int plane = 0 )
inline

Writes data to buffer. Attempt to write more bytes than available results in AE_RING_BUFFER_FULL.

Returns
AE_RING_BUFFER_OK on success, otherwise an error code

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