diff options
Diffstat (limited to 'src/encoder')
-rw-r--r-- | src/encoder/EncoderAPI.hxx | 2 | ||||
-rw-r--r-- | src/encoder/EncoderPlugin.hxx | 8 | ||||
-rw-r--r-- | src/encoder/plugins/FlacEncoderPlugin.cxx | 10 | ||||
-rw-r--r-- | src/encoder/plugins/LameEncoderPlugin.cxx | 16 | ||||
-rw-r--r-- | src/encoder/plugins/NullEncoderPlugin.cxx | 2 | ||||
-rw-r--r-- | src/encoder/plugins/OpusEncoderPlugin.cxx | 14 | ||||
-rw-r--r-- | src/encoder/plugins/ShineEncoderPlugin.cxx | 13 | ||||
-rw-r--r-- | src/encoder/plugins/TwolameEncoderPlugin.cxx | 16 | ||||
-rw-r--r-- | src/encoder/plugins/VorbisEncoderPlugin.cxx | 14 | ||||
-rw-r--r-- | src/encoder/plugins/WaveEncoderPlugin.cxx | 2 |
10 files changed, 48 insertions, 49 deletions
diff --git a/src/encoder/EncoderAPI.hxx b/src/encoder/EncoderAPI.hxx index a266667fd..def543c58 100644 --- a/src/encoder/EncoderAPI.hxx +++ b/src/encoder/EncoderAPI.hxx @@ -31,7 +31,7 @@ #include "EncoderPlugin.hxx" #include "AudioFormat.hxx" #include "tag/Tag.hxx" -#include "config/Param.hxx" +#include "config/Block.hxx" // IWYU pragma: end_exports diff --git a/src/encoder/EncoderPlugin.hxx b/src/encoder/EncoderPlugin.hxx index 99a68dce6..f990bf105 100644 --- a/src/encoder/EncoderPlugin.hxx +++ b/src/encoder/EncoderPlugin.hxx @@ -24,14 +24,14 @@ struct Encoder; struct AudioFormat; -struct config_param; +struct ConfigBlock; struct Tag; class Error; struct EncoderPlugin { const char *name; - Encoder *(*init)(const config_param ¶m, + Encoder *(*init)(const ConfigBlock &block, Error &error); void (*finish)(Encoder *encoder); @@ -69,10 +69,10 @@ struct EncoderPlugin { * @return an encoder object on success, nullptr on failure */ static inline Encoder * -encoder_init(const EncoderPlugin &plugin, const config_param ¶m, +encoder_init(const EncoderPlugin &plugin, const ConfigBlock &block, Error &error_r) { - return plugin.init(param, error_r); + return plugin.init(block, error_r); } #endif diff --git a/src/encoder/plugins/FlacEncoderPlugin.cxx b/src/encoder/plugins/FlacEncoderPlugin.cxx index c2df7cbf6..afeef3b84 100644 --- a/src/encoder/plugins/FlacEncoderPlugin.cxx +++ b/src/encoder/plugins/FlacEncoderPlugin.cxx @@ -56,21 +56,21 @@ struct flac_encoder { static constexpr Domain flac_encoder_domain("vorbis_encoder"); static bool -flac_encoder_configure(struct flac_encoder *encoder, const config_param ¶m, +flac_encoder_configure(struct flac_encoder *encoder, const ConfigBlock &block, gcc_unused Error &error) { - encoder->compression = param.GetBlockValue("compression", 5u); + encoder->compression = block.GetBlockValue("compression", 5u); return true; } static Encoder * -flac_encoder_init(const config_param ¶m, Error &error) +flac_encoder_init(const ConfigBlock &block, Error &error) { flac_encoder *encoder = new flac_encoder(); - /* load configuration from "param" */ - if (!flac_encoder_configure(encoder, param, error)) { + /* load configuration from "block" */ + if (!flac_encoder_configure(encoder, block, error)) { /* configuration has failed, roll back and return error */ delete encoder; return nullptr; diff --git a/src/encoder/plugins/LameEncoderPlugin.cxx b/src/encoder/plugins/LameEncoderPlugin.cxx index ddcd14b9d..7c6313109 100644 --- a/src/encoder/plugins/LameEncoderPlugin.cxx +++ b/src/encoder/plugins/LameEncoderPlugin.cxx @@ -47,18 +47,18 @@ struct LameEncoder final { LameEncoder():encoder(lame_encoder_plugin) {} - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); }; static constexpr Domain lame_encoder_domain("lame_encoder"); bool -LameEncoder::Configure(const config_param ¶m, Error &error) +LameEncoder::Configure(const ConfigBlock &block, Error &error) { const char *value; char *endptr; - value = param.GetBlockValue("quality"); + value = block.GetBlockValue("quality"); if (value != nullptr) { /* a quality was configured (VBR) */ @@ -72,7 +72,7 @@ LameEncoder::Configure(const config_param ¶m, 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; @@ -80,7 +80,7 @@ LameEncoder::Configure(const config_param ¶m, Error &error) } else { /* a bit rate was configured */ - value = param.GetBlockValue("bitrate"); + value = block.GetBlockValue("bitrate"); if (value == nullptr) { error.Set(config_domain, "neither bitrate nor quality defined"); @@ -101,12 +101,12 @@ LameEncoder::Configure(const config_param ¶m, Error &error) } static Encoder * -lame_encoder_init(const config_param ¶m, Error &error) +lame_encoder_init(const ConfigBlock &block, Error &error) { LameEncoder *encoder = new LameEncoder(); - /* load configuration from "param" */ - if (!encoder->Configure(param, error)) { + /* load configuration from "block" */ + if (!encoder->Configure(block, error)) { /* configuration has failed, roll back and return error */ delete encoder; return nullptr; diff --git a/src/encoder/plugins/NullEncoderPlugin.cxx b/src/encoder/plugins/NullEncoderPlugin.cxx index eb2c4ef3f..99be7aec4 100644 --- a/src/encoder/plugins/NullEncoderPlugin.cxx +++ b/src/encoder/plugins/NullEncoderPlugin.cxx @@ -36,7 +36,7 @@ struct NullEncoder final { }; static Encoder * -null_encoder_init(gcc_unused const config_param ¶m, +null_encoder_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { NullEncoder *encoder = new NullEncoder(); diff --git a/src/encoder/plugins/OpusEncoderPlugin.cxx b/src/encoder/plugins/OpusEncoderPlugin.cxx index 6a691d48e..4fd40cd50 100644 --- a/src/encoder/plugins/OpusEncoderPlugin.cxx +++ b/src/encoder/plugins/OpusEncoderPlugin.cxx @@ -73,9 +73,9 @@ static constexpr Domain opus_encoder_domain("opus_encoder"); static bool opus_encoder_configure(struct opus_encoder *encoder, - const config_param ¶m, Error &error) + const ConfigBlock &block, Error &error) { - const char *value = param.GetBlockValue("bitrate", "auto"); + const char *value = block.GetBlockValue("bitrate", "auto"); if (strcmp(value, "auto") == 0) encoder->bitrate = OPUS_AUTO; else if (strcmp(value, "max") == 0) @@ -90,13 +90,13 @@ opus_encoder_configure(struct opus_encoder *encoder, } } - encoder->complexity = param.GetBlockValue("complexity", 10u); + encoder->complexity = block.GetBlockValue("complexity", 10u); if (encoder->complexity > 10) { error.Format(config_domain, "Invalid complexity"); return false; } - value = param.GetBlockValue("signal", "auto"); + value = block.GetBlockValue("signal", "auto"); if (strcmp(value, "auto") == 0) encoder->signal = OPUS_AUTO; else if (strcmp(value, "voice") == 0) @@ -112,12 +112,12 @@ opus_encoder_configure(struct opus_encoder *encoder, } static Encoder * -opus_encoder_init(const config_param ¶m, Error &error) +opus_encoder_init(const ConfigBlock &block, Error &error) { opus_encoder *encoder = new opus_encoder(); - /* load configuration from "param" */ - if (!opus_encoder_configure(encoder, param, error)) { + /* load configuration from "block" */ + if (!opus_encoder_configure(encoder, block, error)) { /* configuration has failed, roll back and return error */ delete encoder; return nullptr; diff --git a/src/encoder/plugins/ShineEncoderPlugin.cxx b/src/encoder/plugins/ShineEncoderPlugin.cxx index 72dc305e6..c397906d3 100644 --- a/src/encoder/plugins/ShineEncoderPlugin.cxx +++ b/src/encoder/plugins/ShineEncoderPlugin.cxx @@ -53,7 +53,7 @@ struct ShineEncoder { ShineEncoder():encoder(shine_encoder_plugin){} - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); bool Setup(Error &error); @@ -63,22 +63,21 @@ struct ShineEncoder { static constexpr Domain shine_encoder_domain("shine_encoder"); inline bool -ShineEncoder::Configure(const config_param ¶m, - gcc_unused Error &error) +ShineEncoder::Configure(const ConfigBlock &block, gcc_unused Error &error) { shine_set_config_mpeg_defaults(&config.mpeg); - config.mpeg.bitr = param.GetBlockValue("bitrate", 128); + config.mpeg.bitr = block.GetBlockValue("bitrate", 128); return true; } static Encoder * -shine_encoder_init(const config_param ¶m, Error &error) +shine_encoder_init(const ConfigBlock &block, Error &error) { ShineEncoder *encoder = new ShineEncoder(); - /* load configuration from "param" */ - if (!encoder->Configure(param, error)) { + /* load configuration from "block" */ + if (!encoder->Configure(block, error)) { /* configuration has failed, roll back and return error */ delete encoder; return nullptr; diff --git a/src/encoder/plugins/TwolameEncoderPlugin.cxx b/src/encoder/plugins/TwolameEncoderPlugin.cxx index 51a06a4a4..262fc6c33 100644 --- a/src/encoder/plugins/TwolameEncoderPlugin.cxx +++ b/src/encoder/plugins/TwolameEncoderPlugin.cxx @@ -53,18 +53,18 @@ struct TwolameEncoder final { TwolameEncoder():encoder(twolame_encoder_plugin) {} - bool Configure(const config_param ¶m, Error &error); + bool Configure(const ConfigBlock &block, Error &error); }; static constexpr Domain twolame_encoder_domain("twolame_encoder"); bool -TwolameEncoder::Configure(const config_param ¶m, Error &error) +TwolameEncoder::Configure(const ConfigBlock &block, Error &error) { const char *value; char *endptr; - value = param.GetBlockValue("quality"); + value = block.GetBlockValue("quality"); if (value != nullptr) { /* a quality was configured (VBR) */ @@ -78,7 +78,7 @@ TwolameEncoder::Configure(const config_param ¶m, 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; @@ -86,7 +86,7 @@ TwolameEncoder::Configure(const config_param ¶m, Error &error) } else { /* a bit rate was configured */ - value = param.GetBlockValue("bitrate"); + value = block.GetBlockValue("bitrate"); if (value == nullptr) { error.Set(config_domain, "neither bitrate nor quality defined"); @@ -107,15 +107,15 @@ TwolameEncoder::Configure(const config_param ¶m, Error &error) } static Encoder * -twolame_encoder_init(const config_param ¶m, Error &error_r) +twolame_encoder_init(const ConfigBlock &block, Error &error_r) { FormatDebug(twolame_encoder_domain, "libtwolame version %s", get_twolame_version()); TwolameEncoder *encoder = new TwolameEncoder(); - /* load configuration from "param" */ - if (!encoder->Configure(param, error_r)) { + /* load configuration from "block" */ + if (!encoder->Configure(block, error_r)) { /* configuration has failed, roll back and return error */ delete encoder; return nullptr; diff --git a/src/encoder/plugins/VorbisEncoderPlugin.cxx b/src/encoder/plugins/VorbisEncoderPlugin.cxx index d84f33b84..11e057eaa 100644 --- a/src/encoder/plugins/VorbisEncoderPlugin.cxx +++ b/src/encoder/plugins/VorbisEncoderPlugin.cxx @@ -58,9 +58,9 @@ static constexpr Domain vorbis_encoder_domain("vorbis_encoder"); static bool vorbis_encoder_configure(struct vorbis_encoder &encoder, - const config_param ¶m, Error &error) + const ConfigBlock &block, Error &error) { - const char *value = param.GetBlockValue("quality"); + const char *value = block.GetBlockValue("quality"); if (value != nullptr) { /* a quality was configured (VBR) */ @@ -76,7 +76,7 @@ vorbis_encoder_configure(struct vorbis_encoder &encoder, return false; } - if (param.GetBlockValue("bitrate") != nullptr) { + if (block.GetBlockValue("bitrate") != nullptr) { error.Set(config_domain, "quality and bitrate are both defined"); return false; @@ -84,7 +84,7 @@ vorbis_encoder_configure(struct vorbis_encoder &encoder, } else { /* a bit rate was configured */ - value = param.GetBlockValue("bitrate"); + value = block.GetBlockValue("bitrate"); if (value == nullptr) { error.Set(config_domain, "neither bitrate nor quality defined"); @@ -106,12 +106,12 @@ vorbis_encoder_configure(struct vorbis_encoder &encoder, } static Encoder * -vorbis_encoder_init(const config_param ¶m, Error &error) +vorbis_encoder_init(const ConfigBlock &block, Error &error) { vorbis_encoder *encoder = new vorbis_encoder(); - /* load configuration from "param" */ - if (!vorbis_encoder_configure(*encoder, param, error)) { + /* load configuration from "block" */ + if (!vorbis_encoder_configure(*encoder, block, error)) { /* configuration has failed, roll back and return error */ delete encoder; return nullptr; diff --git a/src/encoder/plugins/WaveEncoderPlugin.cxx b/src/encoder/plugins/WaveEncoderPlugin.cxx index 92a6330f1..3493bed3a 100644 --- a/src/encoder/plugins/WaveEncoderPlugin.cxx +++ b/src/encoder/plugins/WaveEncoderPlugin.cxx @@ -79,7 +79,7 @@ fill_wave_header(struct wave_header *header, int channels, int bits, } static Encoder * -wave_encoder_init(gcc_unused const config_param ¶m, +wave_encoder_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { WaveEncoder *encoder = new WaveEncoder(); |