]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fix generation of IEC958 subframes
authorTakashi Iwai <tiwai@suse.de>
Thu, 17 Nov 2005 12:08:32 +0000 (12:08 +0000)
committerTakashi Iwai <tiwai@suse.de>
Thu, 17 Nov 2005 12:08:32 +0000 (12:08 +0000)
From: Nicolas Boullis <nboullis@debian.org>

While working on an ALSA driver for the audio part of em8300-based MPEG
decoder boards (Sigma Designs' Hollywood+ boards and Creative Labs' DXR3
boards), I think I discovered a bug in the code that generates IEC958
subframes from linear samples (iec958 plugin): M and W preambles are
swapped, and B preambles should only be used on even subframes. The
attached patch fixes this issue.

src/pcm/pcm_iec958.c

index 84296cb492882e13b94fcf73713f94e7c4755df3..7723e7dfd29c3aec817619b44f25742928fa27ae 100644 (file)
@@ -116,10 +116,10 @@ static inline u_int32_t iec958_subframe(snd_pcm_iec958_t *iec, u_int32_t data, i
                data |= 0x80000000;
 
        /* Preamble */
-       if (! iec->counter)
-               data |= iec->preamble[PREAMBLE_Z];      /* Block start, 'Z' */
-       else if (! channel)
+       if (channel)
                data |= iec->preamble[PREAMBLE_Y];      /* odd sub frame, 'Y' */
+       else if (! iec->counter)
+               data |= iec->preamble[PREAMBLE_Z];      /* Block start, 'Z' */
        else
                data |= iec->preamble[PREAMBLE_X];      /* even sub frame, 'X' */