summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-02-05 21:50:31 +0100
committerMax Kellermann <max@musicpd.org>2019-02-05 22:07:49 +0100
commit9e73ea77b4ccd4131823ddc156322a2e4082d417 (patch)
tree50a5ed0b8b1eafd0e130ff757e700b9bda780504 /test
parentb0739eca87439a8f9cc2a0f9a6fcba1f68708df6 (diff)
input/Init: add RAII class
Diffstat (limited to 'test')
-rw-r--r--test/RunChromaprint.cxx7
-rw-r--r--test/dump_playlist.cxx3
-rw-r--r--test/dump_text_file.cxx12
-rw-r--r--test/read_tags.cxx4
-rw-r--r--test/run_decoder.cxx7
-rw-r--r--test/run_input.cxx12
-rw-r--r--test/visit_archive.cxx12
7 files changed, 23 insertions, 34 deletions
diff --git a/test/RunChromaprint.cxx b/test/RunChromaprint.cxx
index dcbd75d2e..3da471f77 100644
--- a/test/RunChromaprint.cxx
+++ b/test/RunChromaprint.cxx
@@ -90,15 +90,15 @@ ParseCommandLine(int argc, char **argv)
class GlobalInit {
const ConfigData config;
EventThread io_thread;
+ const ScopeInputPluginsInit input_plugins_init;
public:
explicit GlobalInit(Path config_path)
- :config(AutoLoadConfigFile(config_path))
+ :config(AutoLoadConfigFile(config_path)),
+ input_plugins_init(config, io_thread.GetEventLoop())
{
io_thread.Start();
- input_stream_global_init(config,
- io_thread.GetEventLoop());
decoder_plugin_init_all(config);
pcm_convert_global_init(config);
@@ -106,7 +106,6 @@ public:
~GlobalInit() {
decoder_plugin_deinit_all();
- input_stream_global_finish();
}
};
diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx
index 0b2519161..699b2e930 100644
--- a/test/dump_playlist.cxx
+++ b/test/dump_playlist.cxx
@@ -64,7 +64,7 @@ try {
EventThread io_thread;
io_thread.Start();
- input_stream_global_init(config, io_thread.GetEventLoop());
+ const ScopeInputPluginsInit input_plugins_init(config, io_thread.GetEventLoop());
playlist_list_global_init(config);
decoder_plugin_init_all(config);
@@ -118,7 +118,6 @@ try {
decoder_plugin_deinit_all();
playlist_list_global_finish();
- input_stream_global_finish();
return EXIT_SUCCESS;
} catch (...) {
diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx
index 18cdc7061..ab3ccf12a 100644
--- a/test/dump_text_file.cxx
+++ b/test/dump_text_file.cxx
@@ -42,15 +42,13 @@ class GlobalInit {
const ScopeArchivePluginsInit archive_plugins_init;
#endif
+ const ScopeInputPluginsInit input_plugins_init;
+
public:
- GlobalInit() {
+ GlobalInit()
+ :input_plugins_init(ConfigData(), io_thread.GetEventLoop())
+ {
io_thread.Start();
- input_stream_global_init(ConfigData(),
- io_thread.GetEventLoop());
- }
-
- ~GlobalInit() {
- input_stream_global_finish();
}
};
diff --git a/test/read_tags.cxx b/test/read_tags.cxx
index 2ea744c95..3b3a791aa 100644
--- a/test/read_tags.cxx
+++ b/test/read_tags.cxx
@@ -93,8 +93,8 @@ try {
EventThread io_thread;
io_thread.Start();
- input_stream_global_init(ConfigData(), io_thread.GetEventLoop());
- AtScopeExit() { input_stream_global_finish(); };
+ const ScopeInputPluginsInit input_plugins_init(ConfigData(),
+ io_thread.GetEventLoop());
decoder_plugin_init_all(ConfigData());
AtScopeExit() { decoder_plugin_deinit_all(); };
diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx
index c32f56c0e..be7091498 100644
--- a/test/run_decoder.cxx
+++ b/test/run_decoder.cxx
@@ -88,21 +88,20 @@ ParseCommandLine(int argc, char **argv)
class GlobalInit {
const ConfigData config;
EventThread io_thread;
+ const ScopeInputPluginsInit input_plugins_init;
public:
explicit GlobalInit(Path config_path)
- :config(AutoLoadConfigFile(config_path))
+ :config(AutoLoadConfigFile(config_path)),
+ input_plugins_init(config, io_thread.GetEventLoop())
{
io_thread.Start();
- input_stream_global_init(config,
- io_thread.GetEventLoop());
decoder_plugin_init_all(config);
}
~GlobalInit() {
decoder_plugin_deinit_all();
- input_stream_global_finish();
}
};
diff --git a/test/run_input.cxx b/test/run_input.cxx
index f81a8bc77..e5deafda8 100644
--- a/test/run_input.cxx
+++ b/test/run_input.cxx
@@ -108,18 +108,14 @@ class GlobalInit {
const ScopeArchivePluginsInit archive_plugins_init;
#endif
+ const ScopeInputPluginsInit input_plugins_init;
+
public:
explicit GlobalInit(Path config_path)
- :config(AutoLoadConfigFile(config_path))
+ :config(AutoLoadConfigFile(config_path)),
+ input_plugins_init(config, io_thread.GetEventLoop())
{
io_thread.Start();
-
- input_stream_global_init(config,
- io_thread.GetEventLoop());
- }
-
- ~GlobalInit() {
- input_stream_global_finish();
}
};
diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx
index 2507b0846..f14d408a4 100644
--- a/test/visit_archive.cxx
+++ b/test/visit_archive.cxx
@@ -42,15 +42,13 @@ class GlobalInit {
const ScopeArchivePluginsInit archive_plugins_init;
#endif
+ const ScopeInputPluginsInit input_plugins_init;
+
public:
- GlobalInit() {
+ GlobalInit()
+ :input_plugins_init(ConfigData(), io_thread.GetEventLoop())
+ {
io_thread.Start();
- input_stream_global_init(ConfigData(),
- io_thread.GetEventLoop());
- }
-
- ~GlobalInit() {
- input_stream_global_finish();
}
};