diff options
-rw-r--r-- | src/audio_format.h | 19 |
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 |