lib/alsa/NonBlock: move the functions into a class managing the state
This commit is contained in:
@@ -23,8 +23,7 @@
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
std::chrono::steady_clock::duration
|
||||
PrepareAlsaPcmSockets(MultiSocketMonitor &m, snd_pcm_t *pcm,
|
||||
ReusableArray<pollfd> &pfd_buffer)
|
||||
AlsaNonBlockPcm::PrepareSockets(MultiSocketMonitor &m, snd_pcm_t *pcm)
|
||||
{
|
||||
int count = snd_pcm_poll_descriptors_count(pcm);
|
||||
if (count <= 0) {
|
||||
@@ -51,8 +50,7 @@ PrepareAlsaPcmSockets(MultiSocketMonitor &m, snd_pcm_t *pcm,
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::duration
|
||||
PrepareAlsaMixerSockets(MultiSocketMonitor &m, snd_mixer_t *mixer,
|
||||
ReusableArray<pollfd> &pfd_buffer) noexcept
|
||||
AlsaNonBlockMixer::PrepareSockets(MultiSocketMonitor &m, snd_mixer_t *mixer) noexcept
|
||||
{
|
||||
int count = snd_mixer_poll_descriptors_count(mixer);
|
||||
if (count <= 0) {
|
||||
|
@@ -30,23 +30,30 @@
|
||||
class MultiSocketMonitor;
|
||||
|
||||
/**
|
||||
* Update #MultiSocketMonitor's socket list from
|
||||
* snd_pcm_poll_descriptors(). To be called from
|
||||
* MultiSocketMonitor::PrepareSockets().
|
||||
*
|
||||
* Throws exception on error.
|
||||
* Helper class for #MultiSocketMonitor's virtual methods which
|
||||
* manages the file descriptors for a #snd_pcm_t.
|
||||
*/
|
||||
std::chrono::steady_clock::duration
|
||||
PrepareAlsaPcmSockets(MultiSocketMonitor &m, snd_pcm_t *pcm,
|
||||
ReusableArray<pollfd> &pfd_buffer);
|
||||
class AlsaNonBlockPcm {
|
||||
ReusableArray<pollfd> pfd_buffer;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Throws on error.
|
||||
*/
|
||||
std::chrono::steady_clock::duration PrepareSockets(MultiSocketMonitor &m,
|
||||
snd_pcm_t *pcm);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update #MultiSocketMonitor's socket list from
|
||||
* snd_mixer_poll_descriptors(). To be called from
|
||||
* MultiSocketMonitor::PrepareSockets().
|
||||
* Helper class for #MultiSocketMonitor's virtual methods which
|
||||
* manages the file descriptors for a #snd_mixer_t.
|
||||
*/
|
||||
std::chrono::steady_clock::duration
|
||||
PrepareAlsaMixerSockets(MultiSocketMonitor &m, snd_mixer_t *mixer,
|
||||
ReusableArray<pollfd> &pfd_buffer) noexcept;
|
||||
class AlsaNonBlockMixer {
|
||||
ReusableArray<pollfd> pfd_buffer;
|
||||
|
||||
public:
|
||||
std::chrono::steady_clock::duration PrepareSockets(MultiSocketMonitor &m,
|
||||
snd_mixer_t *mixer) noexcept;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user