aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-23 16:12:18 +0200
committerMax Kellermann <max@duempel.org>2014-08-26 07:11:53 +0200
commita86aaef4d0075df581857cdabb624a24885afa2b (patch)
tree1e12f2bf79bd6fb629f80c41de9a1937df0c614b /src/output
parente463244db3f54fe049657ebf3845e75976696bef (diff)
downloadmpd-a86aaef4d0075df581857cdabb624a24885afa2b.tar.gz
mpd-a86aaef4d0075df581857cdabb624a24885afa2b.tar.xz
mpd-a86aaef4d0075df581857cdabb624a24885afa2b.zip
output/alsa: support native DSD playback
Translate SampleFormat::DSD to SND_PCM_FORMAT_DSD_U8, which was added to alsa-lib 1.0.27.1.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index d91eeea9f..9f299642e 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -22,6 +22,7 @@
#include "../OutputAPI.hxx"
#include "mixer/MixerList.hxx"
#include "pcm/PcmExport.hxx"
+#include "config/ConfigError.hxx"
#include "util/Manual.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
@@ -32,6 +33,11 @@
#include <string>
+#if SND_LIB_VERSION >= 0x1001c
+/* alsa-lib supports DSD since version 1.0.27.1 */
+#define HAVE_ALSA_DSD
+#endif
+
static const char default_device[] = "default";
static constexpr unsigned MPD_ALSA_BUFFER_TIME_US = 500000;
@@ -236,8 +242,14 @@ get_bitformat(SampleFormat sample_format)
{
switch (sample_format) {
case SampleFormat::UNDEFINED:
+ return SND_PCM_FORMAT_UNKNOWN;
+
case SampleFormat::DSD:
+#ifdef HAVE_ALSA_DSD
+ return SND_PCM_FORMAT_DSD_U8;
+#else
return SND_PCM_FORMAT_UNKNOWN;
+#endif
case SampleFormat::S8:
return SND_PCM_FORMAT_S8;