MPD
Data Structures | Enumerations | Functions
chunk.h File Reference
#include "replay_gain_info.h"
#include "audio_format.h"
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  music_chunk
 A chunk of music data. More...
 

Enumerations

enum  { CHUNK_SIZE = 4096 }
 

Functions

void music_chunk_init (struct music_chunk *chunk)
 
void music_chunk_free (struct music_chunk *chunk)
 
static bool music_chunk_is_empty (const struct music_chunk *chunk)
 
bool music_chunk_check_format (const struct music_chunk *chunk, const struct audio_format *audio_format)
 Checks if the audio format if the chunk is equal to the specified audio_format.
 
void * music_chunk_write (struct music_chunk *chunk, const struct audio_format *audio_format, float data_time, uint16_t bit_rate, size_t *max_length_r)
 Prepares appending to the music chunk.
 
bool music_chunk_expand (struct music_chunk *chunk, const struct audio_format *audio_format, size_t length)
 Increases the length of the chunk after the caller has written to the buffer returned by music_chunk_write().
 

Enumeration Type Documentation

anonymous enum
Enumerator:
CHUNK_SIZE 

Definition at line 33 of file chunk.h.

Function Documentation

bool music_chunk_check_format ( const struct music_chunk chunk,
const struct audio_format audio_format 
)

Checks if the audio format if the chunk is equal to the specified audio_format.

bool music_chunk_expand ( struct music_chunk chunk,
const struct audio_format audio_format,
size_t  length 
)

Increases the length of the chunk after the caller has written to the buffer returned by music_chunk_write().

Parameters
chunkthe music_chunk object
audio_formatthe audio format for the appended data; must stay the same for the life cycle of this chunk
lengththe number of bytes which were appended
Returns
true if the chunk is full
void music_chunk_free ( struct music_chunk chunk)
void music_chunk_init ( struct music_chunk chunk)
static bool music_chunk_is_empty ( const struct music_chunk chunk)
inlinestatic

Definition at line 104 of file chunk.h.

void* music_chunk_write ( struct music_chunk chunk,
const struct audio_format audio_format,
float  data_time,
uint16_t  bit_rate,
size_t *  max_length_r 
)

Prepares appending to the music chunk.

Returns a buffer where you may write into. After you are finished, call music_chunk_expand().

Parameters
chunkthe music_chunk object
audio_formatthe audio format for the appended data; must stay the same for the life cycle of this chunk
data_timethe time within the song
bit_ratethe current bit rate of the source file
max_length_rthe maximum write length is returned here
Returns
a writable buffer, or NULL if the chunk is full