diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-04-21 14:24:19 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-21 14:24:19 +0200 |
commit | d011aa5eec603b5e7b6f3d66f968e315abb2571d (patch) | |
tree | 62d6dea312a57713d73f4ad07172508106aedbc7 | |
parent | 85fa1c308b4ad1ccee298e2f883087bd5357035d (diff) | |
download | salsa-lib-d011aa5eec603b5e7b6f3d66f968e315abb2571d.tar.gz |
Add G723 and DSD format supports
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | src/asound.h | 11 | ||||
-rw-r--r-- | src/pcm.c | 18 | ||||
-rw-r--r-- | src/pcm_misc.c | 28 |
3 files changed, 56 insertions, 1 deletions
diff --git a/src/asound.h b/src/asound.h index b85640c..51c5231 100644 --- a/src/asound.h +++ b/src/asound.h @@ -173,7 +173,16 @@ typedef enum _snd_pcm_format { SND_PCM_FORMAT_S18_3BE, SND_PCM_FORMAT_U18_3LE, SND_PCM_FORMAT_U18_3BE, - SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE, + SND_PCM_FORMAT_G723_24, + SND_PCM_FORMAT_G723_24_1B, + SND_PCM_FORMAT_G723_40, + SND_PCM_FORMAT_G723_40_1B, + SND_PCM_FORMAT_DSD_U8, + SND_PCM_FORMAT_DSD_U16_LE, + SND_PCM_FORMAT_DSD_U32_LE, + SND_PCM_FORMAT_DSD_U16_BE, + SND_PCM_FORMAT_DSD_U32_BE, + SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_BE, #ifdef SND_LITTLE_ENDIAN SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE, @@ -330,6 +330,15 @@ const char * const _snd_pcm_format_names[SND_PCM_FORMAT_LAST + 1] = { FORMAT(S18_3BE), FORMAT(U18_3LE), FORMAT(U18_3BE), + FORMAT(G723_24), + FORMAT(G723_24_1B), + FORMAT(G723_40), + FORMAT(G723_40_1B), + FORMAT(DSD_U8), + FORMAT(DSD_U16_LE), + FORMAT(DSD_U32_LE), + FORMAT(DSD_U16_BE), + FORMAT(DSD_U32_BE), }; static const char * const _snd_pcm_format_aliases[SND_PCM_FORMAT_LAST + 1] = { @@ -383,6 +392,15 @@ const char * const _snd_pcm_format_descriptions[SND_PCM_FORMAT_LAST + 1] = { FORMATD(S18_3BE, "Signed 18 bit Big Endian in 3bytes"), FORMATD(U18_3LE, "Unsigned 18 bit Little Endian in 3bytes"), FORMATD(U18_3BE, "Unsigned 18 bit Big Endian in 3bytes"), + FORMATD(G723_24, "G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes"), + FORMATD(G723_24_1B, "G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte"), + FORMATD(G723_40, "G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes"), + FORMATD(G723_40_1B, "G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte"), + FORMATD(DSD_U8, "Direct Stream Digital (DSD) in 1-byte samples (x8)"), + FORMATD(DSD_U16_LE, "Direct Stream Digital (DSD) in 2-byte samples (x16)"), + FORMATD(DSD_U32_LE, "Direct Stream Digital (DSD) in 4-byte samples (x32)"), + FORMATD(DSD_U16_BE, "Direct Stream Digital (DSD) in 2-byte samples (x16)"), + FORMATD(DSD_U32_BE, "Direct Stream Digital (DSD) in 4-byte samples (x32)"), }; const char * const _snd_pcm_type_names[] = { diff --git a/src/pcm_misc.c b/src/pcm_misc.c index d6dbccd..6a5417d 100644 --- a/src/pcm_misc.c +++ b/src/pcm_misc.c @@ -173,6 +173,34 @@ const struct snd_pcm_format_data _snd_pcm_formats[SND_PCM_FORMAT_LAST+1] = { .width = 18, .phys = 24, .le = 0, .signd = 0, .silence = { 0x02, 0x00, 0x00 }, }, + [SND_PCM_FORMAT_G723_24] = { + .width = 3, .phys = 3, .le = -1, .signd = -1, + .silence = {}, + }, + [SND_PCM_FORMAT_G723_40] = { + .width = 5, .phys = 5, .le = -1, .signd = -1, + .silence = {}, + }, + [SND_PCM_FORMAT_DSD_U8] = { + .width = 8, .phys = 8, .le = 1, .signd = 0, + .silence = { 0x69 }, + }, + [SND_PCM_FORMAT_DSD_U16_LE] = { + .width = 16, .phys = 16, .le = 1, .signd = 0, + .silence = { 0x69, 0x69 }, + }, + [SND_PCM_FORMAT_DSD_U32_LE] = { + .width = 32, .phys = 32, .le = 1, .signd = 0, + .silence = { 0x69, 0x69, 0x69, 0x69 }, + }, + [SND_PCM_FORMAT_DSD_U16_BE] = { + .width = 16, .phys = 16, .le = 0, .signd = 0, + .silence = { 0x69, 0x69 }, + }, + [SND_PCM_FORMAT_DSD_U32_BE] = { + .width = 32, .phys = 32, .le = 0, .signd = 0, + .silence = { 0x69, 0x69, 0x69, 0x69 }, + }, }; u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) |