From ad80762a3b75e39bb26faf091b203c1d7c49fc05 Mon Sep 17 00:00:00 2001 From: Andy Hung Date: Mon, 10 Mar 2014 18:08:15 -0700 Subject: Update tinypcminfo to display format information Change-Id: I0e6a04da5a4b122a3748b16c7eb01c4a224c3d84 Signed-off-by: Andy Hung --- pcm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'pcm.c') diff --git a/pcm.c b/pcm.c index 074422a..1a5d84b 100644 --- a/pcm.c +++ b/pcm.c @@ -504,6 +504,12 @@ void pcm_params_free(struct pcm_params *pcm_params) static int pcm_param_to_alsa(enum pcm_param param) { switch (param) { + case PCM_PARAM_ACCESS: + return SNDRV_PCM_HW_PARAM_ACCESS; + case PCM_PARAM_FORMAT: + return SNDRV_PCM_HW_PARAM_FORMAT; + case PCM_PARAM_SUBFORMAT: + return SNDRV_PCM_HW_PARAM_SUBFORMAT; case PCM_PARAM_SAMPLE_BITS: return SNDRV_PCM_HW_PARAM_SAMPLE_BITS; break; @@ -546,6 +552,23 @@ static int pcm_param_to_alsa(enum pcm_param param) } } +struct pcm_mask *pcm_params_get_mask(struct pcm_params *pcm_params, + enum pcm_param param) +{ + int p; + struct snd_pcm_hw_params *params = (struct snd_pcm_hw_params *)pcm_params; + if (params == NULL) { + return NULL; + } + + p = pcm_param_to_alsa(param); + if (p < 0 || !param_is_mask(p)) { + return NULL; + } + + return (struct pcm_mask *)param_to_mask(params, p); +} + unsigned int pcm_params_get_min(struct pcm_params *pcm_params, enum pcm_param param) { -- cgit v1.2.3