summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-02-28 10:15:54 +0100
committerMax Kellermann <max@duempel.org>2016-02-28 10:15:54 +0100
commitddce544b537b5f80721e8a4224e868ffa1f94a85 (patch)
treebd1ff79f013172b2bcb781b63efd224d01dfd5d0 /src/output
parent21fb7eea82b988358d5f48c2dadbf701c40608a2 (diff)
output/alsa: move the PcmExport::Open() call to Open()
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 28a7324a8..dcc0493fc 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -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);