MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / input_stream_global_init

Function input_stream_global_init

src/input/Init.cxx:25–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23static constexpr Domain input_domain("input");
24
25void
26input_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
73void
74input_stream_global_finish() noexcept

Callers

nothing calls this directly

Calls 3

InitUringInputPluginFunction · 0.85
FindBlockMethod · 0.80
GetBlockValueMethod · 0.80

Tested by

no test coverage detected