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
This commit is contained in:
Max Kellermann
2015-10-27 00:22:22 +01:00
parent 4b1630e1ec
commit 15e432204e
10 changed files with 269 additions and 8 deletions

View File

@@ -33,6 +33,13 @@ template<typename T> struct ConstBuffer;
* representation which are not supported by the pcm_convert library.
*/
struct PcmExport {
/**
* This buffer is used to reorder channels.
*
* @see #alsa_channel_order
*/
PcmBuffer order_buffer;
/**
* The buffer is used to convert DSD samples to the
* DoP format.
@@ -60,6 +67,16 @@ struct PcmExport {
*/
uint8_t channels;
/**
* Convert the given buffer from FLAC channel order to ALSA
* channel order using ToAlsaChannelOrder()?
*
* If this value is SampleFormat::UNDEFINED, then no channel
* reordering is applied, otherwise this is the input sample
* format.
*/
SampleFormat alsa_channel_order;
/**
* Convert DSD to DSD-over-PCM (DoP)? Input format must be
* SampleFormat::DSD and output format must be
@@ -96,6 +113,7 @@ struct PcmExport {
* @param channels the number of channels; ignored unless dop is set
*/
void Open(SampleFormat sample_format, unsigned channels,
bool _alsa_channel_order,
bool dop, bool shift8, bool pack, bool reverse_endian);
/**