GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
ringbuffer.h File Reference
#include <gpac/tools.h>
#include <gpac/thread.h>
+ Include dependency graph for ringbuffer.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  GF_Ringbuffer
 

Functions

GF_Ringbuffergf_ringbuffer_new (u32 sz)
 
void gf_ringbuffer_del (GF_Ringbuffer *ringbuffer)
 
u32 gf_ringbuffer_read (GF_Ringbuffer *rb, u8 *dest, u32 szDest)
 
u32 gf_ringbuffer_available_for_read (GF_Ringbuffer *rb)
 
u32 gf_ringbuffer_write (GF_Ringbuffer *rb, const u8 *src, u32 sz)
 

Data Structure Documentation

struct GF_Ringbuffer
+ Collaboration diagram for GF_Ringbuffer:
Data Fields
u8 * buf
volatile u32 write_ptr
volatile u32 read_ptr
u32 size
u32 size_mask
GF_Mutex * mx

Function Documentation

GF_Ringbuffer* gf_ringbuffer_new ( u32  sz)

Creates a new ringbuffer with specified size. The caller has the reponsability to free the ringbuffer using gf_ringbuffer_del()

Parameters
szthe ringbuffer size in bytes
Returns
a pointer to a new ringbuffer if successful, NULL otherwise.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gf_ringbuffer_del ( GF_Ringbuffer ringbuffer)

Frees a previously allocated ringbuffer

Parameters
ringbufferThe ringbuffer to free

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 gf_ringbuffer_read ( GF_Ringbuffer rb,
u8 dest,
u32  szDest 
)

Reads bytes from ringbuffer

Parameters
rbThe ringbuffer to read from
destThe destination
szDestSize of destination
Returns
the number of bytes readen

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 gf_ringbuffer_available_for_read ( GF_Ringbuffer rb)

Return the number of bytes available for reading. This is the number of bytes in front of the read pointer and behind the write pointer.

Parameters
rbThe ringbuffer
Returns
the number of bytes available for reading

+ Here is the caller graph for this function:

u32 gf_ringbuffer_write ( GF_Ringbuffer rb,
const u8 src,
u32  sz 
)

Copy at most sz bytes to rb from src.

Parameters
rbThe ringbuffer to write to
srcThe source buffer
szthe size of source
Returns
Returns the actual number of bytes copied, may be lower than sz if ringbuffer is already full

+ Here is the call graph for this function:

+ Here is the caller graph for this function: