aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-10-08 15:03:43 +0200
committerMax Kellermann <max@duempel.org>2011-10-08 15:04:04 +0200
commitaccd26256185f4627583057ff3fafa39b5bc6387 (patch)
tree2f2f61ba74131c436218003f35a614148f0b61c1 /src
parent3057d19cdf904210d443c3c706ab98709613e9a5 (diff)
downloadmpd-accd26256185f4627583057ff3fafa39b5bc6387.tar.gz
mpd-accd26256185f4627583057ff3fafa39b5bc6387.tar.xz
mpd-accd26256185f4627583057ff3fafa39b5bc6387.zip
audio_format: move code to sample_format_size()
Cast to enum sample_format. Without the cast, it's just a plain integer, and gcc cannot know that a "case" statement is missing.
Diffstat (limited to '')
-rw-r--r--src/audio_format.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/audio_format.h b/src/audio_format.h
index 6e4f94b71..1e26974bc 100644
--- a/src/audio_format.h
+++ b/src/audio_format.h
@@ -237,12 +237,10 @@ audio_format_mask_apply(struct audio_format *af,
assert(audio_format_valid(af));
}
-/**
- * Returns the size of each (mono) sample in bytes.
- */
-static inline unsigned audio_format_sample_size(const struct audio_format *af)
+static inline unsigned
+sample_format_size(enum sample_format format)
{
- switch (af->format) {
+ switch (format) {
case SAMPLE_FORMAT_S8:
return 1;
@@ -257,13 +255,22 @@ static inline unsigned audio_format_sample_size(const struct audio_format *af)
return 4;
case SAMPLE_FORMAT_UNDEFINED:
- break;
+ return 0;
}
+ assert(false);
return 0;
}
/**
+ * Returns the size of each (mono) sample in bytes.
+ */
+static inline unsigned audio_format_sample_size(const struct audio_format *af)
+{
+ return sample_format_size((enum sample_format)af->format);
+}
+
+/**
* Returns the size of each full frame in bytes.
*/
static inline unsigned