diff options
author | Max Kellermann <max@duempel.org> | 2015-01-21 22:13:44 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-01-21 23:56:33 +0100 |
commit | 4fa5538e2bed36903b403e1aaee2462d22b456dc (patch) | |
tree | 292b66e10e6b97e2363fde34a81c027a67d3a9fe /src/output/plugins/httpd | |
parent | 84e74173de85a3897cfe67150297987f8c8bf52e (diff) | |
download | mpd-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 'src/output/plugins/httpd')
-rw-r--r-- | src/output/plugins/httpd/HttpdInternal.hxx | 12 | ||||
-rw-r--r-- | src/output/plugins/httpd/HttpdOutputPlugin.cxx | 26 |
2 files changed, 19 insertions, 19 deletions
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 ¶m, Error &error); + bool Init(const ConfigBlock &block, Error &error); - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); - AudioOutput *InitAndConfigure(const config_param ¶m, + 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 ¶m, 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 ¶m, 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 ¶m, 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 ¶m, Error &error) } inline bool -HttpdOutput::Init(const config_param ¶m, 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 ¶m, 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; |