From 1fb3fbb4de11984c708b4b6355b172cda2b94d43 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 10 Oct 2011 09:06:28 +0200 Subject: audio_format: un-inline audio_format_mask_apply() This function is not critical for performance, and the inline expansion looks too expensive. --- src/audio_format.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/audio_format.c') diff --git a/src/audio_format.c b/src/audio_format.c index 799e0dd8..458ec3b1 100644 --- a/src/audio_format.c +++ b/src/audio_format.c @@ -28,6 +28,25 @@ #define REVERSE_ENDIAN_SUFFIX "_be" #endif +void +audio_format_mask_apply(struct audio_format *af, + const struct audio_format *mask) +{ + assert(audio_format_valid(af)); + assert(audio_format_mask_valid(mask)); + + if (mask->sample_rate != 0) + af->sample_rate = mask->sample_rate; + + if (mask->format != SAMPLE_FORMAT_UNDEFINED) + af->format = mask->format; + + if (mask->channels != 0) + af->channels = mask->channels; + + assert(audio_format_valid(af)); +} + const char * sample_format_to_string(enum sample_format format) { -- cgit v1.2.3