| 23 | static constexpr Domain input_domain("input"); |
| 24 | |
| 25 | void |
| 26 | input_stream_global_init(const ConfigData &config, EventLoop &event_loop) |
| 27 | { |
| 28 | #ifdef HAVE_URING |
| 29 | InitUringInputPlugin(event_loop); |
| 30 | #endif |
| 31 | |
| 32 | const ConfigBlock empty; |
| 33 | |
| 34 | for (unsigned i = 0; input_plugins[i] != nullptr; ++i) { |
| 35 | const InputPlugin *plugin = input_plugins[i]; |
| 36 | |
| 37 | assert(plugin->name != nullptr); |
| 38 | assert(*plugin->name != 0); |
| 39 | assert(plugin->open != nullptr); |
| 40 | |
| 41 | const auto *block = |
| 42 | config.FindBlock(ConfigBlockOption::INPUT, "plugin", |
| 43 | plugin->name); |
| 44 | if (block == nullptr) { |
| 45 | block = ∅ |
| 46 | } else if (!block->GetBlockValue("enabled", true)) |
| 47 | /* the plugin is disabled in mpd.conf */ |
| 48 | continue; |
| 49 | |
| 50 | block->SetUsed(); |
| 51 | |
| 52 | try { |
| 53 | if (plugin->init != nullptr) |
| 54 | plugin->init(event_loop, *block); |
| 55 | input_plugins_enabled[i] = true; |
| 56 | } catch (const PluginUnconfigured &e) { |
| 57 | FmtDebug(input_domain, |
| 58 | "Input plugin {:?} is not configured: {}", |
| 59 | plugin->name, e.what()); |
| 60 | continue; |
| 61 | } catch (const PluginUnavailable &e) { |
| 62 | FmtDebug(input_domain, |
| 63 | "Input plugin {:?} is unavailable: {}", |
| 64 | plugin->name, e.what()); |
| 65 | continue; |
| 66 | } catch (...) { |
| 67 | std::throw_with_nested(FmtRuntimeError("Failed to initialize input plugin {:?}", |
| 68 | plugin->name)); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | void |
| 74 | input_stream_global_finish() noexcept |
nothing calls this directly
no test coverage detected