diff options
Diffstat (limited to 'src/pcm')
-rw-r--r-- | src/pcm/FormatConverter.cxx | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/pcm/FormatConverter.cxx b/src/pcm/FormatConverter.cxx index 64e2d8594..b058b32f5 100644 --- a/src/pcm/FormatConverter.cxx +++ b/src/pcm/FormatConverter.cxx @@ -28,11 +28,31 @@ bool PcmFormatConverter::Open(SampleFormat _src_format, SampleFormat _dest_format, - gcc_unused Error &error) + Error &error) { assert(_src_format != SampleFormat::UNDEFINED); assert(_dest_format != SampleFormat::UNDEFINED); + switch (_dest_format) { + case SampleFormat::UNDEFINED: + assert(false); + gcc_unreachable(); + + case SampleFormat::S8: + case SampleFormat::DSD: + error.Format(pcm_domain, + "PCM conversion from %s to %s is not implemented", + sample_format_to_string(_src_format), + sample_format_to_string(_dest_format)); + return nullptr; + + case SampleFormat::S16: + case SampleFormat::S24_P32: + case SampleFormat::S32: + case SampleFormat::FLOAT: + break; + } + src_format = _src_format; dest_format = _dest_format; return true; @@ -48,20 +68,14 @@ PcmFormatConverter::Close() } ConstBuffer<void> -PcmFormatConverter::Convert(ConstBuffer<void> src, Error &error) +PcmFormatConverter::Convert(ConstBuffer<void> src, gcc_unused Error &error) { switch (dest_format) { case SampleFormat::UNDEFINED: - assert(false); - gcc_unreachable(); - case SampleFormat::S8: case SampleFormat::DSD: - error.Format(pcm_domain, - "PCM conversion from %s to %s is not implemented", - sample_format_to_string(src_format), - sample_format_to_string(dest_format)); - return nullptr; + assert(false); + gcc_unreachable(); case SampleFormat::S16: return pcm_convert_to_16(buffer, dither, |