diff options
author | Dylan Reid <dgreid@chromium.org> | 2015-09-01 11:03:01 -0700 |
---|---|---|
committer | Dylan Reid <dgreid@google.com> | 2015-09-09 14:28:04 -0700 |
commit | b42510d55bafc96805a44bd6ac40faac28ebd219 (patch) | |
tree | 66dc1608f8cd8b7ed976ba2bb8b77ec2d91c93ac | |
parent | 6188c412b0533c28f67ca2f10f59f8fc4ec80a62 (diff) | |
download | android_external_tinyalsa-b42510d55bafc96805a44bd6ac40faac28ebd219.tar.gz android_external_tinyalsa-b42510d55bafc96805a44bd6ac40faac28ebd219.tar.bz2 android_external_tinyalsa-b42510d55bafc96805a44bd6ac40faac28ebd219.zip |
Add pcm_get_poll_fd
Similar to ALSA snd_pcm_get_poll_fd, this will allow a user to wait for
a sound device to have data in a poll(2) call. The hotword thread will
use this to wait for a message on its socket or for audio data to become
ready.
Change-Id: I61375a73d7a842b00362fc707c12f99aa18e0bdf
Signed-off-by: Dylan Reid <dgreid@chromium.org>
-rw-r--r-- | include/tinyalsa/asoundlib.h | 1 | ||||
-rw-r--r-- | pcm.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index 30cf0da..97ee4f3 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -248,6 +248,7 @@ int pcm_ioctl(struct pcm *pcm, int request, ...); /* Interrupt driven API */ int pcm_wait(struct pcm *pcm, int timeout); +int pcm_get_poll_fd(struct pcm *pcm); /* Change avail_min after the stream has been opened with no need to stop the stream. * Only accepted if opened with PCM_MMAP and PCM_NOIRQ flags @@ -1180,6 +1180,11 @@ int pcm_wait(struct pcm *pcm, int timeout) return 1; } +int pcm_get_poll_fd(struct pcm *pcm) +{ + return pcm->fd; +} + int pcm_mmap_transfer(struct pcm *pcm, const void *buffer, unsigned int bytes) { int err = 0, frames, avail; |