mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
source-output: add a new API pa_source_output_set_preferred_source
If the source here is NULL, that means users want to clear the preferred_source and move the source-output to the default_source, otherwise set the preferred_source to the source->name and move the source-output to the source. After that fire the source_output_change event. After adding this API, we can use this API to simplify the entry_apply in the module-stream-restore.c. Signed-off-by: Hui Wang <hui.wang@canonical.com>
This commit is contained in:
parent
5eec504d68
commit
e529db75ec
3 changed files with 18 additions and 8 deletions
|
|
@ -1886,3 +1886,17 @@ void pa_source_output_set_reference_ratio(pa_source_output *o, const pa_cvolume
|
|||
pa_cvolume_snprint_verbose(old_ratio_str, sizeof(old_ratio_str), &old_ratio, &o->channel_map, true),
|
||||
pa_cvolume_snprint_verbose(new_ratio_str, sizeof(new_ratio_str), ratio, &o->channel_map, true));
|
||||
}
|
||||
|
||||
/* Called from the main thread. */
|
||||
void pa_source_output_set_preferred_source(pa_source_output *o, pa_source *s) {
|
||||
pa_assert(o);
|
||||
|
||||
pa_xfree(o->preferred_source);
|
||||
if (s) {
|
||||
o->preferred_source = pa_xstrdup(s->name);
|
||||
pa_source_output_move_to(o, s, false);
|
||||
} else {
|
||||
o->preferred_source = NULL;
|
||||
pa_source_output_move_to(o, o->core->default_source, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue