mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
sink, source: Add API to change channel count
This makes this part symmetrical with the rest of the sample spec, and will be useful when we implement switching channel count in a sink.
This commit is contained in:
parent
f9d139c3bc
commit
4693028b9b
4 changed files with 38 additions and 0 deletions
|
|
@ -4083,6 +4083,24 @@ void pa_sink_set_sample_rate(pa_sink *s, uint32_t rate) {
|
|||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
}
|
||||
|
||||
/* Called from the main thread */
|
||||
void pa_sink_set_channels(pa_sink *s, uint8_t channels) {
|
||||
uint8_t old_channels;
|
||||
|
||||
pa_assert(s);
|
||||
pa_assert(pa_channels_valid(channels));
|
||||
|
||||
old_channels = s->sample_spec.channels;
|
||||
if (old_channels == channels)
|
||||
return;
|
||||
|
||||
pa_log_info("%s: channels: %u -> %u", s->name, old_channels, channels);
|
||||
|
||||
s->sample_spec.channels = channels;
|
||||
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
}
|
||||
|
||||
/* Called from the main thread */
|
||||
void pa_sink_set_channel_map(pa_sink *s, pa_channel_map *map) {
|
||||
pa_channel_map old_map;
|
||||
|
|
|
|||
|
|
@ -529,6 +529,7 @@ pa_idxset* pa_sink_check_formats(pa_sink *s, pa_idxset *in_formats);
|
|||
|
||||
void pa_sink_set_sample_format(pa_sink *s, pa_sample_format_t format);
|
||||
void pa_sink_set_sample_rate(pa_sink *s, uint32_t rate);
|
||||
void pa_sink_set_channels(pa_sink *s, uint8_t channels);
|
||||
void pa_sink_set_channel_map(pa_sink *s, pa_channel_map *map);
|
||||
|
||||
/*** To be called exclusively by the sink driver, from IO context */
|
||||
|
|
|
|||
|
|
@ -3077,6 +3077,24 @@ void pa_source_set_sample_rate(pa_source *s, uint32_t rate) {
|
|||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
}
|
||||
|
||||
/* Called from the main thread */
|
||||
void pa_source_set_channels(pa_source *s, uint8_t channels) {
|
||||
uint8_t old_channels;
|
||||
|
||||
pa_assert(s);
|
||||
pa_assert(pa_channels_valid(channels));
|
||||
|
||||
old_channels = s->sample_spec.channels;
|
||||
if (old_channels == channels)
|
||||
return;
|
||||
|
||||
pa_log_info("%s: channels: %u -> %u", s->name, old_channels, channels);
|
||||
|
||||
s->sample_spec.channels = channels;
|
||||
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
}
|
||||
|
||||
/* Called from the main thread */
|
||||
void pa_source_set_channel_map(pa_source *s, pa_channel_map *map) {
|
||||
pa_channel_map old_map;
|
||||
|
|
|
|||
|
|
@ -450,6 +450,7 @@ pa_idxset* pa_source_check_formats(pa_source *s, pa_idxset *in_formats);
|
|||
|
||||
void pa_source_set_sample_format(pa_source *s, pa_sample_format_t format);
|
||||
void pa_source_set_sample_rate(pa_source *s, uint32_t rate);
|
||||
void pa_source_set_channels(pa_source *s, uint8_t channels);
|
||||
void pa_source_set_channel_map(pa_source *s, pa_channel_map *map);
|
||||
|
||||
/*** To be called exclusively by the source driver, from IO context */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue