aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-11-02 14:06:05 +0100
committerMax Kellermann <max@duempel.org>2014-11-02 14:06:05 +0100
commit303d67aed2da79d4ddaa3a52093ed42ae9da064d (patch)
tree060580f4c17b5d30d1e78e584df03c795ce4e1d7 /src/output
parent575fbad254a1ce67530bf2aedc9852c89c072c3f (diff)
parent6a7f6cdacd81877276563c42fdeacad3a8deface (diff)
downloadmpd-303d67aed2da79d4ddaa3a52093ed42ae9da064d.tar.gz
mpd-303d67aed2da79d4ddaa3a52093ed42ae9da064d.tar.xz
mpd-303d67aed2da79d4ddaa3a52093ed42ae9da064d.zip
Merge tag 'v0.19.2'
Diffstat (limited to 'src/output')
-rw-r--r--src/output/OutputThread.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx
index 54664bb65..2ec0670c1 100644
--- a/src/output/OutputThread.cxx
+++ b/src/output/OutputThread.cxx
@@ -22,6 +22,7 @@
#include "OutputAPI.hxx"
#include "Domain.hxx"
#include "pcm/PcmMix.hxx"
+#include "pcm/Domain.hxx"
#include "notify.hxx"
#include "filter/FilterInternal.hxx"
#include "filter/plugins/ConvertFilterPlugin.hxx"
@@ -165,6 +166,10 @@ AudioOutput::Open()
out_audio_format.ApplyMask(config_audio_format);
mutex.unlock();
+
+ const AudioFormat retry_audio_format = out_audio_format;
+
+ retry_without_dsd:
success = ao_plugin_open(this, out_audio_format, error);
mutex.lock();
@@ -189,6 +194,31 @@ AudioOutput::Open()
mutex.unlock();
ao_plugin_close(this);
+
+ if (error.IsDomain(pcm_domain) &&
+ out_audio_format.format == SampleFormat::DSD) {
+ /* if the audio output supports DSD, but not
+ the given sample rate, it asks MPD to
+ resample; resampling DSD however is not
+ implemented; our last resort is to give up
+ DSD and fall back to PCM */
+
+ // TODO: clean up this workaround
+
+ FormatError(output_domain, "Retrying without DSD");
+
+ out_audio_format = retry_audio_format;
+ out_audio_format.format = SampleFormat::FLOAT;
+
+ /* clear the Error to allow reusing it */
+ error.Clear();
+
+ /* sorry for the "goto" - this is a workaround
+ for the stable branch that should be as
+ unintrusive as possible */
+ goto retry_without_dsd;
+ }
+
CloseFilter();
mutex.lock();