ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
ringbuffer.c File Reference

🎯 Lock-free circular buffer for audio streaming with atomic operations More...

Go to the source code of this file.

Functions

ringbuffer_tringbuffer_create (size_t element_size, size_t capacity)
 Create a new ring buffer.
 
void ringbuffer_destroy (ringbuffer_t *rb)
 Destroy a ring buffer and free its memory.
 
bool ringbuffer_write (ringbuffer_t *rb, const void *data)
 Try to write an element to the ring buffer (non-blocking)
 
bool ringbuffer_read (ringbuffer_t *rb, void *data)
 Try to read an element from the ring buffer (non-blocking)
 
bool ringbuffer_peek (ringbuffer_t *rb, void *data)
 Peek at the next element without removing it.
 
size_t ringbuffer_size (const ringbuffer_t *rb)
 Get current number of elements in the buffer.
 
bool ringbuffer_is_empty (const ringbuffer_t *rb)
 Check if buffer is empty.
 
bool ringbuffer_is_full (const ringbuffer_t *rb)
 Check if buffer is full.
 
void ringbuffer_clear (ringbuffer_t *rb)
 Clear all elements from the buffer.
 
framebuffer_tframebuffer_create (size_t capacity)
 Create a frame buffer for ASCII frames.
 
framebuffer_tframebuffer_create_multi (size_t capacity)
 Create a multi-source frame buffer for multi-user support.
 
void framebuffer_destroy (framebuffer_t *fb)
 Destroy a frame buffer.
 
bool framebuffer_write_frame (framebuffer_t *fb, const char *frame_data, size_t frame_size)
 Write a frame to the buffer.
 
bool framebuffer_read_frame (framebuffer_t *fb, frame_t *frame)
 Read a frame from the buffer.
 
void framebuffer_clear (framebuffer_t *fb)
 Clear all frames from the buffer, freeing their data.
 
bool framebuffer_write_multi_frame (framebuffer_t *fb, const char *frame_data, size_t frame_size, uint32_t source_client_id, uint32_t frame_sequence, uint32_t timestamp)
 Write a multi-source frame to the buffer (for multi-user support)
 
bool framebuffer_read_multi_frame (framebuffer_t *fb, multi_source_frame_t *frame)
 Read a multi-source frame from the buffer.
 
bool framebuffer_peek_latest_multi_frame (framebuffer_t *fb, multi_source_frame_t *frame)
 Peek at the latest multi-source frame without removing it.
 

Detailed Description

🎯 Lock-free circular buffer for audio streaming with atomic operations

Definition in file ringbuffer.c.