Commit 72b8f332 authored by Max Kellermann's avatar Max Kellermann

pcm/Export: split src_sample_format from alsa_channel_order

Combining these two in one single value saves some memory, but is complicated and we may need the src_sample_format for new features later.
parent a17f420d
...@@ -32,10 +32,9 @@ PcmExport::Open(SampleFormat sample_format, unsigned _channels, ...@@ -32,10 +32,9 @@ PcmExport::Open(SampleFormat sample_format, unsigned _channels,
{ {
assert(audio_valid_sample_format(sample_format)); assert(audio_valid_sample_format(sample_format));
src_sample_format = sample_format;
channels = _channels; channels = _channels;
alsa_channel_order = params.alsa_channel_order alsa_channel_order = params.alsa_channel_order;
? sample_format
: SampleFormat::UNDEFINED;
#ifdef ENABLE_DSD #ifdef ENABLE_DSD
assert(params.dsd_mode != DsdMode::DOP || assert(params.dsd_mode != DsdMode::DOP ||
...@@ -204,9 +203,9 @@ PcmExport::Params::CalcInputSampleRate(unsigned sample_rate) const noexcept ...@@ -204,9 +203,9 @@ PcmExport::Params::CalcInputSampleRate(unsigned sample_rate) const noexcept
ConstBuffer<void> ConstBuffer<void>
PcmExport::Export(ConstBuffer<void> data) noexcept PcmExport::Export(ConstBuffer<void> data) noexcept
{ {
if (alsa_channel_order != SampleFormat::UNDEFINED) if (alsa_channel_order)
data = ToAlsaChannelOrder(order_buffer, data, data = ToAlsaChannelOrder(order_buffer, data,
alsa_channel_order, channels); src_sample_format, channels);
#ifdef ENABLE_DSD #ifdef ENABLE_DSD
switch (dsd_mode) { switch (dsd_mode) {
......
...@@ -80,6 +80,11 @@ class PcmExport { ...@@ -80,6 +80,11 @@ class PcmExport {
PcmBuffer reverse_buffer; PcmBuffer reverse_buffer;
/** /**
* The sample format of input data.
*/
SampleFormat src_sample_format;
/**
* The number of channels. * The number of channels.
*/ */
uint8_t channels; uint8_t channels;
...@@ -87,12 +92,8 @@ class PcmExport { ...@@ -87,12 +92,8 @@ class PcmExport {
/** /**
* Convert the given buffer from FLAC channel order to ALSA * Convert the given buffer from FLAC channel order to ALSA
* channel order using ToAlsaChannelOrder()? * 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; bool alsa_channel_order;
#ifdef ENABLE_DSD #ifdef ENABLE_DSD
public: public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment