summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-08-08 18:27:07 +0200
committerMax Kellermann <max@musicpd.org>2017-08-08 18:57:59 +0200
commite11229494ed03e48af20ef9bdffcd0e8798a689a (patch)
tree0f6beeb5e81c096ebd6f5ef4d1668f361530fb2e /src
parentccc0fcb5b79349456b702663cc674069c826b6ce (diff)
output/Filtered: add method NeedFullyDefinedAudioFormat()
Avoid accessing FilteredAudioFormat attributes directly.
Diffstat (limited to 'src')
-rw-r--r--src/output/Filtered.hxx7
-rw-r--r--src/output/Init.cxx7
-rw-r--r--src/output/plugins/ShoutOutputPlugin.cxx4
3 files changed, 15 insertions, 3 deletions
diff --git a/src/output/Filtered.hxx b/src/output/Filtered.hxx
index 901bcd68a..ed1f6ccb7 100644
--- a/src/output/Filtered.hxx
+++ b/src/output/Filtered.hxx
@@ -125,6 +125,13 @@ public:
~FilteredAudioOutput();
+ /**
+ * Plugins shall call this method if they require an
+ * "audio_format" setting which evaluates
+ * AudioFormat::IsFullyDefined().
+ */
+ void NeedFullyDefinedAudioFormat();
+
private:
void Configure(const ConfigBlock &block);
diff --git a/src/output/Init.cxx b/src/output/Init.cxx
index b33d3914c..3d042ae9c 100644
--- a/src/output/Init.cxx
+++ b/src/output/Init.cxx
@@ -62,6 +62,13 @@ FilteredAudioOutput::FilteredAudioOutput(const AudioOutputPlugin &_plugin,
Configure(block);
}
+void
+FilteredAudioOutput::NeedFullyDefinedAudioFormat()
+{
+ if (!config_audio_format.IsFullyDefined())
+ throw std::runtime_error("Need full audio format specification");
+}
+
static const AudioOutputPlugin *
audio_output_detect()
{
diff --git a/src/output/plugins/ShoutOutputPlugin.cxx b/src/output/plugins/ShoutOutputPlugin.cxx
index 4b99662e4..de8722982 100644
--- a/src/output/plugins/ShoutOutputPlugin.cxx
+++ b/src/output/plugins/ShoutOutputPlugin.cxx
@@ -117,9 +117,7 @@ ShoutOutput::ShoutOutput(const ConfigBlock &block)
shout_conn(shout_new()),
shout_meta(shout_metadata_new())
{
- const AudioFormat audio_format = base.config_audio_format;
- if (!audio_format.IsFullyDefined())
- throw std::runtime_error("Need full audio format specification");
+ base.NeedFullyDefinedAudioFormat();
const char *host = require_block_string(block, "host");
const char *mount = require_block_string(block, "mount");