MPD 0.17~git
|
#include <glib.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | audio_format |
This structure describes the format of a raw PCM stream. More... | |
struct | audio_format_string |
Buffer for audio_format_string(). More... | |
Enumerations | |
enum | sample_format { SAMPLE_FORMAT_UNDEFINED = 0, SAMPLE_FORMAT_S8, SAMPLE_FORMAT_S16, SAMPLE_FORMAT_S24, SAMPLE_FORMAT_S24_P32, SAMPLE_FORMAT_S32, SAMPLE_FORMAT_FLOAT } |
Functions | |
static void | audio_format_clear (struct audio_format *af) |
Clears the audio_format object, i.e. | |
static void | audio_format_init (struct audio_format *af, uint32_t sample_rate, enum sample_format format, uint8_t channels) |
Initializes an audio_format object, i.e. | |
static bool | audio_format_defined (const struct audio_format *af) |
Checks whether the specified audio_format object has a defined value. | |
static bool | audio_format_fully_defined (const struct audio_format *af) |
Checks whether the specified audio_format object is full, i.e. | |
static bool | audio_format_mask_defined (const struct audio_format *af) |
Checks whether the specified audio_format object has at least one defined value. | |
static bool | audio_valid_sample_rate (unsigned sample_rate) |
Checks whether the sample rate is valid. | |
static bool | audio_valid_sample_format (enum sample_format format) |
Checks whether the sample format is valid. | |
static bool | audio_valid_channel_count (unsigned channels) |
Checks whether the number of channels is valid. | |
static G_GNUC_PURE bool | audio_format_valid (const struct audio_format *af) |
Returns false if the format is not valid for playback with MPD. | |
static G_GNUC_PURE bool | audio_format_mask_valid (const struct audio_format *af) |
Returns false if the format mask is not valid for playback with MPD. | |
static bool | audio_format_equals (const struct audio_format *a, const struct audio_format *b) |
void | audio_format_mask_apply (struct audio_format *af, const struct audio_format *mask) |
static G_GNUC_CONST unsigned | sample_format_size (enum sample_format format) |
static G_GNUC_PURE unsigned | audio_format_sample_size (const struct audio_format *af) |
Returns the size of each (mono) sample in bytes. | |
static G_GNUC_PURE unsigned | audio_format_frame_size (const struct audio_format *af) |
Returns the size of each full frame in bytes. | |
static G_GNUC_PURE double | audio_format_time_to_size (const struct audio_format *af) |
Returns the floating point factor which converts a time span to a storage size in bytes. | |
G_GNUC_PURE G_GNUC_MALLOC const char * | sample_format_to_string (enum sample_format format) |
Renders a sample_format enum into a string, e.g. | |
G_GNUC_PURE G_GNUC_MALLOC const char * | audio_format_to_string (const struct audio_format *af, struct audio_format_string *s) |
Renders the audio_format object into a string, e.g. | |
Variables | |
static const unsigned | MAX_CHANNELS = 8 |
enum sample_format |
Definition at line 28 of file audio_format.h.
static void audio_format_clear | ( | struct audio_format * | af | ) | [inline, static] |
Clears the audio_format object, i.e.
sets all attributes to an undefined (invalid) value.
Definition at line 98 of file audio_format.h.
static bool audio_format_defined | ( | const struct audio_format * | af | ) | [inline, static] |
Checks whether the specified audio_format object has a defined value.
Definition at line 124 of file audio_format.h.
static bool audio_format_equals | ( | const struct audio_format * | a, |
const struct audio_format * | b | ||
) | [inline, static] |
Definition at line 222 of file audio_format.h.
static G_GNUC_PURE unsigned audio_format_frame_size | ( | const struct audio_format * | af | ) | [inline, static] |
Returns the size of each full frame in bytes.
Definition at line 276 of file audio_format.h.
static bool audio_format_fully_defined | ( | const struct audio_format * | af | ) | [inline, static] |
Checks whether the specified audio_format object is full, i.e.
all attributes are defined. This is more complete than audio_format_defined(), but slower.
Definition at line 135 of file audio_format.h.
static void audio_format_init | ( | struct audio_format * | af, |
uint32_t | sample_rate, | ||
enum sample_format | format, | ||
uint8_t | channels | ||
) | [inline, static] |
Initializes an audio_format object, i.e.
sets all attributes to valid values.
Definition at line 110 of file audio_format.h.
void audio_format_mask_apply | ( | struct audio_format * | af, |
const struct audio_format * | mask | ||
) |
static bool audio_format_mask_defined | ( | const struct audio_format * | af | ) | [inline, static] |
Checks whether the specified audio_format object has at least one defined value.
Definition at line 146 of file audio_format.h.
static G_GNUC_PURE bool audio_format_mask_valid | ( | const struct audio_format * | af | ) | [inline, static] |
Returns false if the format mask is not valid for playback with MPD.
This function performs some basic validity checks.
Definition at line 213 of file audio_format.h.
static G_GNUC_PURE unsigned audio_format_sample_size | ( | const struct audio_format * | af | ) | [inline, static] |
Returns the size of each (mono) sample in bytes.
Definition at line 266 of file audio_format.h.
static G_GNUC_PURE double audio_format_time_to_size | ( | const struct audio_format * | af | ) | [inline, static] |
Returns the floating point factor which converts a time span to a storage size in bytes.
Definition at line 286 of file audio_format.h.
G_GNUC_PURE G_GNUC_MALLOC const char* audio_format_to_string | ( | const struct audio_format * | af, |
struct audio_format_string * | s | ||
) |
Renders the audio_format object into a string, e.g.
for printing it in a log file.
af | the audio_format object |
s | a buffer to print into |
static G_GNUC_PURE bool audio_format_valid | ( | const struct audio_format * | af | ) | [inline, static] |
Returns false if the format is not valid for playback with MPD.
This function performs some basic validity checks.
Definition at line 201 of file audio_format.h.
static bool audio_valid_channel_count | ( | unsigned | channels | ) | [inline, static] |
Checks whether the number of channels is valid.
Definition at line 191 of file audio_format.h.
static bool audio_valid_sample_format | ( | enum sample_format | format | ) | [inline, static] |
Checks whether the sample format is valid.
bits | the number of significant bits per sample |
Definition at line 169 of file audio_format.h.
static bool audio_valid_sample_rate | ( | unsigned | sample_rate | ) | [inline, static] |
Checks whether the sample rate is valid.
sample_rate | the sample rate in Hz |
Definition at line 158 of file audio_format.h.
static G_GNUC_CONST unsigned sample_format_size | ( | enum sample_format | format | ) | [inline, static] |
Definition at line 237 of file audio_format.h.
G_GNUC_PURE G_GNUC_MALLOC const char* sample_format_to_string | ( | enum sample_format | format | ) |
Renders a sample_format enum into a string, e.g.
for printing it in a log file.
format | a sample_format enum value |
const unsigned MAX_CHANNELS = 8 [static] |
Definition at line 54 of file audio_format.h.