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.c File Reference
#include <gpac/ringbuffer.h>
+ Include dependency graph for ringbuffer.c:

Functions

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

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_available_for_write ( GF_Ringbuffer rb)

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

Parameters
rbThe ringbuffer

+ 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_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_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: