aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-21 20:27:05 +0100
committerMax Kellermann <max@duempel.org>2008-11-21 20:27:05 +0100
commitbe9e60d55ef191b5b50a9d1eb2337a6b1199c8d4 (patch)
treedcd18345ef68b16d3c4e45583826243b612bd7e0 /src
parent774417f12f91e49ef16d763538da47215c0119b2 (diff)
downloadmpd-be9e60d55ef191b5b50a9d1eb2337a6b1199c8d4.tar.gz
mpd-be9e60d55ef191b5b50a9d1eb2337a6b1199c8d4.tar.xz
mpd-be9e60d55ef191b5b50a9d1eb2337a6b1199c8d4.zip
audio_format: added audio_format_valid()
Diffstat (limited to 'src')
-rw-r--r--src/audio_format.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/audio_format.h b/src/audio_format.h
index d2f32b858..739fe6c1f 100644
--- a/src/audio_format.h
+++ b/src/audio_format.h
@@ -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)
{