Skip to contentSkip to conversation

fix entries for U24_BE and U24_LE in pcm_formats[] array

PATCH In review Timur Tabi 2 participants 2 messages Dec 20, 2007 – Dec 21, 2007 Sound

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH 1/1 fix entries for U24_BE and U24_LE in pcm_formats[] array

SNDRV_PCM_FORMAT_U24_BE and SNDRV_PCM_FORMAT_U24_LE represent 24-bit samples that are aligned into a 4-byte word, so the most significant byte is always zero. The entries for these two sample formats in the pcm_formats[] array only specified 3 bytes. For SNDRV_PCM_FORMAT_U24_LE, the compiler automatically adds the 4th byte, but for SNDRV_PCM_FORMAT_U24_BE the entry was just wrong. This patch fixes both entries.

---

I do not have hardware that supports U24_BE, so I can't test this change.

 sound/core/pcm_misc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/core/pcm_misc.c +2 -2
index dd9aa51..077fc0b 100644
@@ -71,11 +71,11 @@ static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = {
 	},
 	[SNDRV_PCM_FORMAT_U24_LE] = {
 		.width = 24, .phys = 32, .le = 1, .signd = 0,
-		.silence = { 0x00, 0x00, 0x80 },
+		.silence = { 0x00, 0x00, 0x80, 0x00 },
 	},
 	[SNDRV_PCM_FORMAT_U24_BE] = {
 		.width = 24, .phys = 32, .le = 0, .signd = 0,
-		.silence = { 0x80, 0x00, 0x00 },
+		.silence = { 0x00, 0x80, 0x00, 0x00 },
 	},
 	[SNDRV_PCM_FORMAT_S32_LE] = {
 		.width = 32, .phys = 32, .le = 1, .signd = 1,
Signature · 1 line
1.5.2.4
#1 lore raw

At Thu, 20 Dec 2007 14:43:14 -0600,

Quoted 9 lines · Timur Tabi

SNDRV_PCM_FORMAT_U24_BE and SNDRV_PCM_FORMAT_U24_LE represent 24-bit samples that are aligned into a 4-byte word, so the most significant byte is always zero. The entries for these two sample formats in the pcm_formats[] array only specified 3 bytes. For SNDRV_PCM_FORMAT_U24_LE, the compiler automatically adds the 4th byte, but for SNDRV_PCM_FORMAT_U24_BE the entry was just wrong. This patch fixes both entries.

U24_BE was already fixed on HG tree...

Takashi