diff options
author | Max Kellermann <max@musicpd.org> | 2017-02-10 22:07:13 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-02-10 22:24:44 +0100 |
commit | 87c9856b20662998f8a8a42676bfc2118f6e44d2 (patch) | |
tree | a28ecc2b7dbb53ff9a81935f31d892104bd7eff8 /src/input | |
parent | 835136dcd36b8ae6b732e945a929f8b39f3476bc (diff) |
input/alsa: use the EventLoop& passed to init() instead of io_thread_get()
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/plugins/AlsaInputPlugin.cxx | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx index 50235080e..2c6b8d09d 100644 --- a/src/input/plugins/AlsaInputPlugin.cxx +++ b/src/input/plugins/AlsaInputPlugin.cxx @@ -39,7 +39,6 @@ #include "Log.hxx" #include "event/MultiSocketMonitor.hxx" #include "event/DeferredMonitor.hxx" -#include "IOThread.hxx" #include <alsa/asoundlib.h> @@ -107,7 +106,8 @@ public: snd_pcm_close(capture_handle); } - static InputStream *Create(const char *uri, Mutex &mutex, Cond &cond); + static InputStream *Create(EventLoop &event_loop, const char *uri, + Mutex &mutex, Cond &cond); protected: /* virtual methods from AsyncInputStream */ @@ -146,7 +146,8 @@ private: }; inline InputStream * -AlsaInputStream::Create(const char *uri, Mutex &mutex, Cond &cond) +AlsaInputStream::Create(EventLoop &event_loop, const char *uri, + Mutex &mutex, Cond &cond) { const char *device = StringAfterPrefix(uri, "alsa://"); if (device == nullptr) @@ -165,7 +166,7 @@ AlsaInputStream::Create(const char *uri, Mutex &mutex, Cond &cond) snd_pcm_t *handle = OpenDevice(device, rate, format, channels); int frame_size = snd_pcm_format_width(format) / 8 * channels; - return new AlsaInputStream(io_thread_get(), + return new AlsaInputStream(event_loop, uri, mutex, cond, device, handle, frame_size); } @@ -386,15 +387,24 @@ AlsaInputStream::OpenDevice(const char *device, /*######################### Plugin Functions ##############################*/ +static EventLoop *alsa_input_event_loop; + +static void +alsa_input_init(EventLoop &event_loop, const ConfigBlock &) +{ + alsa_input_event_loop = &event_loop; +} + static InputStream * alsa_input_open(const char *uri, Mutex &mutex, Cond &cond) { - return AlsaInputStream::Create(uri, mutex, cond); + return AlsaInputStream::Create(*alsa_input_event_loop, uri, + mutex, cond); } const struct InputPlugin input_plugin_alsa = { "alsa", - nullptr, + alsa_input_init, nullptr, alsa_input_open, }; |