From 875aed990f0774cd8dbbdf3bbbaae83437d22e25 Mon Sep 17 00:00:00 2001 From: Abramo Bagnara Date: Thu, 29 Jun 2000 09:20:27 +0000 Subject: [PATCH] Moved mmap_size to setup struct --- src/pcm/pcm_local.h | 1 - src/pcm/pcm_mmap.c | 14 +++----------- src/pcm/pcm_multi.c | 9 +++++---- src/pcm/pcm_plug.c | 3 +-- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 9968927e..5055d6d1 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -65,7 +65,6 @@ struct snd_pcm { snd_pcm_mmap_status_t *mmap_status; snd_pcm_mmap_control_t *mmap_control; char *mmap_data; - size_t mmap_data_size; enum { _INTERLEAVED, _NONINTERLEAVED, _COMPLEX } mmap_type; struct snd_pcm_ops *ops; void *op_arg; diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c index 8304975f..bdac8a6b 100644 --- a/src/pcm/pcm_mmap.c +++ b/src/pcm/pcm_mmap.c @@ -507,8 +507,6 @@ int snd_pcm_mmap_get_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *areas) int snd_pcm_mmap_data(snd_pcm_t *handle, void **data) { - snd_pcm_info_t info; - size_t bsize; int err; assert(handle); assert(handle->valid_setup); @@ -518,17 +516,12 @@ int snd_pcm_mmap_data(snd_pcm_t *handle, void **data) return 0; } - err = snd_pcm_info(handle, &info); - if (err < 0) - return err; - bsize = info.mmap_size; - if (!(info.flags & SND_PCM_INFO_MMAP)) + if (handle->setup.mmap_size == 0) return -ENXIO; - if ((err = handle->ops->mmap_data(handle->op_arg, (void**)&handle->mmap_data, bsize)) < 0) + if ((err = handle->ops->mmap_data(handle->op_arg, (void**)&handle->mmap_data, handle->setup.mmap_size)) < 0) return err; if (data) *data = handle->mmap_data; - handle->mmap_data_size = bsize; err = snd_pcm_mmap_get_areas(handle, NULL); if (err < 0) return err; @@ -582,12 +575,11 @@ int snd_pcm_munmap_data(snd_pcm_t *handle) int err; assert(handle); assert(handle->mmap_data); - if ((err = handle->ops->munmap_data(handle->op_arg, handle->mmap_data, handle->mmap_data_size)) < 0) + if ((err = handle->ops->munmap_data(handle->op_arg, handle->mmap_data, handle->setup.mmap_size)) < 0) return err; free(handle->channels); handle->channels = 0; handle->mmap_data = 0; - handle->mmap_data_size = 0; return 0; } diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index 87469a29..6b95a093 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -97,7 +97,6 @@ static int snd_pcm_multi_info(void *private, snd_pcm_info_t *info) err = snd_pcm_info(handle_0, info); if (err < 0) return err; - info->mmap_size = 0; info->buffer_size /= channels0; info->min_fragment_size /= channels0; info->max_fragment_size /= channels0; @@ -239,6 +238,8 @@ static int snd_pcm_multi_setup(void *private, snd_pcm_setup_t *setup) } } } + /* Loaded with a value != 0 if mmap is feasible */ + setup->mmap_size = !multi->one_to_many; return 0; } @@ -429,19 +430,19 @@ ssize_t snd_pcm_multi_write(void *private, const void *buf, size_t count) ssize_t snd_pcm_multi_read(void *private, void *buf, size_t count) { snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private; - return count; + return -ENOSYS; } ssize_t snd_pcm_multi_writev(void *private, const struct iovec *vector, unsigned long count) { snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private; - return count; + return -ENOSYS; } ssize_t snd_pcm_multi_readv(void *private, const struct iovec *vector, unsigned long count) { snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private; - return count; + return -ENOSYS; } static int snd_pcm_multi_mmap_status(void *private, snd_pcm_mmap_status_t **status) diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index d4e9a4fa..8605402b 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -139,7 +139,6 @@ static int snd_pcm_plug_info(void *private, snd_pcm_info_t *info) info->fifo_size = snd_pcm_plug_client_size(plug, info->fifo_size); info->transfer_block_size = snd_pcm_plug_client_size(plug, info->transfer_block_size); } - info->mmap_size = 0; info->flags &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID); return 0; } @@ -177,7 +176,7 @@ static int snd_pcm_plug_setup(void *private, snd_pcm_setup_t *setup) setup->frames_align = snd_pcm_plug_client_size(plug, setup->frames_align); setup->frames_xrun_max = snd_pcm_plug_client_size(plug, setup->frames_xrun_max); setup->frames_fill_max = snd_pcm_plug_client_size(plug, setup->frames_fill_max); - + setup->mmap_size = 0; if (plug->handle->stream == SND_PCM_STREAM_PLAYBACK) setup->format = plug->first->src_format; else -- 2.47.1