aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-21 22:13:44 +0100
committerMax Kellermann <max@duempel.org>2015-01-21 23:56:33 +0100
commit4fa5538e2bed36903b403e1aaee2462d22b456dc (patch)
tree292b66e10e6b97e2363fde34a81c027a67d3a9fe /src/output/plugins
parent84e74173de85a3897cfe67150297987f8c8bf52e (diff)
downloadmpd-4fa5538e2bed36903b403e1aaee2462d22b456dc.tar.gz
mpd-4fa5538e2bed36903b403e1aaee2462d22b456dc.tar.xz
mpd-4fa5538e2bed36903b403e1aaee2462d22b456dc.zip
config/Param: split block-specific attributes to new struct ConfigBlock
The old struct config_param remains only for top-level string options.
Diffstat (limited to '')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx30
-rw-r--r--src/output/plugins/AoOutputPlugin.cxx22
-rw-r--r--src/output/plugins/FifoOutputPlugin.cxx10
-rw-r--r--src/output/plugins/JackOutputPlugin.cxx28
-rw-r--r--src/output/plugins/NullOutputPlugin.cxx12
-rw-r--r--src/output/plugins/OSXOutputPlugin.cxx10
-rw-r--r--src/output/plugins/OpenALOutputPlugin.cxx14
-rw-r--r--src/output/plugins/OssOutputPlugin.cxx14
-rw-r--r--src/output/plugins/PipeOutputPlugin.cxx14
-rw-r--r--src/output/plugins/PulseOutputPlugin.cxx20
-rw-r--r--src/output/plugins/RecorderOutputPlugin.cxx24
-rw-r--r--src/output/plugins/RoarOutputPlugin.cxx20
-rw-r--r--src/output/plugins/ShoutOutputPlugin.cxx54
-rw-r--r--src/output/plugins/SolarisOutputPlugin.cxx10
-rw-r--r--src/output/plugins/WinmmOutputPlugin.cxx6
-rw-r--r--src/output/plugins/httpd/HttpdInternal.hxx12
-rw-r--r--src/output/plugins/httpd/HttpdOutputPlugin.cxx26
-rw-r--r--src/output/plugins/sles/SlesOutputPlugin.cxx14
18 files changed, 170 insertions, 170 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 22e13d7dc..8a7bb9643 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -142,8 +142,8 @@ struct AlsaOutput {
return device.empty() ? default_device : device.c_str();
}
- bool Configure(const config_param &param, Error &error);
- static AlsaOutput *Create(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
+ static AlsaOutput *Create(const ConfigBlock &block, Error &error);
bool Enable(Error &error);
void Disable();
@@ -175,35 +175,35 @@ private:
static constexpr Domain alsa_output_domain("alsa_output");
inline bool
-AlsaOutput::Configure(const config_param &param, Error &error)
+AlsaOutput::Configure(const ConfigBlock &block, Error &error)
{
- if (!base.Configure(param, error))
+ if (!base.Configure(block, error))
return false;
- device = param.GetBlockValue("device", "");
+ device = block.GetBlockValue("device", "");
- use_mmap = param.GetBlockValue("use_mmap", false);
+ use_mmap = block.GetBlockValue("use_mmap", false);
- dop = param.GetBlockValue("dop", false) ||
+ dop = block.GetBlockValue("dop", false) ||
/* legacy name from MPD 0.18 and older: */
- param.GetBlockValue("dsd_usb", false);
+ block.GetBlockValue("dsd_usb", false);
- buffer_time = param.GetBlockValue("buffer_time",
+ buffer_time = block.GetBlockValue("buffer_time",
MPD_ALSA_BUFFER_TIME_US);
- period_time = param.GetBlockValue("period_time", 0u);
+ period_time = block.GetBlockValue("period_time", 0u);
#ifdef SND_PCM_NO_AUTO_RESAMPLE
- if (!param.GetBlockValue("auto_resample", true))
+ if (!block.GetBlockValue("auto_resample", true))
mode |= SND_PCM_NO_AUTO_RESAMPLE;
#endif
#ifdef SND_PCM_NO_AUTO_CHANNELS
- if (!param.GetBlockValue("auto_channels", true))
+ if (!block.GetBlockValue("auto_channels", true))
mode |= SND_PCM_NO_AUTO_CHANNELS;
#endif
#ifdef SND_PCM_NO_AUTO_FORMAT
- if (!param.GetBlockValue("auto_format", true))
+ if (!block.GetBlockValue("auto_format", true))
mode |= SND_PCM_NO_AUTO_FORMAT;
#endif
@@ -211,11 +211,11 @@ AlsaOutput::Configure(const config_param &param, Error &error)
}
inline AlsaOutput *
-AlsaOutput::Create(const config_param &param, Error &error)
+AlsaOutput::Create(const ConfigBlock &block, Error &error)
{
AlsaOutput *ad = new AlsaOutput();
- if (!ad->Configure(param, error)) {
+ if (!ad->Configure(block, error)) {
delete ad;
return nullptr;
}
diff --git a/src/output/plugins/AoOutputPlugin.cxx b/src/output/plugins/AoOutputPlugin.cxx
index 31edd371e..3c0cf74a4 100644
--- a/src/output/plugins/AoOutputPlugin.cxx
+++ b/src/output/plugins/AoOutputPlugin.cxx
@@ -46,11 +46,11 @@ struct AoOutput {
AoOutput()
:base(ao_output_plugin) {}
- bool Initialize(const config_param &param, Error &error) {
- return base.Configure(param, error);
+ bool Initialize(const ConfigBlock &block, Error &error) {
+ return base.Configure(block, error);
}
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
};
static constexpr Domain ao_output_domain("ao_output");
@@ -90,20 +90,20 @@ ao_output_error(Error &error_r)
}
inline bool
-AoOutput::Configure(const config_param &param, Error &error)
+AoOutput::Configure(const ConfigBlock &block, Error &error)
{
const char *value;
options = nullptr;
- write_size = param.GetBlockValue("write_size", 1024u);
+ write_size = block.GetBlockValue("write_size", 1024u);
if (ao_output_ref == 0) {
ao_initialize();
}
ao_output_ref++;
- value = param.GetBlockValue("driver", "default");
+ value = block.GetBlockValue("driver", "default");
if (0 == strcmp(value, "default"))
driver = ao_default_driver_id();
else
@@ -123,9 +123,9 @@ AoOutput::Configure(const config_param &param, Error &error)
}
FormatDebug(ao_output_domain, "using ao driver \"%s\" for \"%s\"\n",
- ai->short_name, param.GetBlockValue("name", nullptr));
+ ai->short_name, block.GetBlockValue("name", nullptr));
- value = param.GetBlockValue("options", nullptr);
+ value = block.GetBlockValue("options", nullptr);
if (value != nullptr) {
for (const auto &i : SplitString(value, ';')) {
const DivideString ss(i.c_str(), '=', true);
@@ -145,16 +145,16 @@ AoOutput::Configure(const config_param &param, Error &error)
}
static AudioOutput *
-ao_output_init(const config_param &param, Error &error)
+ao_output_init(const ConfigBlock &block, Error &error)
{
AoOutput *ad = new AoOutput();
- if (!ad->Initialize(param, error)) {
+ if (!ad->Initialize(block, error)) {
delete ad;
return nullptr;
}
- if (!ad->Configure(param, error)) {
+ if (!ad->Configure(block, error)) {
delete ad;
return nullptr;
}
diff --git a/src/output/plugins/FifoOutputPlugin.cxx b/src/output/plugins/FifoOutputPlugin.cxx
index 40ae6a370..ddc63489c 100644
--- a/src/output/plugins/FifoOutputPlugin.cxx
+++ b/src/output/plugins/FifoOutputPlugin.cxx
@@ -51,8 +51,8 @@ struct FifoOutput {
path(AllocatedPath::Null()), input(-1), output(-1),
created(false) {}
- bool Initialize(const config_param &param, Error &error) {
- return base.Configure(param, error);
+ bool Initialize(const ConfigBlock &block, Error &error) {
+ return base.Configure(block, error);
}
bool Create(Error &error);
@@ -169,11 +169,11 @@ fifo_open(FifoOutput *fd, Error &error)
}
static AudioOutput *
-fifo_output_init(const config_param &param, Error &error)
+fifo_output_init(const ConfigBlock &block, Error &error)
{
FifoOutput *fd = new FifoOutput();
- fd->path = param.GetBlockPath("path", error);
+ fd->path = block.GetBlockPath("path", error);
if (fd->path.IsNull()) {
delete fd;
@@ -185,7 +185,7 @@ fifo_output_init(const config_param &param, Error &error)
fd->path_utf8 = fd->path.ToUTF8();
- if (!fd->Initialize(param, error)) {
+ if (!fd->Initialize(block, error)) {
delete fd;
return nullptr;
}
diff --git a/src/output/plugins/JackOutputPlugin.cxx b/src/output/plugins/JackOutputPlugin.cxx
index 5c136b81f..23843ab5e 100644
--- a/src/output/plugins/JackOutputPlugin.cxx
+++ b/src/output/plugins/JackOutputPlugin.cxx
@@ -83,7 +83,7 @@ struct JackOutput {
JackOutput()
:base(jack_output_plugin) {}
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
bool Connect(Error &error);
@@ -376,14 +376,14 @@ parse_port_list(const char *source, std::string dest[], Error &error)
}
bool
-JackOutput::Configure(const config_param &param, Error &error)
+JackOutput::Configure(const ConfigBlock &block, Error &error)
{
- if (!base.Configure(param, error))
+ if (!base.Configure(block, error))
return false;
options = JackNullOption;
- name = param.GetBlockValue("client_name", nullptr);
+ name = block.GetBlockValue("client_name", nullptr);
if (name != nullptr)
options = jack_options_t(options | JackUseExactName);
else
@@ -391,30 +391,30 @@ JackOutput::Configure(const config_param &param, Error &error)
care about the JackUseExactName option */
name = "Music Player Daemon";
- server_name = param.GetBlockValue("server_name", nullptr);
+ server_name = block.GetBlockValue("server_name", nullptr);
if (server_name != nullptr)
options = jack_options_t(options | JackServerName);
- if (!param.GetBlockValue("autostart", false))
+ if (!block.GetBlockValue("autostart", false))
options = jack_options_t(options | JackNoStartServer);
/* configure the source ports */
- const char *value = param.GetBlockValue("source_ports", "left,right");
+ const char *value = block.GetBlockValue("source_ports", "left,right");
num_source_ports = parse_port_list(value, source_ports, error);
if (num_source_ports == 0)
return false;
/* configure the destination ports */
- value = param.GetBlockValue("destination_ports", nullptr);
+ value = block.GetBlockValue("destination_ports", nullptr);
if (value == nullptr) {
/* compatibility with MPD < 0.16 */
- value = param.GetBlockValue("ports", nullptr);
+ value = block.GetBlockValue("ports", nullptr);
if (value != nullptr)
FormatWarning(jack_output_domain,
"deprecated option 'ports' in line %d",
- param.line);
+ block.line);
}
if (value != nullptr) {
@@ -432,9 +432,9 @@ JackOutput::Configure(const config_param &param, Error &error)
"number of source ports (%u) mismatches the "
"number of destination ports (%u) in line %d",
num_source_ports, num_destination_ports,
- param.line);
+ block.line);
- ringbuffer_size = param.GetBlockValue("ringbuffer_size", 32768u);
+ ringbuffer_size = block.GetBlockValue("ringbuffer_size", 32768u);
return true;
}
@@ -463,11 +463,11 @@ JackOutput::Disable()
}
static AudioOutput *
-mpd_jack_init(const config_param &param, Error &error)
+mpd_jack_init(const ConfigBlock &block, Error &error)
{
JackOutput *jd = new JackOutput();
- if (!jd->Configure(param, error)) {
+ if (!jd->Configure(block, error)) {
delete jd;
return nullptr;
}
diff --git a/src/output/plugins/NullOutputPlugin.cxx b/src/output/plugins/NullOutputPlugin.cxx
index e3b462da2..e1731f0fe 100644
--- a/src/output/plugins/NullOutputPlugin.cxx
+++ b/src/output/plugins/NullOutputPlugin.cxx
@@ -36,11 +36,11 @@ public:
NullOutput()
:base(null_output_plugin) {}
- bool Initialize(const config_param &param, Error &error) {
- return base.Configure(param, error);
+ bool Initialize(const ConfigBlock &block, Error &error) {
+ return base.Configure(block, error);
}
- static NullOutput *Create(const config_param &param, Error &error);
+ static NullOutput *Create(const ConfigBlock &block, Error &error);
bool Open(AudioFormat &audio_format, gcc_unused Error &error) {
if (sync)
@@ -78,16 +78,16 @@ public:
};
inline NullOutput *
-NullOutput::Create(const config_param &param, Error &error)
+NullOutput::Create(const ConfigBlock &block, Error &error)
{
NullOutput *nd = new NullOutput();
- if (!nd->Initialize(param, error)) {
+ if (!nd->Initialize(block, error)) {
delete nd;
return nullptr;
}
- nd->sync = param.GetBlockValue("sync", true);
+ nd->sync = block.GetBlockValue("sync", true);
return nd;
}
diff --git a/src/output/plugins/OSXOutputPlugin.cxx b/src/output/plugins/OSXOutputPlugin.cxx
index 3274d5b45..16c042ba3 100644
--- a/src/output/plugins/OSXOutputPlugin.cxx
+++ b/src/output/plugins/OSXOutputPlugin.cxx
@@ -61,9 +61,9 @@ osx_output_test_default_device(void)
}
static void
-osx_output_configure(OSXOutput *oo, const config_param &param)
+osx_output_configure(OSXOutput *oo, const ConfigBlock &block)
{
- const char *device = param.GetBlockValue("device");
+ const char *device = block.GetBlockValue("device");
if (device == nullptr || 0 == strcmp(device, "default")) {
oo->component_subtype = kAudioUnitSubType_DefaultOutput;
@@ -81,15 +81,15 @@ osx_output_configure(OSXOutput *oo, const config_param &param)
}
static AudioOutput *
-osx_output_init(const config_param &param, Error &error)
+osx_output_init(const ConfigBlock &block, Error &error)
{
OSXOutput *oo = new OSXOutput();
- if (!oo->base.Configure(param, error)) {
+ if (!oo->base.Configure(block, error)) {
delete oo;
return nullptr;
}
- osx_output_configure(oo, param);
+ osx_output_configure(oo, block);
return &oo->base;
}
diff --git a/src/output/plugins/OpenALOutputPlugin.cxx b/src/output/plugins/OpenALOutputPlugin.cxx
index c28250eb0..eb55c6e9b 100644
--- a/src/output/plugins/OpenALOutputPlugin.cxx
+++ b/src/output/plugins/OpenALOutputPlugin.cxx
@@ -54,9 +54,9 @@ class OpenALOutput {
OpenALOutput()
:base(openal_output_plugin) {}
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
- static OpenALOutput *Create(const config_param &param, Error &error);
+ static OpenALOutput *Create(const ConfigBlock &block, Error &error);
bool Open(AudioFormat &audio_format, Error &error);
@@ -150,12 +150,12 @@ OpenALOutput::SetupContext(Error &error)
}
inline bool
-OpenALOutput::Configure(const config_param &param, Error &error)
+OpenALOutput::Configure(const ConfigBlock &block, Error &error)
{
- if (!base.Configure(param, error))
+ if (!base.Configure(block, error))
return false;
- device_name = param.GetBlockValue("device");
+ device_name = block.GetBlockValue("device");
if (device_name == nullptr)
device_name = alcGetString(nullptr,
ALC_DEFAULT_DEVICE_SPECIFIER);
@@ -164,11 +164,11 @@ OpenALOutput::Configure(const config_param &param, Error &error)
}
inline OpenALOutput *
-OpenALOutput::Create(const config_param &param, Error &error)
+OpenALOutput::Create(const ConfigBlock &block, Error &error)
{
OpenALOutput *oo = new OpenALOutput();
- if (!oo->Configure(param, error)) {
+ if (!oo->Configure(block, error)) {
delete oo;
return nullptr;
}
diff --git a/src/output/plugins/OssOutputPlugin.cxx b/src/output/plugins/OssOutputPlugin.cxx
index 1b14e16c7..7f75f4e31 100644
--- a/src/output/plugins/OssOutputPlugin.cxx
+++ b/src/output/plugins/OssOutputPlugin.cxx
@@ -87,11 +87,11 @@ public:
:base(oss_output_plugin),
fd(-1), device(_device) {}
- bool Initialize(const config_param &param, Error &error_r) {
- return base.Configure(param, error_r);
+ bool Initialize(const ConfigBlock &block, Error &error_r) {
+ return base.Configure(block, error_r);
}
- static OssOutput *Create(const config_param &param, Error &error);
+ static OssOutput *Create(const ConfigBlock &block, Error &error);
#ifdef AFMT_S24_PACKED
bool Enable(gcc_unused Error &error) {
@@ -192,7 +192,7 @@ oss_open_default(Error &error)
int err[ARRAY_SIZE(default_devices)];
enum oss_stat ret[ARRAY_SIZE(default_devices)];
- const config_param empty;
+ const ConfigBlock empty;
for (int i = ARRAY_SIZE(default_devices); --i >= 0; ) {
ret[i] = oss_stat_device(default_devices[i], &err[i]);
if (ret[i] == OSS_STAT_NO_ERROR) {
@@ -236,12 +236,12 @@ oss_open_default(Error &error)
}
inline OssOutput *
-OssOutput::Create(const config_param &param, Error &error)
+OssOutput::Create(const ConfigBlock &block, Error &error)
{
- const char *device = param.GetBlockValue("device");
+ const char *device = block.GetBlockValue("device");
if (device != nullptr) {
OssOutput *od = new OssOutput();
- if (!od->Initialize(param, error)) {
+ if (!od->Initialize(block, error)) {
delete od;
return nullptr;
}
diff --git a/src/output/plugins/PipeOutputPlugin.cxx b/src/output/plugins/PipeOutputPlugin.cxx
index ea9300cf3..1e34ea98d 100644
--- a/src/output/plugins/PipeOutputPlugin.cxx
+++ b/src/output/plugins/PipeOutputPlugin.cxx
@@ -40,10 +40,10 @@ class PipeOutput {
PipeOutput()
:base(pipe_output_plugin) {}
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
public:
- static PipeOutput *Create(const config_param &param, Error &error);
+ static PipeOutput *Create(const ConfigBlock &block, Error &error);
bool Open(AudioFormat &audio_format, Error &error);
@@ -58,12 +58,12 @@ public:
static constexpr Domain pipe_output_domain("pipe_output");
inline bool
-PipeOutput::Configure(const config_param &param, Error &error)
+PipeOutput::Configure(const ConfigBlock &block, Error &error)
{
- if (!base.Configure(param, error))
+ if (!base.Configure(block, error))
return false;
- cmd = param.GetBlockValue("command", "");
+ cmd = block.GetBlockValue("command", "");
if (cmd.empty()) {
error.Set(config_domain,
"No \"command\" parameter specified");
@@ -74,11 +74,11 @@ PipeOutput::Configure(const config_param &param, Error &error)
}
inline PipeOutput *
-PipeOutput::Create(const config_param &param, Error &error)
+PipeOutput::Create(const ConfigBlock &block, Error &error)
{
PipeOutput *po = new PipeOutput();
- if (!po->Configure(param, error)) {
+ if (!po->Configure(block, error)) {
delete po;
return nullptr;
}
diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx
index 8ad885f82..8b5225584 100644
--- a/src/output/plugins/PulseOutputPlugin.cxx
+++ b/src/output/plugins/PulseOutputPlugin.cxx
@@ -98,8 +98,8 @@ public:
gcc_const
static bool TestDefaultDevice();
- bool Configure(const config_param &param, Error &error);
- static PulseOutput *Create(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
+ static PulseOutput *Create(const ConfigBlock &block, Error &error);
bool Enable(Error &error);
void Disable();
@@ -430,26 +430,26 @@ PulseOutput::SetupContext(Error &error)
}
inline bool
-PulseOutput::Configure(const config_param &param, Error &error)
+PulseOutput::Configure(const ConfigBlock &block, Error &error)
{
- if (!base.Configure(param, error))
+ if (!base.Configure(block, error))
return false;
- name = param.GetBlockValue("name", "mpd_pulse");
- server = param.GetBlockValue("server");
- sink = param.GetBlockValue("sink");
+ name = block.GetBlockValue("name", "mpd_pulse");
+ server = block.GetBlockValue("server");
+ sink = block.GetBlockValue("sink");
return true;
}
PulseOutput *
-PulseOutput::Create(const config_param &param, Error &error)
+PulseOutput::Create(const ConfigBlock &block, Error &error)
{
setenv("PULSE_PROP_media.role", "music", true);
setenv("PULSE_PROP_application.icon_name", "mpd", true);
auto *po = new PulseOutput();
- if (!po->Configure(param, error)) {
+ if (!po->Configure(block, error)) {
delete po;
return nullptr;
}
@@ -926,7 +926,7 @@ PulseOutput::Pause()
inline bool
PulseOutput::TestDefaultDevice()
{
- const config_param empty;
+ const ConfigBlock empty;
PulseOutput *po = PulseOutput::Create(empty, IgnoreError());
if (po == nullptr)
return false;
diff --git a/src/output/plugins/RecorderOutputPlugin.cxx b/src/output/plugins/RecorderOutputPlugin.cxx
index b0488080a..115ee534d 100644
--- a/src/output/plugins/RecorderOutputPlugin.cxx
+++ b/src/output/plugins/RecorderOutputPlugin.cxx
@@ -81,13 +81,13 @@ class RecorderOutput {
encoder->Dispose();
}
- bool Initialize(const config_param &param, Error &error_r) {
- return base.Configure(param, error_r);
+ bool Initialize(const ConfigBlock &block, Error &error_r) {
+ return base.Configure(block, error_r);
}
- static RecorderOutput *Create(const config_param &param, Error &error);
+ static RecorderOutput *Create(const ConfigBlock &block, Error &error);
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
bool Open(AudioFormat &audio_format, Error &error);
void Close();
@@ -117,12 +117,12 @@ private:
};
inline bool
-RecorderOutput::Configure(const config_param &param, Error &error)
+RecorderOutput::Configure(const ConfigBlock &block, Error &error)
{
/* read configuration */
const char *encoder_name =
- param.GetBlockValue("encoder", "vorbis");
+ block.GetBlockValue("encoder", "vorbis");
const auto encoder_plugin = encoder_plugin_get(encoder_name);
if (encoder_plugin == nullptr) {
error.Format(config_domain,
@@ -130,11 +130,11 @@ RecorderOutput::Configure(const config_param &param, Error &error)
return false;
}
- path = param.GetBlockPath("path", error);
+ path = block.GetBlockPath("path", error);
if (error.IsDefined())
return false;
- const char *fmt = param.GetBlockValue("format_path", nullptr);
+ const char *fmt = block.GetBlockValue("format_path", nullptr);
if (fmt != nullptr)
format_path = fmt;
@@ -150,7 +150,7 @@ RecorderOutput::Configure(const config_param &param, Error &error)
/* initialize encoder */
- encoder = encoder_init(*encoder_plugin, param, error);
+ encoder = encoder_init(*encoder_plugin, block, error);
if (encoder == nullptr)
return false;
@@ -158,16 +158,16 @@ RecorderOutput::Configure(const config_param &param, Error &error)
}
RecorderOutput *
-RecorderOutput::Create(const config_param &param, Error &error)
+RecorderOutput::Create(const ConfigBlock &block, Error &error)
{
RecorderOutput *recorder = new RecorderOutput();
- if (!recorder->Initialize(param, error)) {
+ if (!recorder->Initialize(block, error)) {
delete recorder;
return nullptr;
}
- if (!recorder->Configure(param, error)) {
+ if (!recorder->Configure(block, error)) {
delete recorder;
return nullptr;
}
diff --git a/src/output/plugins/RoarOutputPlugin.cxx b/src/output/plugins/RoarOutputPlugin.cxx
index c0a429198..11b0f1671 100644
--- a/src/output/plugins/RoarOutputPlugin.cxx
+++ b/src/output/plugins/RoarOutputPlugin.cxx
@@ -60,11 +60,11 @@ public:
return &base;
}
- bool Initialize(const config_param &param, Error &error) {
- return base.Configure(param, error);
+ bool Initialize(const ConfigBlock &block, Error &error) {
+ return base.Configure(block, error);
}
- void Configure(const config_param &param);
+ void Configure(const ConfigBlock &block);
bool Open(AudioFormat &audio_format, Error &error);
void Close();
@@ -124,28 +124,28 @@ roar_output_set_volume(RoarOutput &roar, unsigned volume)
}
inline void
-RoarOutput::Configure(const config_param &param)
+RoarOutput::Configure(const ConfigBlock &block)
{
- host = param.GetBlockValue("server", "");
- name = param.GetBlockValue("name", "MPD");
+ host = block.GetBlockValue("server", "");
+ name = block.GetBlockValue("name", "MPD");
- const char *_role = param.GetBlockValue("role", "music");
+ const char *_role = block.GetBlockValue("role", "music");
role = _role != nullptr
? roar_str2role(_role)
: ROAR_ROLE_MUSIC;
}
static AudioOutput *
-roar_init(const config_param &param, Error &error)
+roar_init(const ConfigBlock &block, Error &error)
{
RoarOutput *self = new RoarOutput();
- if (!self->Initialize(param, error)) {
+ if (!self->Initialize(block, error)) {
delete self;
return nullptr;
}
- self->Configure(param);
+ self->Configure(block);
return *self;
}
diff --git a/src/output/plugins/ShoutOutputPlugin.cxx b/src/output/plugins/ShoutOutputPlugin.cxx
index 9157afd37..339c4e491 100644
--- a/src/output/plugins/ShoutOutputPlugin.cxx
+++ b/src/output/plugins/ShoutOutputPlugin.cxx
@@ -68,11 +68,11 @@ struct ShoutOutput final {
shout_free(shout_conn);
}
- bool Initialize(const config_param &param, Error &error) {
- return base.Configure(param, error);
+ bool Initialize(const ConfigBlock &block, Error &error) {
+ return base.Configure(block, error);
}
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
};
static int shout_init_count;
@@ -92,18 +92,18 @@ shout_encoder_plugin_get(const char *name)
gcc_pure
static const char *
-require_block_string(const config_param &param, const char *name)
+require_block_string(const ConfigBlock &block, const char *name)
{
- const char *value = param.GetBlockValue(name);
+ const char *value = block.GetBlockValue(name);
if (value == nullptr)
FormatFatalError("no \"%s\" defined for shout device defined "
- "at line %d\n", name, param.line);
+ "at line %d\n", name, block.line);
return value;
}
inline bool
-ShoutOutput::Configure(const config_param &param, Error &error)
+ShoutOutput::Configure(const ConfigBlock &block, Error &error)
{
const AudioFormat audio_format = base.config_audio_format;
@@ -113,22 +113,22 @@ ShoutOutput::Configure(const config_param &param, Error &error)
return false;
}
- const char *host = require_block_string(param, "host");
- const char *mount = require_block_string(param, "mount");
- unsigned port = param.GetBlockValue("port", 0u);
+ const char *host = require_block_string(block, "host");
+ const char *mount = require_block_string(block, "mount");
+ unsigned port = block.GetBlockValue("port", 0u);
if (port == 0) {
error.Set(config_domain, "shout port must be configured");
return false;
}
- const char *passwd = require_block_string(param, "password");
- const char *name = require_block_string(param, "name");
+ const char *passwd = require_block_string(block, "password");
+ const char *name = require_block_string(block, "name");
- bool is_public = param.GetBlockValue("public", false);
+ bool is_public = block.GetBlockValue("public", false);
- const char *user = param.GetBlockValue("user", "source");
+ const char *user = block.GetBlockValue("user", "source");
- const char *value = param.GetBlockValue("quality");
+ const char *value = block.GetBlockValue("quality");
if (value != nullptr) {
char *test;
quality = strtod(value, &test);
@@ -141,14 +141,14 @@ ShoutOutput::Configure(const config_param &param, Error &error)
return false;
}
- if (param.GetBlockValue("bitrate") != nullptr) {
+ if (block.GetBlockValue("bitrate") != nullptr) {
error.Set(config_domain,
"quality and bitrate are "
"both defined");
return false;
}
} else {
- value = param.GetBlockValue("bitrate");
+ value = block.GetBlockValue("bitrate");
if (value == nullptr) {
error.Set(config_domain,
"neither bitrate nor quality defined");
@@ -165,7 +165,7 @@ ShoutOutput::Configure(const config_param &param, Error &error)
}
}
- const char *encoding = param.GetBlockValue("encoding", "ogg");
+ const char *encoding = block.GetBlockValue("encoding", "ogg");
const auto encoder_plugin = shout_encoder_plugin_get(encoding);
if (encoder_plugin == nullptr) {
error.Format(config_domain,
@@ -174,7 +174,7 @@ ShoutOutput::Configure(const config_param &param, Error &error)
return false;
}
- encoder = encoder_init(*encoder_plugin, param, error);
+ encoder = encoder_init(*encoder_plugin, block, error);
if (encoder == nullptr)
return false;
@@ -185,7 +185,7 @@ ShoutOutput::Configure(const config_param &param, Error &error)
shout_format = SHOUT_FORMAT_OGG;
unsigned protocol;
- value = param.GetBlockValue("protocol");
+ value = block.GetBlockValue("protocol");
if (value != nullptr) {
if (0 == strcmp(value, "shoutcast") &&
0 != strcmp(encoding, "mp3")) {
@@ -226,21 +226,21 @@ ShoutOutput::Configure(const config_param &param, Error &error)
}
/* optional paramters */
- timeout = param.GetBlockValue("timeout", DEFAULT_CONN_TIMEOUT);
+ timeout = block.GetBlockValue("timeout", DEFAULT_CONN_TIMEOUT);
- value = param.GetBlockValue("genre");
+ value = block.GetBlockValue("genre");
if (value != nullptr && shout_set_genre(shout_conn, value)) {
error.Set(shout_output_domain, shout_get_error(shout_conn));
return false;
}
- value = param.GetBlockValue("description");
+ value = block.GetBlockValue("description");
if (value != nullptr && shout_set_description(shout_conn, value)) {
error.Set(shout_output_domain, shout_get_error(shout_conn));
return false;
}
- value = param.GetBlockValue("url");
+ value = block.GetBlockValue("url");
if (value != nullptr && shout_set_url(shout_conn, value)) {
error.Set(shout_output_domain, shout_get_error(shout_conn));
return false;
@@ -272,15 +272,15 @@ ShoutOutput::Configure(const config_param &param, Error &error)
}
static AudioOutput *
-my_shout_init_driver(const config_param &param, Error &error)
+my_shout_init_driver(const ConfigBlock &block, Error &error)
{
ShoutOutput *sd = new ShoutOutput();
- if (!sd->Initialize(param, error)) {
+ if (!sd->Initialize(block, error)) {
delete sd;
return nullptr;
}
- if (!sd->Configure(param, error)) {
+ if (!sd->Configure(block, error)) {
delete sd;
return nullptr;
}
diff --git a/src/output/plugins/SolarisOutputPlugin.cxx b/src/output/plugins/SolarisOutputPlugin.cxx
index 15a8707fe..18c92d361 100644
--- a/src/output/plugins/SolarisOutputPlugin.cxx
+++ b/src/output/plugins/SolarisOutputPlugin.cxx
@@ -60,8 +60,8 @@ struct SolarisOutput {
SolarisOutput()
:base(solaris_output_plugin) {}
- bool Initialize(const config_param &param, Error &error_r) {
- return base.Configure(param, error_r);
+ bool Initialize(const ConfigBlock &block, Error &error_r) {
+ return base.Configure(block, error_r);
}
};
@@ -75,15 +75,15 @@ solaris_output_test_default_device(void)
}
static AudioOutput *
-solaris_output_init(const config_param &param, Error &error_r)
+solaris_output_init(const ConfigBlock &block, Error &error_r)
{
SolarisOutput *so = new SolarisOutput();
- if (!so->Initialize(param, error_r)) {
+ if (!so->Initialize(block, error_r)) {
delete so;
return nullptr;
}
- so->device = param.GetBlockValue("device", "/dev/audio");
+ so->device = block.GetBlockValue("device", "/dev/audio");
return &so->base;
}
diff --git a/src/output/plugins/WinmmOutputPlugin.cxx b/src/output/plugins/WinmmOutputPlugin.cxx
index 6b8f62844..95f359828 100644
--- a/src/output/plugins/WinmmOutputPlugin.cxx
+++ b/src/output/plugins/WinmmOutputPlugin.cxx
@@ -122,15 +122,15 @@ fail:
}
static AudioOutput *
-winmm_output_init(const config_param &param, Error &error)
+winmm_output_init(const ConfigBlock &block, Error &error)
{
WinmmOutput *wo = new WinmmOutput();
- if (!wo->base.Configure(param, error)) {
+ if (!wo->base.Configure(block, error)) {
delete wo;
return nullptr;
}
- const char *device = param.GetBlockValue("device");
+ const char *device = block.GetBlockValue("device");
if (!get_device_id(device, &wo->device_id, error)) {
delete wo;
return nullptr;
diff --git a/src/output/plugins/httpd/HttpdInternal.hxx b/src/output/plugins/httpd/HttpdInternal.hxx
index 6e659c703..d3ea49cd4 100644
--- a/src/output/plugins/httpd/HttpdInternal.hxx
+++ b/src/output/plugins/httpd/HttpdInternal.hxx
@@ -42,7 +42,7 @@
#include <queue>
#include <list>
-struct config_param;
+struct ConfigBlock;
class Error;
class EventLoop;
class ServerSocket;
@@ -162,16 +162,16 @@ public:
using DeferredMonitor::GetEventLoop;
- bool Init(const config_param &param, Error &error);
+ bool Init(const ConfigBlock &block, Error &error);
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
- AudioOutput *InitAndConfigure(const config_param &param,
+ AudioOutput *InitAndConfigure(const ConfigBlock &block,
Error &error) {
- if (!Init(param, error))
+ if (!Init(block, error))
return nullptr;
- if (!Configure(param, error))
+ if (!Configure(block, error))
return nullptr;
return &base;
diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx
index 19ee38cd2..a99f9b412 100644
--- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx
+++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx
@@ -91,17 +91,17 @@ HttpdOutput::Unbind()
}
inline bool
-HttpdOutput::Configure(const config_param &param, Error &error)
+HttpdOutput::Configure(const ConfigBlock &block, Error &error)
{
/* read configuration */
- name = param.GetBlockValue("name", "Set name in config");
- genre = param.GetBlockValue("genre", "Set genre in config");
- website = param.GetBlockValue("website", "Set website in config");
+ name = block.GetBlockValue("name", "Set name in config");
+ genre = block.GetBlockValue("genre", "Set genre in config");
+ website = block.GetBlockValue("website", "Set website in config");
- unsigned port = param.GetBlockValue("port", 8000u);
+ unsigned port = block.GetBlockValue("port", 8000u);
const char *encoder_name =
- param.GetBlockValue("encoder", "vorbis");
+ block.GetBlockValue("encoder", "vorbis");
const auto encoder_plugin = encoder_plugin_get(encoder_name);
if (encoder_plugin == nullptr) {
error.Format(httpd_output_domain,
@@ -109,11 +109,11 @@ HttpdOutput::Configure(const config_param &param, Error &error)
return false;
}
- clients_max = param.GetBlockValue("max_clients", 0u);
+ clients_max = block.GetBlockValue("max_clients", 0u);
/* set up bind_to_address */
- const char *bind_to_address = param.GetBlockValue("bind_to_address");
+ const char *bind_to_address = block.GetBlockValue("bind_to_address");
bool success = bind_to_address != nullptr &&
strcmp(bind_to_address, "any") != 0
? AddHost(bind_to_address, port, error)
@@ -123,7 +123,7 @@ HttpdOutput::Configure(const config_param &param, Error &error)
/* initialize encoder */
- encoder = encoder_init(*encoder_plugin, param, error);
+ encoder = encoder_init(*encoder_plugin, block, error);
if (encoder == nullptr)
return false;
@@ -136,17 +136,17 @@ HttpdOutput::Configure(const config_param &param, Error &error)
}
inline bool
-HttpdOutput::Init(const config_param &param, Error &error)
+HttpdOutput::Init(const ConfigBlock &block, Error &error)
{
- return base.Configure(param, error);
+ return base.Configure(block, error);
}
static AudioOutput *
-httpd_output_init(const config_param &param, Error &error)
+httpd_output_init(const ConfigBlock &block, Error &error)
{
HttpdOutput *httpd = new HttpdOutput(io_thread_get());
- AudioOutput *result = httpd->InitAndConfigure(param, error);
+ AudioOutput *result = httpd->InitAndConfigure(block, error);
if (result == nullptr)
delete httpd;
diff --git a/src/output/plugins/sles/SlesOutputPlugin.cxx b/src/output/plugins/sles/SlesOutputPlugin.cxx
index 0c39714bb..94084e1b8 100644
--- a/src/output/plugins/sles/SlesOutputPlugin.cxx
+++ b/src/output/plugins/sles/SlesOutputPlugin.cxx
@@ -91,11 +91,11 @@ public:
return &base;
}
- bool Initialize(const config_param &param, Error &error) {
- return base.Configure(param, error);
+ bool Initialize(const ConfigBlock &block, Error &error) {
+ return base.Configure(block, error);
}
- bool Configure(const config_param &param, Error &error);
+ bool Configure(const ConfigBlock &block, Error &error);
bool Open(AudioFormat &audio_format, Error &error);
void Close();
@@ -129,7 +129,7 @@ private:
static constexpr Domain sles_domain("sles");
inline bool
-SlesOutput::Configure(const config_param &, Error &)
+SlesOutput::Configure(const ConfigBlock &, Error &)
{
return true;
}
@@ -445,12 +445,12 @@ sles_test_default_device()
}
static AudioOutput *
-sles_output_init(const config_param &param, Error &error)
+sles_output_init(const ConfigBlock &block, Error &error)
{
SlesOutput *sles = new SlesOutput();
- if (!sles->Initialize(param, error) ||
- !sles->Configure(param, error)) {
+ if (!sles->Initialize(block, error) ||
+ !sles->Configure(block, error)) {
delete sles;
return nullptr;
}