aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/ao_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 17:11:34 +0100
committerMax Kellermann <max@duempel.org>2009-12-02 22:29:50 +0100
commitc412d6251e9cd3abe735b7622af4003502e54f72 (patch)
tree7344c13f62e4cc788c830c05d21bb7b5b47f5866 /src/output/ao_plugin.c
parent68c2cfbb4067b2292e1ff1d4e7716ff370903f84 (diff)
downloadmpd-c412d6251e9cd3abe735b7622af4003502e54f72.tar.gz
mpd-c412d6251e9cd3abe735b7622af4003502e54f72.tar.xz
mpd-c412d6251e9cd3abe735b7622af4003502e54f72.zip
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.
Diffstat (limited to '')
-rw-r--r--src/output/ao_plugin.c23
1 files changed, 17 insertions, 6 deletions
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;