]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixed one typo and one thinko
authorAbramo Bagnara <abramo@alsa-project.org>
Thu, 18 May 2000 14:38:10 +0000 (14:38 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Thu, 18 May 2000 14:38:10 +0000 (14:38 +0000)
include/pcm.h
src/pcm/pcm_common.c
src/pcm/plugin/copy.c

index 117c7e4d6e4bf07be0dc8e4fee71afab993d92be..89621af3513a925d32de6a2e23bfaf363a6e9ce1 100644 (file)
@@ -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
index bb2217ba39cc10aa15245a6a379b225ef47ad3e7..941dc2436cdb623eee7e454a79cde0c3708af017 100644 (file)
@@ -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);
index c985071387fc69fee199d2fd654cd0b25798d724..f7d3c77c761380701b1ac4fa153bc0be5122fe56 100644 (file)
@@ -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)