mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
core-format: Add pa_format_info_get_channels()
This also fixes an issue in pa_format_info_to_sample_spec(): it did no validation for the channels value. Now the validation is taken care of in pa_format_info_get_channels().
This commit is contained in:
parent
85a3f560d1
commit
066dd942aa
3 changed files with 27 additions and 4 deletions
|
|
@ -219,7 +219,6 @@ pa_format_info* pa_format_info_from_sample_spec(pa_sample_spec *ss, pa_channel_m
|
|||
/* For PCM streams */
|
||||
int pa_format_info_to_sample_spec(pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map) {
|
||||
char *m = NULL;
|
||||
int channels;
|
||||
int ret = -PA_ERR_INVALID;
|
||||
|
||||
pa_assert(f);
|
||||
|
|
@ -232,11 +231,9 @@ int pa_format_info_to_sample_spec(pa_format_info *f, pa_sample_spec *ss, pa_chan
|
|||
goto out;
|
||||
if (pa_format_info_get_rate(f, &ss->rate) < 0)
|
||||
goto out;
|
||||
if (pa_format_info_get_prop_int(f, PA_PROP_FORMAT_CHANNELS, &channels))
|
||||
if (pa_format_info_get_channels(f, &ss->channels) < 0)
|
||||
goto out;
|
||||
|
||||
ss->channels = (uint8_t) channels;
|
||||
|
||||
if (map) {
|
||||
pa_channel_map_init(map);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue