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