Definitions for several variations of audio data. More...
Data Structures | |
struct | gavl_audio_format_t |
Audio Format. More... | |
Defines | |
#define | GAVL_MAX_CHANNELS 128 |
Maximum number of audio channels. | |
Enumerations | |
enum | gavl_sample_format_t { GAVL_SAMPLE_NONE = 0, GAVL_SAMPLE_U8 = 1, GAVL_SAMPLE_S8 = 2, GAVL_SAMPLE_U16 = 3, GAVL_SAMPLE_S16 = 4, GAVL_SAMPLE_S32 = 5, GAVL_SAMPLE_FLOAT = 6, GAVL_SAMPLE_DOUBLE = 7 } |
Format of one audio sample. More... | |
enum | gavl_interleave_mode_t { GAVL_INTERLEAVE_NONE = 0, GAVL_INTERLEAVE_2 = 1, GAVL_INTERLEAVE_ALL = 2 } |
enum | gavl_channel_id_t { GAVL_CHID_NONE = 0, GAVL_CHID_FRONT_CENTER, GAVL_CHID_FRONT_LEFT, GAVL_CHID_FRONT_RIGHT, GAVL_CHID_FRONT_CENTER_LEFT, GAVL_CHID_FRONT_CENTER_RIGHT, GAVL_CHID_REAR_LEFT, GAVL_CHID_REAR_RIGHT, GAVL_CHID_REAR_CENTER, GAVL_CHID_SIDE_LEFT, GAVL_CHID_SIDE_RIGHT, GAVL_CHID_LFE, GAVL_CHID_AUX } |
Audio channel setup. More... | |
Functions | |
GAVL_PUBLIC const char * | gavl_sample_format_to_string (gavl_sample_format_t format) |
Convert a gavl_sample_format_t to a human readable string. | |
GAVL_PUBLIC gavl_sample_format_t | gavl_string_to_sample_format (const char *str) |
Convert a string to a sample format. | |
GAVL_PUBLIC int | gavl_num_sample_formats () |
Get total number of supported sample formats. | |
GAVL_PUBLIC gavl_sample_format_t | gavl_get_sample_format (int index) |
Get the sample format from index. | |
GAVL_PUBLIC const char * | gavl_channel_id_to_string (gavl_channel_id_t id) |
Convert a gavl_channel_id_t to a human readable string. | |
GAVL_PUBLIC const char * | gavl_interleave_mode_to_string (gavl_interleave_mode_t mode) |
Convert a gavl_interleave_mode_t to a human readable string. | |
GAVL_PUBLIC void | gavl_audio_format_dump (const gavl_audio_format_t *format) |
Dump an audio format to stderr. | |
GAVL_PUBLIC int | gavl_channel_index (const gavl_audio_format_t *format, gavl_channel_id_t id) |
Get the index of a particular channel for a given format. | |
GAVL_PUBLIC int | gavl_front_channels (const gavl_audio_format_t *format) |
Get number of front channels for a given format. | |
GAVL_PUBLIC int | gavl_rear_channels (const gavl_audio_format_t *format) |
Get number of rear channels for a given format. | |
GAVL_PUBLIC int | gavl_side_channels (const gavl_audio_format_t *format) |
Get number of side channels for a given format. | |
GAVL_PUBLIC int | gavl_aux_channels (const gavl_audio_format_t *format) |
Get number of aux channels for a given format. | |
GAVL_PUBLIC int | gavl_lfe_channels (const gavl_audio_format_t *format) |
Get number of LFE channels for a given format. | |
GAVL_PUBLIC void | gavl_audio_format_copy (gavl_audio_format_t *dst, const gavl_audio_format_t *src) |
Copy one audio format to another. | |
GAVL_PUBLIC int | gavl_audio_formats_equal (const gavl_audio_format_t *format_1, const gavl_audio_format_t *format_2) |
Compare 2 audio formats. | |
GAVL_PUBLIC void | gavl_set_channel_setup (gavl_audio_format_t *format) |
Set the default channel setup and indices. | |
GAVL_PUBLIC int | gavl_bytes_per_sample (gavl_sample_format_t format) |
Get the number of bytes per sample for a given sample format. |
Definitions for several variations of audio data.
#define GAVL_MAX_CHANNELS 128 |
Maximum number of audio channels.
enum gavl_sample_format_t |
Format of one audio sample.
For multibyte numbers, the byte order is always machine native endian
enum gavl_channel_id_t |
Audio channel setup.
These are the channel locations used to identify the channel order for an audio format
GAVL_PUBLIC const char* gavl_sample_format_to_string | ( | gavl_sample_format_t | format | ) |
Convert a gavl_sample_format_t to a human readable string.
format | A sample format |
GAVL_PUBLIC gavl_sample_format_t gavl_string_to_sample_format | ( | const char * | str | ) |
Convert a string to a sample format.
str | String |
str must be one of the strings returned by gavl_sample_format_to_string
GAVL_PUBLIC int gavl_num_sample_formats | ( | ) |
Get total number of supported sample formats.
GAVL_PUBLIC gavl_sample_format_t gavl_get_sample_format | ( | int | index | ) |
Get the sample format from index.
index | index (must be between 0 and the result of gavl_num_sample_formats) |
GAVL_PUBLIC const char* gavl_channel_id_to_string | ( | gavl_channel_id_t | id | ) |
Convert a gavl_channel_id_t to a human readable string.
id | A channel id |
GAVL_PUBLIC const char* gavl_interleave_mode_to_string | ( | gavl_interleave_mode_t | mode | ) |
Convert a gavl_interleave_mode_t to a human readable string.
mode | An interleave mode |
GAVL_PUBLIC void gavl_audio_format_dump | ( | const gavl_audio_format_t * | format | ) |
Dump an audio format to stderr.
format | An audio format |
GAVL_PUBLIC int gavl_channel_index | ( | const gavl_audio_format_t * | format, | |
gavl_channel_id_t | id | |||
) |
Get the index of a particular channel for a given format.
format | An audio format | |
id | A channel id |
GAVL_PUBLIC int gavl_front_channels | ( | const gavl_audio_format_t * | format | ) |
Get number of front channels for a given format.
format | An audio format |
GAVL_PUBLIC int gavl_rear_channels | ( | const gavl_audio_format_t * | format | ) |
Get number of rear channels for a given format.
format | An audio format |
GAVL_PUBLIC int gavl_side_channels | ( | const gavl_audio_format_t * | format | ) |
Get number of side channels for a given format.
format | An audio format |
GAVL_PUBLIC int gavl_aux_channels | ( | const gavl_audio_format_t * | format | ) |
Get number of aux channels for a given format.
format | An audio format |
GAVL_PUBLIC int gavl_lfe_channels | ( | const gavl_audio_format_t * | format | ) |
Get number of LFE channels for a given format.
format | An audio format |
GAVL_PUBLIC void gavl_audio_format_copy | ( | gavl_audio_format_t * | dst, | |
const gavl_audio_format_t * | src | |||
) |
Copy one audio format to another.
dst | Destination format | |
src | Source format |
GAVL_PUBLIC int gavl_audio_formats_equal | ( | const gavl_audio_format_t * | format_1, | |
const gavl_audio_format_t * | format_2 | |||
) |
Compare 2 audio formats.
format_1 | First format | |
format_2 | Second format |
GAVL_PUBLIC void gavl_set_channel_setup | ( | gavl_audio_format_t * | format | ) |
Set the default channel setup and indices.
format | An audio format |
Set a default channel setup and channel indices if only the number of channels is known. The result might be wrong if you have something else than mono or stereo from a stream, which has no informtions about the speaker configurations.
GAVL_PUBLIC int gavl_bytes_per_sample | ( | gavl_sample_format_t | format | ) |
Get the number of bytes per sample for a given sample format.
format | A sample format |