Commit 57d77cc8 authored by Max Kellermann's avatar Max Kellermann

decoder/List: use struct ConfigData

parent 9fe05850
......@@ -552,7 +552,7 @@ try {
pcm_convert_global_init();
decoder_plugin_init_all();
decoder_plugin_init_all(GetGlobalConfig());
#ifdef ENABLE_DATABASE
const bool create_db = InitDatabaseAndStorage();
......
......@@ -20,7 +20,7 @@
#include "config.h"
#include "DecoderList.hxx"
#include "DecoderPlugin.hxx"
#include "config/Global.hxx"
#include "config/Data.hxx"
#include "config/Block.hxx"
#include "plugins/AudiofileDecoderPlugin.hxx"
#include "plugins/PcmDecoderPlugin.hxx"
......@@ -127,14 +127,15 @@ decoder_plugin_from_name(const char *name) noexcept
});
}
void decoder_plugin_init_all(void)
void
decoder_plugin_init_all(const ConfigData &config)
{
ConfigBlock empty;
for (unsigned i = 0; decoder_plugins[i] != nullptr; ++i) {
const DecoderPlugin &plugin = *decoder_plugins[i];
const auto *param =
config_find_block(ConfigBlockOption::DECODER, "plugin",
config.FindBlock(ConfigBlockOption::DECODER, "plugin",
plugin.name);
if (param == nullptr)
......
......@@ -22,6 +22,7 @@
#include "Compiler.h"
struct ConfigData;
struct DecoderPlugin;
extern const struct DecoderPlugin *const decoder_plugins[];
......@@ -35,7 +36,7 @@ decoder_plugin_from_name(const char *name) noexcept;
/* this is where we "load" all the "plugins" ;-) */
void
decoder_plugin_init_all();
decoder_plugin_init_all(const ConfigData &config);
/* this is where we "unload" all the "plugins" */
void
......
......@@ -20,6 +20,7 @@
#include "config.h"
#include "DetachedSong.hxx"
#include "SongSave.hxx"
#include "config/Data.hxx"
#include "decoder/DecoderList.hxx"
#include "decoder/DecoderPlugin.hxx"
#include "fs/Path.hxx"
......@@ -68,7 +69,7 @@ try {
const Path path = Path::FromFS(argv[1]);
decoder_plugin_init_all();
decoder_plugin_init_all(ConfigData());
const auto *plugin = FindContainerDecoderPlugin(path);
if (plugin == nullptr) {
......
......@@ -69,7 +69,7 @@ try {
input_stream_global_init(io_thread.GetEventLoop());
playlist_list_global_init();
decoder_plugin_init_all();
decoder_plugin_init_all(GetGlobalConfig());
/* open the playlist */
......
......@@ -18,6 +18,7 @@
*/
#include "config.h"
#include "config/Data.hxx"
#include "event/Thread.hxx"
#include "decoder/DecoderList.hxx"
#include "decoder/DecoderPlugin.hxx"
......@@ -95,7 +96,7 @@ try {
input_stream_global_init(io_thread.GetEventLoop());
AtScopeExit() { input_stream_global_finish(); };
decoder_plugin_init_all();
decoder_plugin_init_all(ConfigData());
AtScopeExit() { decoder_plugin_deinit_all(); };
plugin = decoder_plugin_from_name(decoder_name);
......
......@@ -99,7 +99,7 @@ public:
ReadConfigFile(config_path);
input_stream_global_init(io_thread.GetEventLoop());
decoder_plugin_init_all();
decoder_plugin_init_all(GetGlobalConfig());
}
~GlobalInit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment