diff options
author | Max Kellermann <max@musicpd.org> | 2017-01-25 23:06:12 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-01-26 09:26:25 +0100 |
commit | 3854211694c5e2c71a2e3ff2a0f141814169d5dc (patch) | |
tree | 7dbaa15438de862ade6f2edab2ec982c42505e9e /src/input | |
parent | 58ac72f79d94ed3813450d5a8eb489aefa2ce64b (diff) |
input/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/Init.cxx | 4 | ||||
-rw-r--r-- | src/input/Init.hxx | 4 | ||||
-rw-r--r-- | src/input/InputPlugin.hxx | 3 | ||||
-rw-r--r-- | src/input/plugins/CdioParanoiaInputPlugin.cxx | 2 | ||||
-rw-r--r-- | src/input/plugins/CurlInputPlugin.cxx | 5 | ||||
-rw-r--r-- | src/input/plugins/FfmpegInputPlugin.cxx | 2 | ||||
-rw-r--r-- | src/input/plugins/NfsInputPlugin.cxx | 5 | ||||
-rw-r--r-- | src/input/plugins/SmbclientInputPlugin.cxx | 2 |
8 files changed, 14 insertions, 13 deletions
diff --git a/src/input/Init.cxx b/src/input/Init.cxx index d5e1556b1..7272339d0 100644 --- a/src/input/Init.cxx +++ b/src/input/Init.cxx @@ -33,7 +33,7 @@ #include <assert.h> void -input_stream_global_init() +input_stream_global_init(EventLoop &event_loop) { const ConfigBlock empty; @@ -55,7 +55,7 @@ input_stream_global_init() try { if (plugin->init != nullptr) - plugin->init(*block); + plugin->init(event_loop, *block); input_plugins_enabled[i] = true; } catch (const PluginUnavailable &e) { FormatError(e, diff --git a/src/input/Init.hxx b/src/input/Init.hxx index 1891f3c6b..982c4807f 100644 --- a/src/input/Init.hxx +++ b/src/input/Init.hxx @@ -20,11 +20,13 @@ #ifndef MPD_INPUT_INIT_HXX #define MPD_INPUT_INIT_HXX +class EventLoop; + /** * Initializes this library and all #InputStream implementations. */ void -input_stream_global_init(); +input_stream_global_init(EventLoop &event_loop); /** * Deinitializes this library and all #InputStream implementations. diff --git a/src/input/InputPlugin.hxx b/src/input/InputPlugin.hxx index e62ed6331..5918fa3df 100644 --- a/src/input/InputPlugin.hxx +++ b/src/input/InputPlugin.hxx @@ -31,6 +31,7 @@ struct ConfigBlock; class Mutex; class Cond; +class EventLoop; class InputStream; struct InputPlugin { @@ -44,7 +45,7 @@ struct InputPlugin { * * Throws std::runtime_error on (fatal) error. */ - void (*init)(const ConfigBlock &block); + void (*init)(EventLoop &event_loop, const ConfigBlock &block); /** * Global deinitialization. Called once before MPD shuts diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index e87749c4d..081f4151c 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -106,7 +106,7 @@ static constexpr Domain cdio_domain("cdio"); static bool default_reverse_endian; static void -input_cdio_init(const ConfigBlock &block) +input_cdio_init(EventLoop &, const ConfigBlock &block) { const char *value = block.GetBlockValue("default_byte_order"); if (value != nullptr) { diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index 6fcc75afd..8b0f5982c 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -32,7 +32,6 @@ #include "tag/TagBuilder.hxx" #include "event/Call.hxx" #include "event/Loop.hxx" -#include "IOThread.hxx" #include "thread/Cond.hxx" #include "util/ASCII.hxx" #include "util/StringUtil.hxx" @@ -285,7 +284,7 @@ CurlInputStream::OnError(std::exception_ptr e) */ static void -input_curl_init(const ConfigBlock &block) +input_curl_init(EventLoop &event_loop, const ConfigBlock &block) { CURLcode code = curl_global_init(CURL_GLOBAL_ALL); if (code != CURLE_OK) @@ -319,7 +318,7 @@ input_curl_init(const ConfigBlock &block) verify_host = block.GetBlockValue("verify_host", true); try { - curl_global = new CurlGlobal(io_thread_get()); + curl_global = new CurlGlobal(event_loop); } catch (const std::runtime_error &e) { LogError(e); curl_slist_free_all(http_200_aliases); diff --git a/src/input/plugins/FfmpegInputPlugin.cxx b/src/input/plugins/FfmpegInputPlugin.cxx index 0a7aa0cdc..861128e2a 100644 --- a/src/input/plugins/FfmpegInputPlugin.cxx +++ b/src/input/plugins/FfmpegInputPlugin.cxx @@ -72,7 +72,7 @@ input_ffmpeg_supported(void) } static void -input_ffmpeg_init(gcc_unused const ConfigBlock &block) +input_ffmpeg_init(EventLoop &, const ConfigBlock &) { FfmpegInit(); diff --git a/src/input/plugins/NfsInputPlugin.cxx b/src/input/plugins/NfsInputPlugin.cxx index c525a3143..c91a88f83 100644 --- a/src/input/plugins/NfsInputPlugin.cxx +++ b/src/input/plugins/NfsInputPlugin.cxx @@ -25,7 +25,6 @@ #include "lib/nfs/FileReader.hxx" #include "thread/Cond.hxx" #include "util/StringCompare.hxx" -#include "IOThread.hxx" #include <string.h> @@ -206,9 +205,9 @@ NfsInputStream::OnNfsFileError(std::exception_ptr &&e) */ static void -input_nfs_init(const ConfigBlock &) +input_nfs_init(EventLoop &event_loop, const ConfigBlock &) { - nfs_init(io_thread_get()); + nfs_init(event_loop); } static void diff --git a/src/input/plugins/SmbclientInputPlugin.cxx b/src/input/plugins/SmbclientInputPlugin.cxx index 326a25fbc..278b4f417 100644 --- a/src/input/plugins/SmbclientInputPlugin.cxx +++ b/src/input/plugins/SmbclientInputPlugin.cxx @@ -69,7 +69,7 @@ public: */ static void -input_smbclient_init(gcc_unused const ConfigBlock &block) +input_smbclient_init(EventLoop &, const ConfigBlock &) { try { SmbclientInit(); |