diff options
author | Max Kellermann <max@musicpd.org> | 2017-11-10 21:37:56 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-11-10 21:54:57 +0100 |
commit | 6464b4b3720d91d07c99bf8411a95ec7e3c35eb2 (patch) | |
tree | 7ac43e8ed563add4a42375f24fe8ce3d919ac32d /src/output/plugins/ShoutOutputPlugin.cxx | |
parent | fef9747fbf351bcd43259b0dc2f4fde4c93dcf6c (diff) |
encoder/Configured: glue code to initialize PreparedEncoder
Diffstat (limited to 'src/output/plugins/ShoutOutputPlugin.cxx')
-rw-r--r-- | src/output/plugins/ShoutOutputPlugin.cxx | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/output/plugins/ShoutOutputPlugin.cxx b/src/output/plugins/ShoutOutputPlugin.cxx index b30dae91d..6485e4140 100644 --- a/src/output/plugins/ShoutOutputPlugin.cxx +++ b/src/output/plugins/ShoutOutputPlugin.cxx @@ -21,8 +21,7 @@ #include "ShoutOutputPlugin.hxx" #include "../OutputAPI.hxx" #include "encoder/EncoderInterface.hxx" -#include "encoder/EncoderPlugin.hxx" -#include "encoder/EncoderList.hxx" +#include "encoder/Configured.hxx" #include "util/RuntimeError.hxx" #include "util/Domain.hxx" #include "util/StringAPI.hxx" @@ -88,17 +87,6 @@ require_block_string(const ConfigBlock &block, const char *name) return value; } -static const EncoderPlugin * -shout_encoder_plugin_get(const char *name) -{ - if (strcmp(name, "ogg") == 0) - name = "vorbis"; - else if (strcmp(name, "mp3") == 0) - name = "lame"; - - return encoder_plugin_get(name); -} - static void ShoutSetAudioInfo(shout_t *shout_conn, const AudioFormat &audio_format) { @@ -114,7 +102,8 @@ ShoutSetAudioInfo(shout_t *shout_conn, const AudioFormat &audio_format) ShoutOutput::ShoutOutput(const ConfigBlock &block) :AudioOutput(FLAG_PAUSE), shout_conn(shout_new()), - shout_meta(shout_metadata_new()) + shout_meta(shout_metadata_new()), + prepared_encoder(CreateConfiguredEncoder(block, true)) { NeedFullyDefinedAudioFormat(); @@ -156,16 +145,6 @@ ShoutOutput::ShoutOutput(const ConfigBlock &block) throw std::runtime_error("bitrate must be a positive integer"); } - const char *encoding = block.GetBlockValue("encoder", nullptr); - if (encoding == nullptr) - encoding = block.GetBlockValue("encoding", "vorbis"); - const auto encoder_plugin = shout_encoder_plugin_get(encoding); - if (encoder_plugin == nullptr) - throw FormatRuntimeError("couldn't find shout encoder plugin \"%s\"", - encoding); - - prepared_encoder.reset(encoder_init(*encoder_plugin, block)); - const char *const mime_type = prepared_encoder->GetMimeType(); unsigned shout_format; |