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;
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);
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;
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;
}
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;
}
}
}
+ /* Loaded with a value != 0 if mmap is feasible */
+ setup->mmap_size = !multi->one_to_many;
return 0;
}
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)
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;
}
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