From: Takashi Iwai Date: Thu, 17 Nov 2005 12:08:32 +0000 (+0000) Subject: Fix generation of IEC958 subframes X-Git-Tag: v1.0.11rc1~24 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=6b85e23fa3d623a37de6bf0439cd68bef7229931;p=alsa-lib.git Fix generation of IEC958 subframes From: Nicolas Boullis 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. --- diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c index 84296cb4..7723e7df 100644 --- a/src/pcm/pcm_iec958.c +++ b/src/pcm/pcm_iec958.c @@ -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' */