audio_format: added audio_format_valid()

This commit is contained in:
Max Kellermann 2008-11-21 20:27:05 +01:00
parent 774417f12f
commit be9e60d55e
1 changed files with 11 additions and 0 deletions

View File

@ -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)
{