From 43544884f44313176621f57b370b4ba114fe5b8c Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Wed, 31 Oct 2012 12:52:39 -0700 Subject: pcm: add pcm_get_params API This enables the capabilities of any given PCM to be queried. Created with input from Priyesh Bisla and Gabriel Beddingfield. --- include/tinyalsa/asoundlib.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include') diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index bdb4b7a..a4ebec8 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -98,6 +98,23 @@ struct pcm_config { unsigned int silence_threshold; }; +/* PCM parameters */ +enum pcm_param +{ + PCM_PARAM_SAMPLE_BITS, + PCM_PARAM_FRAME_BITS, + PCM_PARAM_CHANNELS, + PCM_PARAM_RATE, + PCM_PARAM_PERIOD_TIME, + PCM_PARAM_PERIOD_SIZE, + PCM_PARAM_PERIOD_BYTES, + PCM_PARAM_PERIODS, + PCM_PARAM_BUFFER_TIME, + PCM_PARAM_BUFFER_SIZE, + PCM_PARAM_BUFFER_BYTES, + PCM_PARAM_TICK_TIME, +}; + /* Mixer control types */ enum mixer_ctl_type { MIXER_CTL_TYPE_BOOL, @@ -117,6 +134,15 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, int pcm_close(struct pcm *pcm); int pcm_is_ready(struct pcm *pcm); +/* Obtain the parameters for a PCM */ +struct pcm_params *pcm_params_get(unsigned int card, unsigned int device, + unsigned int flags); +void pcm_params_free(struct pcm_params *pcm_params); +unsigned int pcm_params_get_min(struct pcm_params *pcm_params, + enum pcm_param param); +unsigned int pcm_params_get_max(struct pcm_params *pcm_params, + enum pcm_param param); + /* Set and get config */ int pcm_get_config(struct pcm *pcm, struct pcm_config *config); int pcm_set_config(struct pcm *pcm, struct pcm_config *config); -- cgit v1.2.3