diff options
author | Max Kellermann <max@duempel.org> | 2014-10-23 23:24:01 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-06-22 13:02:13 +0200 |
commit | bef8c83388b71430100349faa20081bd77f155c6 (patch) | |
tree | eeffd38e71384f4ed291172d97e96450a9afee84 | |
parent | 2e983244865ab1c004022034e74f61b8d8620543 (diff) | |
download | mpd-bef8c83388b71430100349faa20081bd77f155c6.tar.gz mpd-bef8c83388b71430100349faa20081bd77f155c6.tar.xz mpd-bef8c83388b71430100349faa20081bd77f155c6.zip |
OutputThread: move code to CloseOutput()
Diffstat (limited to '')
-rw-r--r-- | src/output/Internal.hxx | 7 | ||||
-rw-r--r-- | src/output/OutputThread.cxx | 18 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index 23b027c54..6b67a8783 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -382,6 +382,13 @@ private: void Close(bool drain); void Reopen(); + /** + * Close the output plugin. + * + * Mutex must not be locked. + */ + void CloseOutput(bool drain); + AudioFormat OpenFilter(AudioFormat &format, Error &error_r); /** diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 9baaaf0e0..badf8f6c9 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -251,12 +251,7 @@ AudioOutput::Close(bool drain) mutex.unlock(); - if (drain) - ao_plugin_drain(this); - else - ao_plugin_cancel(this); - - ao_plugin_close(this); + CloseOutput(drain); CloseFilter(); mutex.lock(); @@ -265,6 +260,17 @@ AudioOutput::Close(bool drain) plugin.name, name); } +inline void +AudioOutput::CloseOutput(bool drain) +{ + if (drain) + ao_plugin_drain(this); + else + ao_plugin_cancel(this); + + ao_plugin_close(this); +} + void AudioOutput::ReopenFilter() { |