mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
Added snd_*_poll_descriptors_revents functions.
This commit is contained in:
parent
23ab0b3509
commit
ddb7209e9a
15 changed files with 195 additions and 36 deletions
|
|
@ -160,15 +160,33 @@ int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl)
|
|||
*/
|
||||
int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space)
|
||||
{
|
||||
assert(ctl);
|
||||
assert(ctl && pfds);
|
||||
if (space > 0) {
|
||||
pfds->fd = ctl->poll_fd;
|
||||
pfds->events = POLLIN;
|
||||
pfds->events = POLLIN|POLLERR;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get returned events from poll descriptors
|
||||
* \param ctl CTL handle
|
||||
* \param pfds array of poll descriptors
|
||||
* \param nfds count of poll descriptors
|
||||
* \param revents returned events
|
||||
* \return zero if success, otherwise a negative error code
|
||||
*/
|
||||
int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
|
||||
{
|
||||
assert(ctl && pfds && revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ask to be informed about events (poll, #snd_ctl_async, #snd_ctl_read)
|
||||
* \param ctl CTL handle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue