MPD

- Main Page
- Data Structures
- Files

- File List
- Globals

Functions

# src/buffer.h File Reference

Go to the source code of this file.

## Functions
struct music_buffer * | music_buffer_new (unsigned num_chunks)
| Creates a new #music_buffer object.
void | music_buffer_free (struct music_buffer *buffer)
| Frees the #music_buffer object.
unsigned | music_buffer_size (const struct music_buffer *buffer)
| Returns the total number of reserved chunks in this buffer.
struct music_chunk * | music_buffer_allocate (struct music_buffer *buffer)
| Allocates a chunk from the buffer.
void | music_buffer_return (struct music_buffer *buffer, struct music_chunk *chunk)
| Returns a chunk to the buffer.

## Function Documentation

struct music_chunk* music_buffer_allocate | ( | struct music_buffer * | buffer | ) | `[read]`

Allocates a chunk from the buffer.

When it is not used anymore, call music_buffer_return().

Returns:
  an empty chunk or NULL if there are no chunks available

void music_buffer_free | ( | struct music_buffer * | buffer | ) |

Frees the #music_buffer object.

struct music_buffer* music_buffer_new | ( | unsigned | num_chunks | ) | `[read]`

Creates a new #music_buffer object.

Parameters:

  num_chunks | the number of music_chunk reserved in this buffer

void music_buffer_return | ( | struct music_buffer * | buffer,
|  | struct music_chunk * | chunk
| ) |  |

Returns a chunk to the buffer.

It can be reused by music_buffer_allocate() then.

unsigned music_buffer_size | ( | const struct music_buffer * | buffer | ) |

Returns the total number of reserved chunks in this buffer.

This is the same value which was passed to the constructor music_buffer_new().