From c412d6251e9cd3abe735b7622af4003502e54f72 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 10 Nov 2009 17:11:34 +0100 Subject: audio_format: changed "bits" to "enum sample_format" This patch prepares support for floating point samples (and probably other formats). It changes the meaning of the "bits" attribute from a bit count to a symbolic value. --- src/output/ao_plugin.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/output/ao_plugin.c') diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c index d69175272..7afca0db2 100644 --- a/src/output/ao_plugin.c +++ b/src/output/ao_plugin.c @@ -170,13 +170,24 @@ ao_output_open(void *data, struct audio_format *audio_format, ao_sample_format format; struct ao_data *ad = (struct ao_data *)data; - /* support for 24 bit samples in libao is currently dubious, - and until we have sorted that out, resample everything to - 16 bit */ - if (audio_format->bits > 16) - audio_format->bits = 16; + switch (audio_format->format) { + case SAMPLE_FORMAT_S8: + format.bits = 8; + break; + + case SAMPLE_FORMAT_S16: + format.bits = 16; + break; + + default: + /* support for 24 bit samples in libao is currently + dubious, and until we have sorted that out, + convert everything to 16 bit */ + audio_format->format = SAMPLE_FORMAT_S16; + format.bits = 16; + break; + } - format.bits = audio_format->bits; format.rate = audio_format->sample_rate; format.byte_format = AO_FMT_NATIVE; format.channels = audio_format->channels; -- cgit v1.2.3