Commit accd2625 authored by Max Kellermann's avatar Max Kellermann

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.
parent 3057d19c
......@@ -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
......
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