#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(). |
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().
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 |
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] |
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().
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 |