aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tinyalsa/asoundlib.h3
-rw-r--r--pcm.c15
2 files changed, 18 insertions, 0 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h
index 75e5cda..809e02d 100644
--- a/include/tinyalsa/asoundlib.h
+++ b/include/tinyalsa/asoundlib.h
@@ -239,6 +239,9 @@ int pcm_prepare(struct pcm *pcm);
int pcm_start(struct pcm *pcm);
int pcm_stop(struct pcm *pcm);
+/* ioctl function for PCM driver */
+int pcm_ioctl(struct pcm *pcm, int request, ...);
+
/* Interrupt driven API */
int pcm_wait(struct pcm *pcm, int timeout);
diff --git a/pcm.c b/pcm.c
index a25428e..d8af58a 100644
--- a/pcm.c
+++ b/pcm.c
@@ -1283,3 +1283,18 @@ int pcm_mmap_read(struct pcm *pcm, void *data, unsigned int count)
return pcm_mmap_transfer(pcm, data, count);
}
+
+int pcm_ioctl(struct pcm *pcm, int request, ...)
+{
+ va_list ap;
+ void * arg;
+
+ if (!pcm_is_ready(pcm))
+ return -1;
+
+ va_start(ap, request);
+ arg = va_arg(ap, void *);
+ va_end(ap);
+
+ return ioctl(pcm->fd, request, arg);
+}