summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-07-20 14:41:06 +0200
committerMax Kellermann <max@musicpd.org>2020-07-20 14:47:36 +0200
commit64a1386eb652f5c34572fafc88b5fae9ac5a849d (patch)
tree5035649742d6e03cdcc6f962408a3004d74c7749 /src/output
parent77c2efe17112899bc4dff8ea8a37c6c4a4da992e (diff)
output/sles: move SampleFormat selection to switch/case block
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/sles/SlesOutputPlugin.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/output/plugins/sles/SlesOutputPlugin.cxx b/src/output/plugins/sles/SlesOutputPlugin.cxx
index 09968559d..b2e1b311d 100644
--- a/src/output/plugins/sles/SlesOutputPlugin.cxx
+++ b/src/output/plugins/sles/SlesOutputPlugin.cxx
@@ -188,6 +188,25 @@ SlesOutput::Open(AudioFormat &audio_format)
? SL_BYTEORDER_LITTLEENDIAN
: SL_BYTEORDER_BIGENDIAN;
+ switch (audio_format.format) {
+ /* note: Android doesn't support
+ SL_PCMSAMPLEFORMAT_FIXED_24 and
+ SL_PCMSAMPLEFORMAT_FIXED_32, so let's not bother
+ implement it here; SL_PCMSAMPLEFORMAT_FIXED_8
+ appears to be unsigned, so not usable for us (and
+ converting S8 to U8 is not worth the trouble) */
+
+ case SampleFormat::S16:
+ /* bitsPerSample and containerSize already set for 16
+ bit */
+ break;
+
+ default:
+ /* fall back to 16 bit */
+ audio_format.format = SampleFormat::S16;
+ break;
+ }
+
SLDataSource audioSrc = { &loc_bufq, &format_pcm };
SLDataLocator_OutputMix loc_outmix = {
@@ -291,9 +310,6 @@ SlesOutput::Open(AudioFormat &audio_format)
n_queued = 0;
next = 0;
filled = 0;
-
- // TODO: support other sample formats
- audio_format.format = SampleFormat::S16;
}
void