| 74 | } |
| 75 | |
| 76 | static std::unique_ptr<AudioOutput> |
| 77 | LoadAudioOutput(const ConfigData &config, EventLoop &event_loop, |
| 78 | const char *name) |
| 79 | { |
| 80 | const auto *block = config.FindBlock(ConfigBlockOption::AUDIO_OUTPUT, |
| 81 | "name", name); |
| 82 | if (block == nullptr) |
| 83 | throw FmtRuntimeError("No such configured audio output: {}", |
| 84 | name); |
| 85 | |
| 86 | const char *plugin_name = block->GetBlockValue("type"); |
| 87 | if (plugin_name == nullptr) |
| 88 | throw std::runtime_error("Missing \"type\" configuration"); |
| 89 | |
| 90 | const auto *plugin = GetAudioOutputPluginByName(plugin_name); |
| 91 | if (plugin == nullptr) |
| 92 | throw FmtRuntimeError("No such audio output plugin: {}", |
| 93 | plugin_name); |
| 94 | |
| 95 | return std::unique_ptr<AudioOutput>(ao_plugin_init(event_loop, *plugin, |
| 96 | *block)); |
| 97 | } |
| 98 | |
| 99 | static void |
| 100 | RunOutput(AudioOutput &ao, AudioFormat audio_format, |
no test coverage detected