diff options
author | Chris Robinson <[email protected]> | 2019-04-14 02:16:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-04-14 04:05:07 -0700 |
commit | 61f7e7716c6743b16051d8c3ea4cea3b27d0197b (patch) | |
tree | 61b486a606cb2e3bac66b274fed8c75dbfad1d0a /Alc/backends/alsa.cpp | |
parent | 7f526780994f44793fe56a426c01fcebfb64a75a (diff) |
Remove the backend factory deinit method
It was never actually called anywhere, and there's no safe place where it can
be called. It's probably better to let the individual backends worry about
cleaning themselves up anyway.
Diffstat (limited to 'Alc/backends/alsa.cpp')
-rw-r--r-- | Alc/backends/alsa.cpp | 80 |
1 files changed, 32 insertions, 48 deletions
diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp index 1a287565..9f036a01 100644 --- a/Alc/backends/alsa.cpp +++ b/Alc/backends/alsa.cpp @@ -204,46 +204,6 @@ ALSA_FUNCS(MAKE_FUNC); #endif -bool alsa_load() -{ - bool error{false}; - -#ifdef HAVE_DYNLOAD - if(!alsa_handle) - { - std::string missing_funcs; - - alsa_handle = LoadLib("libasound.so.2"); - if(!alsa_handle) - { - WARN("Failed to load %s\n", "libasound.so.2"); - return ALC_FALSE; - } - - error = ALC_FALSE; -#define LOAD_FUNC(f) do { \ - p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(alsa_handle, #f)); \ - if(p##f == nullptr) { \ - error = true; \ - missing_funcs += "\n" #f; \ - } \ -} while(0) - ALSA_FUNCS(LOAD_FUNC); -#undef LOAD_FUNC - - if(error) - { - WARN("Missing expected functions:%s\n", missing_funcs.c_str()); - CloseLib(alsa_handle); - alsa_handle = nullptr; - } - } -#endif - - return !error; -} - - struct DevMap { std::string name; std::string device_name; @@ -1249,18 +1209,42 @@ ClockLatency AlsaCapture::getClockLatency() bool AlsaBackendFactory::init() -{ return !!alsa_load(); } - -void AlsaBackendFactory::deinit() { - PlaybackDevices.clear(); - CaptureDevices.clear(); + bool error{false}; #ifdef HAVE_DYNLOAD - if(alsa_handle) - CloseLib(alsa_handle); - alsa_handle = nullptr; + if(!alsa_handle) + { + std::string missing_funcs; + + alsa_handle = LoadLib("libasound.so.2"); + if(!alsa_handle) + { + WARN("Failed to load %s\n", "libasound.so.2"); + return ALC_FALSE; + } + + error = ALC_FALSE; +#define LOAD_FUNC(f) do { \ + p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(alsa_handle, #f)); \ + if(p##f == nullptr) { \ + error = true; \ + missing_funcs += "\n" #f; \ + } \ +} while(0) + ALSA_FUNCS(LOAD_FUNC); +#undef LOAD_FUNC + + if(error) + { + WARN("Missing expected functions:%s\n", missing_funcs.c_str()); + CloseLib(alsa_handle); + alsa_handle = nullptr; + } + } #endif + + return !error; } bool AlsaBackendFactory::querySupport(BackendType type) |