summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-02-05 22:11:45 +0100
committerMax Kellermann <max@musicpd.org>2019-02-05 22:12:22 +0100
commit7a23c123c8b3b24ea61157e10b2ffd3ae44c5acf (patch)
tree1615288af12ddbe04edfed0b43f617b8e6edd2b7 /test
parente85b24bee0004f6e18c986fa718b2854fee57730 (diff)
decoder/List: add RAII class
Diffstat (limited to 'test')
-rw-r--r--test/ContainerScan.cxx4
-rw-r--r--test/RunChromaprint.cxx10
-rw-r--r--test/dump_playlist.cxx3
-rw-r--r--test/read_tags.cxx3
-rw-r--r--test/run_decoder.cxx10
5 files changed, 9 insertions, 21 deletions
diff --git a/test/ContainerScan.cxx b/test/ContainerScan.cxx
index d047ae0b7..6512ba9cb 100644
--- a/test/ContainerScan.cxx
+++ b/test/ContainerScan.cxx
@@ -65,7 +65,7 @@ try {
const Path path = Path::FromFS(argv[1]);
- decoder_plugin_init_all(ConfigData());
+ const ScopeDecoderPluginsInit decoder_plugins_init({});
const auto *plugin = FindContainerDecoderPlugin(path);
if (plugin == nullptr) {
@@ -87,8 +87,6 @@ try {
bos.Flush();
- decoder_plugin_deinit_all();
-
return EXIT_SUCCESS;
} catch (...) {
PrintException(std::current_exception());
diff --git a/test/RunChromaprint.cxx b/test/RunChromaprint.cxx
index 3da471f77..dfbca8586 100644
--- a/test/RunChromaprint.cxx
+++ b/test/RunChromaprint.cxx
@@ -91,22 +91,18 @@ class GlobalInit {
const ConfigData config;
EventThread io_thread;
const ScopeInputPluginsInit input_plugins_init;
+ const ScopeDecoderPluginsInit decoder_plugins_init;
public:
explicit GlobalInit(Path config_path)
:config(AutoLoadConfigFile(config_path)),
- input_plugins_init(config, io_thread.GetEventLoop())
+ input_plugins_init(config, io_thread.GetEventLoop()),
+ decoder_plugins_init(config)
{
io_thread.Start();
- decoder_plugin_init_all(config);
-
pcm_convert_global_init(config);
}
-
- ~GlobalInit() {
- decoder_plugin_deinit_all();
- }
};
class ChromaprintDecoderClient final : public DecoderClient {
diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx
index 699b2e930..111fbc47f 100644
--- a/test/dump_playlist.cxx
+++ b/test/dump_playlist.cxx
@@ -66,7 +66,7 @@ try {
const ScopeInputPluginsInit input_plugins_init(config, io_thread.GetEventLoop());
playlist_list_global_init(config);
- decoder_plugin_init_all(config);
+ const ScopeDecoderPluginsInit decoder_plugins_init(config);
/* open the playlist */
@@ -116,7 +116,6 @@ try {
playlist.reset();
is.reset();
- decoder_plugin_deinit_all();
playlist_list_global_finish();
return EXIT_SUCCESS;
diff --git a/test/read_tags.cxx b/test/read_tags.cxx
index 3b3a791aa..a8ab2a061 100644
--- a/test/read_tags.cxx
+++ b/test/read_tags.cxx
@@ -96,8 +96,7 @@ try {
const ScopeInputPluginsInit input_plugins_init(ConfigData(),
io_thread.GetEventLoop());
- decoder_plugin_init_all(ConfigData());
- AtScopeExit() { decoder_plugin_deinit_all(); };
+ const ScopeDecoderPluginsInit decoder_plugins_init({});
plugin = decoder_plugin_from_name(decoder_name);
if (plugin == NULL) {
diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx
index be7091498..c94b5ee07 100644
--- a/test/run_decoder.cxx
+++ b/test/run_decoder.cxx
@@ -89,19 +89,15 @@ class GlobalInit {
const ConfigData config;
EventThread io_thread;
const ScopeInputPluginsInit input_plugins_init;
+ const ScopeDecoderPluginsInit decoder_plugins_init;
public:
explicit GlobalInit(Path config_path)
:config(AutoLoadConfigFile(config_path)),
- input_plugins_init(config, io_thread.GetEventLoop())
+ input_plugins_init(config, io_thread.GetEventLoop()),
+ decoder_plugins_init(config)
{
io_thread.Start();
-
- decoder_plugin_init_all(config);
- }
-
- ~GlobalInit() {
- decoder_plugin_deinit_all();
}
};