mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
pcm: Introduce snd_pcm_subformat_value()
Allow userspace applications to select subformats easily just like in snd_pcm_format_t case - by string conversion. Closes: https://github.com/alsa-project/alsa-lib/pull/342 Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
ed6b07084b
commit
f33284e85e
2 changed files with 27 additions and 0 deletions
|
|
@ -2197,6 +2197,30 @@ const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat)
|
|||
return snd_pcm_subformat_descriptions[subformat];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get PCM sample subformat from name
|
||||
* \param name PCM sample subformat name (case insensitive)
|
||||
* \return PCM sample subformat
|
||||
*/
|
||||
snd_pcm_subformat_t snd_pcm_subformat_value(const char* name)
|
||||
{
|
||||
snd_pcm_subformat_t subformat;
|
||||
|
||||
for (subformat = 0; subformat <= SND_PCM_SUBFORMAT_LAST; subformat++) {
|
||||
if (snd_pcm_subformat_names[subformat] &&
|
||||
!strcasecmp(name, snd_pcm_subformat_names[subformat]))
|
||||
return subformat;
|
||||
}
|
||||
|
||||
for (subformat = 0; subformat <= SND_PCM_SUBFORMAT_LAST; subformat++) {
|
||||
if (snd_pcm_subformat_descriptions[subformat] &&
|
||||
!strcasecmp(name, snd_pcm_subformat_descriptions[subformat]))
|
||||
return subformat;
|
||||
}
|
||||
|
||||
return SND_PCM_SUBFORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief (DEPRECATED) get name of PCM start mode setting
|
||||
* \param mode PCM start mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue