[alsa-devel] [PATCH v2 1/2] ALSA: Add params_set_format helper

yang.a.fang at intel.com yang.a.fang at intel.com
Mon Feb 9 01:01:36 CET 2015


From: "Fang, Yang A" <yang.a.fang at intel.com>

Add a helper to set pcm format directly from params

Signed-off-by: Fang, Yang A <yang.a.fang at intel.com>
---
 include/sound/pcm_params.h |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 6b1c78f..e6fe584 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -366,4 +366,11 @@ params_physical_width(const struct snd_pcm_hw_params *p)
 	return snd_pcm_format_physical_width(params_format(p));
 }
 
+static inline void
+params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt)
+{
+	snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
+		SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);
+}
+
 #endif /* __SOUND_PCM_PARAMS_H */
-- 
1.7.9.5



More information about the Alsa-devel mailing list