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.
This commit is contained in:
Max Kellermann 2019-06-18 12:17:20 +02:00
parent a17f420d6b
commit 72b8f33272
2 changed files with 10 additions and 10 deletions

View File

@ -32,10 +32,9 @@ PcmExport::Open(SampleFormat sample_format, unsigned _channels,
{
assert(audio_valid_sample_format(sample_format));
src_sample_format = sample_format;
channels = _channels;
alsa_channel_order = params.alsa_channel_order
? sample_format
: SampleFormat::UNDEFINED;
alsa_channel_order = params.alsa_channel_order;
#ifdef ENABLE_DSD
assert(params.dsd_mode != DsdMode::DOP ||
@ -204,9 +203,9 @@ PcmExport::Params::CalcInputSampleRate(unsigned sample_rate) const noexcept
ConstBuffer<void>
PcmExport::Export(ConstBuffer<void> data) noexcept
{
if (alsa_channel_order != SampleFormat::UNDEFINED)
if (alsa_channel_order)
data = ToAlsaChannelOrder(order_buffer, data,
alsa_channel_order, channels);
src_sample_format, channels);
#ifdef ENABLE_DSD
switch (dsd_mode) {

View File

@ -79,6 +79,11 @@ class PcmExport {
*/
PcmBuffer reverse_buffer;
/**
* The sample format of input data.
*/
SampleFormat src_sample_format;
/**
* The number of channels.
*/
@ -87,12 +92,8 @@ class PcmExport {
/**
* 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;
bool alsa_channel_order;
#ifdef ENABLE_DSD
public: