]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: fix ipc offset calculation for direct plugins
authorJaroslav Kysela <perex@perex.cz>
Mon, 23 Oct 2006 09:34:00 +0000 (11:34 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 23 Oct 2006 09:34:00 +0000 (11:34 +0200)
Also add more accurate description to x24 formats.

include/pcm.h
src/pcm/pcm_direct.c

index 5aca759bebae85bcdc7515412785f419a9118923..23b98aacad840894d44ed9cd1f904020fdc2f780 100644 (file)
@@ -120,13 +120,13 @@ typedef enum _snd_pcm_format {
        SND_PCM_FORMAT_U16_LE,
        /** Unsigned 16 bit Big Endian */
        SND_PCM_FORMAT_U16_BE,
-       /** Signed 24 bit Little Endian */
+       /** Signed 24 bit Little Endian using low three bytes in 32-bit word */
        SND_PCM_FORMAT_S24_LE,
-       /** Signed 24 bit Big Endian */
+       /** Signed 24 bit Big Endian using low three bytes in 32-bit word */
        SND_PCM_FORMAT_S24_BE,
-       /** Unsigned 24 bit Little Endian */
+       /** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */
        SND_PCM_FORMAT_U24_LE,
-       /** Unsigned 24 bit Big Endian */
+       /** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */
        SND_PCM_FORMAT_U24_BE,
        /** Signed 32 bit Little Endian */
        SND_PCM_FORMAT_S32_LE,
index 93ff2a98deb4488037f2cac09f23b01bd1a06fe4..075671022906cab2a20a197000350622d890eb74 100644 (file)
@@ -1426,12 +1426,12 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
                                                int hop)
 {
        snd_config_iterator_t i, next;
+       snd_config_t *pcm_conf;
        int err;
        long card = 0, device = 0, subdevice = 0;
        const char *str;
 
        if (snd_config_get_string(sconf, &str) >= 0) {
-               snd_config_t *pcm_conf;
                if (hop > SND_CONF_MAX_HOPS) {
                        SNDERR("Too many definition levels (looped?)");
                        return -EINVAL;
@@ -1448,6 +1448,21 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
                return err;
        }
 
+#if 0  /* for debug purposes */
+       {
+               snd_output_t *out;
+               snd_output_stdio_attach(&out, stderr, 0);
+               snd_config_save(sconf, out);
+               snd_output_close(out);
+       }
+#endif
+
+       if (snd_config_search(sconf, "slave", &pcm_conf) >= 0 &&
+           snd_config_search(pcm_conf, "pcm", &pcm_conf) >= 0)
+               return _snd_pcm_direct_get_slave_ipc_offset(root, pcm_conf,
+                                                           direction,
+                                                           hop + 1);
+
        snd_config_for_each(i, next, sconf) {
                snd_config_t *n = snd_config_iterator_entry(i);
                const char *id, *str;
@@ -1631,7 +1646,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
                SNDERR("Unknown field %s", id);
                return -EINVAL;
        }
-       if (! rec->slave) {
+       if (!rec->slave) {
                SNDERR("slave is not defined");
                return -EINVAL;
        }
@@ -1641,7 +1656,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
        }
        if (ipc_key_add_uid)
                rec->ipc_key += getuid();
-       err = snd_pcm_direct_get_slave_ipc_offset(root, rec->slave, stream);
+       err = snd_pcm_direct_get_slave_ipc_offset(root, conf, stream);
        if (err < 0)
                return err;
        rec->ipc_key += err;