diff options
author | Simon Wilson <simonwilson@google.com> | 2013-07-17 10:30:35 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2013-07-17 11:08:46 -0700 |
commit | 7136cf7c86ded4b498c08bfc295391184debbaf7 (patch) | |
tree | 70a753f49eb8c83e15f51574b904f38142b30a7e | |
parent | ec281392bb826caa21cbba9aa2ebed1a9629d921 (diff) |
pcm: support S24_LE format
S24_LE is 24 bit audio in a 32 bit sample size. Also
make the pcm_format_to_bits() function part of the API
since it will be required for tinycap.
-rw-r--r-- | include/tinyalsa/asoundlib.h | 7 | ||||
-rw-r--r-- | pcm.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index 1b5d897..3d20b94 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -150,6 +150,13 @@ int pcm_set_config(struct pcm *pcm, struct pcm_config *config); /* Returns a human readable reason for the last error */ const char *pcm_get_error(struct pcm *pcm); +/* Returns the sample size in bits for a PCM format. + * As with ALSA formats, this is the storage size for the format, whereas the + * format represents the number of significant bits. For example, + * PCM_FORMAT_S24_LE uses 32 bits of storage. + */ +unsigned int pcm_format_to_bits(enum pcm_format format); + /* Returns the buffer size (int frames) that should be used for pcm_write. */ unsigned int pcm_get_buffer_size(struct pcm *pcm); unsigned int pcm_frames_to_bytes(struct pcm *pcm, unsigned int frames); @@ -212,10 +212,11 @@ static unsigned int pcm_format_to_alsa(enum pcm_format format) }; } -static unsigned int pcm_format_to_bits(enum pcm_format format) +unsigned int pcm_format_to_bits(enum pcm_format format) { switch (format) { case PCM_FORMAT_S32_LE: + case PCM_FORMAT_S24_LE: return 32; default: case PCM_FORMAT_S16_LE: |