mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-15 06:59:58 -05:00
core-format: Add pa_format_info_get_channel_map()
This commit is contained in:
parent
066dd942aa
commit
3a5a0f6652
3 changed files with 29 additions and 12 deletions
|
|
@ -95,6 +95,28 @@ int pa_format_info_get_channels(pa_format_info *f, uint8_t *channels) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int pa_format_info_get_channel_map(pa_format_info *f, pa_channel_map *map) {
|
||||
int r;
|
||||
char *map_str;
|
||||
|
||||
pa_assert(f);
|
||||
pa_assert(map);
|
||||
|
||||
r = pa_format_info_get_prop_string(f, PA_PROP_FORMAT_CHANNEL_MAP, &map_str);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
map = pa_channel_map_parse(map, map_str);
|
||||
pa_xfree(map_str);
|
||||
|
||||
if (!map) {
|
||||
pa_log_debug("Failed to parse channel map.");
|
||||
return -PA_ERR_INVALID;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pa_format_info_to_sample_spec_fake(pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map) {
|
||||
int rate;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ int pa_format_info_get_rate(pa_format_info *f, uint32_t *rate);
|
|||
* -PA_ERR_NOENTITY. */
|
||||
int pa_format_info_get_channels(pa_format_info *f, uint8_t *channels);
|
||||
|
||||
/* Gets the channel map stored in the format info. Returns a negative error
|
||||
* code on failure. If the channel map property is not set at all, returns
|
||||
* -PA_ERR_NOENTITY. */
|
||||
int pa_format_info_get_channel_map(pa_format_info *f, pa_channel_map *map);
|
||||
|
||||
/* For compressed formats. Converts the format info into a sample spec and a
|
||||
* channel map that an ALSA device can use as its configuration parameters when
|
||||
* playing back the compressed data. That is, the returned sample spec doesn't
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue