mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
Added snd_pcm_get_format_name() to alsa-lib.
This commit is contained in:
parent
a3b8114c84
commit
d33c93096a
2 changed files with 37 additions and 0 deletions
|
|
@ -57,6 +57,7 @@ int snd_pcm_format_little_endian(int format);
|
||||||
int snd_pcm_format_big_endian(int format);
|
int snd_pcm_format_big_endian(int format);
|
||||||
int snd_pcm_format_width(int format); /* in bits */
|
int snd_pcm_format_width(int format); /* in bits */
|
||||||
ssize_t snd_pcm_format_size(int format, size_t samples);
|
ssize_t snd_pcm_format_size(int format, size_t samples);
|
||||||
|
const char *snd_pcm_get_format_name(int format);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -191,3 +191,39 @@ ssize_t snd_pcm_format_size(int format, size_t samples)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *snd_pcm_get_format_name(int format)
|
||||||
|
{
|
||||||
|
static char *formats[] = {
|
||||||
|
"Signed 8-bit",
|
||||||
|
"Unsigned 8-bit",
|
||||||
|
"Signed 16-bit Little Endian",
|
||||||
|
"Signed 16-bit Big Endian",
|
||||||
|
"Unsigned 16-bit Little Endian",
|
||||||
|
"Unsigned 16-bit Big Endian",
|
||||||
|
"Signed 24-bit Little Endian",
|
||||||
|
"Signed 24-bit Big Endian",
|
||||||
|
"Unsigned 24-bit Little Endian",
|
||||||
|
"Unsigned 24-bit Big Endian",
|
||||||
|
"Signed 32-bit Little Endian",
|
||||||
|
"Signed 32-bit Big Endian",
|
||||||
|
"Unsigned 32-bit Little Endian",
|
||||||
|
"Unsigned 32-bit Big Endian",
|
||||||
|
"Float Little Endian",
|
||||||
|
"Float Big Endian",
|
||||||
|
"Float64 Little Endian",
|
||||||
|
"Float64 Big Endian",
|
||||||
|
"IEC-958 Little Endian",
|
||||||
|
"IEC-958 Big Endian",
|
||||||
|
"Mu-Law",
|
||||||
|
"A-Law",
|
||||||
|
"Ima-ADPCM",
|
||||||
|
"MPEG",
|
||||||
|
"GSM"
|
||||||
|
};
|
||||||
|
if (format == SND_PCM_SFMT_SPECIAL)
|
||||||
|
return "Special";
|
||||||
|
if (format < 0 || format > SND_PCM_SFMT_GSM)
|
||||||
|
return "Unknown";
|
||||||
|
return formats[format];
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue