Commit be9e60d5 authored by Max Kellermann's avatar Max Kellermann

audio_format: added audio_format_valid()

parent 774417f1
......@@ -40,6 +40,17 @@ static inline bool audio_format_defined(const struct audio_format *af)
return af->sample_rate != 0;
}
/**
* Returns false if the format is not valid for playback with MPD.
* This function performs some basic validity checks.
*/
static inline bool audio_format_valid(const struct audio_format *af)
{
return af->sample_rate > 0 &&
(af->bits == 8 || af->bits == 16 || af->bits == 24) &&
af->channels >= 1;
}
static inline bool audio_format_equals(const struct audio_format *a,
const struct audio_format *b)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment