aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm/PcmExport.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-10-27 00:22:22 +0100
committerMax Kellermann <max@duempel.org>2015-10-27 11:44:23 +0100
commit15e432204e62dd5a1c873af13a679195b9645b0c (patch)
treea00687f4ac08b273a9416c36681749c42ed9dcbe /src/pcm/PcmExport.cxx
parent4b1630e1ec1fe5cbecc013a3e1487d9f43fcdd2f (diff)
downloadmpd-15e432204e62dd5a1c873af13a679195b9645b0c.tar.gz
mpd-15e432204e62dd5a1c873af13a679195b9645b0c.tar.xz
mpd-15e432204e62dd5a1c873af13a679195b9645b0c.zip
pcm/Order: new library to convert from FLAC to ALSA channel order
This new library is integrated in the PcmExport class and (if enabled) converts MPD's channel order (= FLAC channel order) to ALSA channel order. This fixes: http://bugs.musicpd.org/view.php?id=3147 and http://bugs.musicpd.org/view.php?id=3255
Diffstat (limited to '')
-rw-r--r--src/pcm/PcmExport.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pcm/PcmExport.cxx b/src/pcm/PcmExport.cxx
index af2eb7d9f..0bf4f8be8 100644
--- a/src/pcm/PcmExport.cxx
+++ b/src/pcm/PcmExport.cxx
@@ -19,6 +19,7 @@
#include "config.h"
#include "PcmExport.hxx"
+#include "Order.hxx"
#include "PcmDop.hxx"
#include "PcmPack.hxx"
#include "util/ByteReverse.hxx"
@@ -28,12 +29,16 @@
void
PcmExport::Open(SampleFormat sample_format, unsigned _channels,
+ bool _alsa_channel_order,
bool _dop, bool _shift8, bool _pack, bool _reverse_endian)
{
assert(audio_valid_sample_format(sample_format));
assert(!_dop || audio_valid_channel_count(_channels));
channels = _channels;
+ alsa_channel_order = _alsa_channel_order
+ ? sample_format
+ : SampleFormat::UNDEFINED;
dop = _dop && sample_format == SampleFormat::DSD;
if (dop)
/* after the conversion to DoP, the DSD
@@ -77,6 +82,10 @@ PcmExport::GetFrameSize(const AudioFormat &audio_format) const
ConstBuffer<void>
PcmExport::Export(ConstBuffer<void> data)
{
+ if (alsa_channel_order != SampleFormat::UNDEFINED)
+ data = ToAlsaChannelOrder(order_buffer, data,
+ alsa_channel_order, channels);
+
if (dop)
data = pcm_dsd_to_dop(dop_buffer, channels,
ConstBuffer<uint8_t>::FromVoid(data))