aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordvdli <dvdli@google.com>2021-01-28 15:03:17 +0800
committerdvdli <dvdli@google.com>2021-01-28 15:14:34 +0800
commit3694925022aa16b10978c92b9a2a69661dbbcdcf (patch)
tree9394851d20a337e98081bbc3379f61531d6fbe76 /src
parentc0f924738de2b8f5478e8b454b4ad5521802f3f6 (diff)
Let pcm_mmap_read/write call pcm_readi/writei
The pcm_readi and pcm_writei also can deal with the mmap read/write. Also mark the pcm_mmap_read/write functions as deprecated functions and update the test case. Add mmap playback support to tinyplay
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pcm.c b/src/pcm.c
index 3d7da0c..10e477b 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -1547,10 +1547,10 @@ int pcm_mmap_transfer(struct pcm *pcm, void *buffer, unsigned int frames)
int pcm_mmap_write(struct pcm *pcm, const void *data, unsigned int count)
{
if ((~pcm->flags) & (PCM_OUT | PCM_MMAP))
- return -ENOSYS;
+ return -EINVAL;
unsigned int frames = pcm_bytes_to_frames(pcm, count);
- int res = pcm_mmap_transfer(pcm, (void *) data, frames);
+ int res = pcm_writei(pcm, (void *) data, frames);
if (res < 0) {
return res;
@@ -1562,10 +1562,10 @@ int pcm_mmap_write(struct pcm *pcm, const void *data, unsigned int count)
int pcm_mmap_read(struct pcm *pcm, void *data, unsigned int count)
{
if ((~pcm->flags) & (PCM_IN | PCM_MMAP))
- return -ENOSYS;
+ return -EINVAL;
unsigned int frames = pcm_bytes_to_frames(pcm, count);
- int res = pcm_mmap_transfer(pcm, data, frames);
+ int res = pcm_readi(pcm, data, frames);
if (res < 0) {
return res;