summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-26 06:52:39 +0200
committerMax Kellermann <max@duempel.org>2014-08-26 07:10:16 +0200
commite463244db3f54fe049657ebf3845e75976696bef (patch)
tree2723a0382b6e468cc723df73865d1e38d1aead3b /src/output
parent9e10b75f55f15cbb0acfbceb464bae12d6997185 (diff)
output/alsa: move alsa_configure() into the class
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 307d0e2e4..d91eeea9f 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -129,6 +129,8 @@ struct AlsaOutput {
bool Init(const config_param &param, Error &error) {
return base.Configure(param, error);
}
+
+ bool Configure(const config_param &param, Error &error);
};
static constexpr Domain alsa_output_domain("alsa_output");
@@ -139,33 +141,35 @@ alsa_device(const AlsaOutput *ad)
return ad->device.empty() ? default_device : ad->device.c_str();
}
-static void
-alsa_configure(AlsaOutput *ad, const config_param &param)
+inline bool
+AlsaOutput::Configure(const config_param &param, gcc_unused Error &error)
{
- ad->device = param.GetBlockValue("device", "");
+ device = param.GetBlockValue("device", "");
- ad->use_mmap = param.GetBlockValue("use_mmap", false);
+ use_mmap = param.GetBlockValue("use_mmap", false);
- ad->dsd_usb = param.GetBlockValue("dsd_usb", false);
+ dsd_usb = param.GetBlockValue("dsd_usb", false);
- ad->buffer_time = param.GetBlockValue("buffer_time",
+ buffer_time = param.GetBlockValue("buffer_time",
MPD_ALSA_BUFFER_TIME_US);
- ad->period_time = param.GetBlockValue("period_time", 0u);
+ period_time = param.GetBlockValue("period_time", 0u);
#ifdef SND_PCM_NO_AUTO_RESAMPLE
if (!param.GetBlockValue("auto_resample", true))
- ad->mode |= SND_PCM_NO_AUTO_RESAMPLE;
+ mode |= SND_PCM_NO_AUTO_RESAMPLE;
#endif
#ifdef SND_PCM_NO_AUTO_CHANNELS
if (!param.GetBlockValue("auto_channels", true))
- ad->mode |= SND_PCM_NO_AUTO_CHANNELS;
+ mode |= SND_PCM_NO_AUTO_CHANNELS;
#endif
#ifdef SND_PCM_NO_AUTO_FORMAT
if (!param.GetBlockValue("auto_format", true))
- ad->mode |= SND_PCM_NO_AUTO_FORMAT;
+ mode |= SND_PCM_NO_AUTO_FORMAT;
#endif
+
+ return true;
}
static AudioOutput *
@@ -173,13 +177,11 @@ alsa_init(const config_param &param, Error &error)
{
AlsaOutput *ad = new AlsaOutput();
- if (!ad->Init(param, error)) {
+ if (!ad->Init(param, error) || !ad->Configure(param, error)) {
delete ad;
return nullptr;
}
- alsa_configure(ad, param);
-
return &ad->base;
}