aboutsummaryrefslogtreecommitdiff
path: root/pcm.c
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-03-10 18:08:15 -0700
committerSimon Wilson <simonwilson@google.com>2014-06-03 12:56:15 -0700
commitad80762a3b75e39bb26faf091b203c1d7c49fc05 (patch)
treeb799e94ee89e5d25b5f5034c15612a735604d76d /pcm.c
parent2516c01cfcc657add063cc1ab667d65c707b211e (diff)
Update tinypcminfo to display format information
Change-Id: I0e6a04da5a4b122a3748b16c7eb01c4a224c3d84 Signed-off-by: Andy Hung <hunga@google.com>
Diffstat (limited to 'pcm.c')
-rw-r--r--pcm.c23
1 files changed, 23 insertions, 0 deletions
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)
{