summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2013-04-08 13:28:03 +0200
committerJaroslav Kysela <perex@perex.cz>2013-04-08 13:28:03 +0200
commite23fb2c4de29b24c28f0c609521faa28d948a05b (patch)
tree6ba8d5d89dd8ee955f221f3ef5bf8c71c9f633d1 /include
parent730c833dd8b76cc280246be698980422cb1bce47 (diff)
control, pcm: implement snd_ctl_abort() and snd_pcm_abort() functions
Upon an interrupt, it is necessary to abort the wait loops with the EINTR error code. Introduce snd_*_abort() functions to handle this case. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include')
-rw-r--r--include/control.h2
-rw-r--r--include/pcm.h3
2 files changed, 5 insertions, 0 deletions
diff --git a/include/control.h b/include/control.h
index e8408355..27fe2ac8 100644
--- a/include/control.h
+++ b/include/control.h
@@ -234,6 +234,7 @@ int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t
int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name, const char *orig_name, int mode);
int snd_ctl_close(snd_ctl_t *ctl);
int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
+static inline int snd_ctl_abort(snd_ctl_t *ctl) { return snd_ctl_nonblock(ctl, 2); }
int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
snd_async_callback_t callback, void *private_data);
snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler);
@@ -531,6 +532,7 @@ int snd_hctl_open(snd_hctl_t **hctl, const char *name, int mode);
int snd_hctl_open_ctl(snd_hctl_t **hctlp, snd_ctl_t *ctl);
int snd_hctl_close(snd_hctl_t *hctl);
int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock);
+static inline int snd_hctl_abort(snd_hctl_t *hctl) { return snd_hctl_nonblock(hctl, 2); }
int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl);
int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space);
int snd_hctl_poll_descriptors_revents(snd_hctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
diff --git a/include/pcm.h b/include/pcm.h
index 22356784..549d6292 100644
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -314,6 +314,8 @@ typedef long snd_pcm_sframes_t;
#define SND_PCM_NONBLOCK 0x00000001
/** Async notification (flag for open mode) \hideinitializer */
#define SND_PCM_ASYNC 0x00000002
+/** In an abort state (internal, not allowed for open) */
+#define SND_PCM_ABORT 0x00008000
/** Disable automatic (but not forced!) rate resamplinig */
#define SND_PCM_NO_AUTO_RESAMPLE 0x00010000
/** Disable automatic (but not forced!) channel conversion */
@@ -437,6 +439,7 @@ int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm);
int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
+static inline int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); }
int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
snd_async_callback_t callback, void *private_data);
snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler);