Commit ddce544b authored by Max Kellermann's avatar Max Kellermann

output/alsa: move the PcmExport::Open() call to Open()

parent 21fb7eea
......@@ -157,7 +157,8 @@ private:
Error &error);
#endif
bool SetupOrDop(AudioFormat &audio_format, Error &error);
bool SetupOrDop(AudioFormat &audio_format, PcmExport::Params &params,
Error &error);
int Recover(int err);
......@@ -726,29 +727,17 @@ AlsaOutput::SetupDop(const AudioFormat audio_format,
#endif
inline bool
AlsaOutput::SetupOrDop(AudioFormat &audio_format, Error &error)
AlsaOutput::SetupOrDop(AudioFormat &audio_format, PcmExport::Params &params,
Error &error)
{
PcmExport::Params params;
params.alsa_channel_order = true;
#ifdef ENABLE_DSD
params.dop = dop && audio_format.format == SampleFormat::DSD;
#endif
const bool success =
#ifdef ENABLE_DSD
params.dop
? SetupDop(audio_format, params, error)
:
if (dop && audio_format.format == SampleFormat::DSD) {
params.dop = true;
return SetupDop(audio_format, params, error);
}
#endif
AlsaSetup(this, audio_format, params, error);
if (!success)
return false;
pcm_export->Open(audio_format.format,
audio_format.channels,
params);
return true;
return AlsaSetup(this, audio_format, params, error);
}
inline bool
......@@ -767,11 +756,18 @@ AlsaOutput::Open(AudioFormat &audio_format, Error &error)
snd_pcm_name(pcm),
snd_pcm_type_name(snd_pcm_type(pcm)));
if (!SetupOrDop(audio_format, error)) {
PcmExport::Params params;
params.alsa_channel_order = true;
if (!SetupOrDop(audio_format, params, error)) {
snd_pcm_close(pcm);
return false;
}
pcm_export->Open(audio_format.format,
audio_format.channels,
params);
in_frame_size = audio_format.GetFrameSize();
out_frame_size = pcm_export->GetFrameSize(audio_format);
......
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