src/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:
chunk the music_chunk object
audio_format the audio format for the appended data; must stay the same for the life cycle of this chunk
length the 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  )  [inline, static]

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:
chunk the music_chunk object
audio_format the audio format for the appended data; must stay the same for the life cycle of this chunk
data_time the time within the song
bit_rate the current bit rate of the source file
max_length_r the maximum write length is returned here
Returns:
a writable buffer, or NULL if the chunk is full

Generated on 9 Aug 2013 for MPD by  doxygen 1.6.1