mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Fixed one typo and one thinko
This commit is contained in:
parent
937414d534
commit
2284d80ef0
3 changed files with 22 additions and 10 deletions
|
|
@ -342,7 +342,8 @@ int snd_pcm_plugin_build_route(snd_pcm_plugin_handle_t *handle,
|
|||
snd_pcm_plugin_t **r_plugin);
|
||||
int snd_pcm_plugin_build_copy(snd_pcm_plugin_handle_t *handle,
|
||||
int channel,
|
||||
snd_pcm_format_t *format,
|
||||
snd_pcm_format_t *src_format,
|
||||
snd_pcm_format_t *dst_format,
|
||||
snd_pcm_plugin_t **r_plugin);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -790,6 +790,7 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
|
|||
tmpparams.format.interleave = dstparams.format.interleave;
|
||||
err = snd_pcm_plugin_build_copy(handle,
|
||||
params->channel,
|
||||
&srcparams->format,
|
||||
&tmpparams.format,
|
||||
&plugin);
|
||||
pdprintf("interleave change: src=%i, dst=%i returns %i\n", srcparams->format.interleave, tmpparams.format.interleave, err);
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ static ssize_t copy_transfer(snd_pcm_plugin_t *plugin,
|
|||
return 0;
|
||||
nvoices = plugin->src_format.voices;
|
||||
for (voice = 0; voice < nvoices; voice++) {
|
||||
if (src_voices[voice].area.first % 8 != 0 ||
|
||||
src_voices[voice].area.step % 8 != 0)
|
||||
if (src_voices->area.first % 8 != 0 ||
|
||||
src_voices->area.step % 8 != 0)
|
||||
return -EINVAL;
|
||||
if (dst_voices[voice].area.first % 8 != 0 ||
|
||||
dst_voices[voice].area.step % 8 != 0)
|
||||
if (dst_voices->area.first % 8 != 0 ||
|
||||
dst_voices->area.step % 8 != 0)
|
||||
return -EINVAL;
|
||||
if (!src_voices->enabled) {
|
||||
if (dst_voices->wanted)
|
||||
|
|
@ -61,15 +61,18 @@ static ssize_t copy_transfer(snd_pcm_plugin_t *plugin,
|
|||
dst_voices->enabled = 0;
|
||||
continue;
|
||||
}
|
||||
dst_voices[voice].enabled = 1;
|
||||
dst_voices->enabled = 1;
|
||||
snd_pcm_area_copy(&src_voices->area, 0, &dst_voices->area, 0, samples, plugin->src_format.format);
|
||||
src_voices++;
|
||||
dst_voices++;
|
||||
}
|
||||
return samples;
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_build_copy(snd_pcm_plugin_handle_t *handle,
|
||||
int channel,
|
||||
snd_pcm_format_t *format,
|
||||
snd_pcm_format_t *src_format,
|
||||
snd_pcm_format_t *dst_format,
|
||||
snd_pcm_plugin_t **r_plugin)
|
||||
{
|
||||
int err;
|
||||
|
|
@ -80,14 +83,21 @@ int snd_pcm_plugin_build_copy(snd_pcm_plugin_handle_t *handle,
|
|||
return -EFAULT;
|
||||
*r_plugin = NULL;
|
||||
|
||||
width = snd_pcm_format_physical_width(format->format);
|
||||
if (src_format->format != dst_format->format)
|
||||
return -EINVAL;
|
||||
if (src_format->rate != dst_format->rate)
|
||||
return -EINVAL;
|
||||
if (src_format->voices != dst_format->voices)
|
||||
return -EINVAL;
|
||||
|
||||
width = snd_pcm_format_physical_width(src_format->format);
|
||||
if (width < 0)
|
||||
return -EINVAL;
|
||||
|
||||
err = snd_pcm_plugin_build(handle, channel,
|
||||
"copy",
|
||||
format,
|
||||
format,
|
||||
src_format,
|
||||
dst_format,
|
||||
0,
|
||||
&plugin);
|
||||
if (err < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue