mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Moved mmap_size to setup struct
This commit is contained in:
parent
0bb7e43979
commit
875aed990f
4 changed files with 9 additions and 18 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue