mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -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
|
|
@ -1905,17 +1905,11 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) {
|
|||
/* If the device is not valid we should make sure the
|
||||
preferred_source is cleared as the user may have specifically
|
||||
removed the source element from the rule. */
|
||||
pa_xfree(so->preferred_source);
|
||||
so->preferred_source = NULL;
|
||||
/* This is cheating a bit. The source output itself has not changed
|
||||
but the rules governing its routing have, so we fire this event
|
||||
such that other routing modules (e.g. module-device-manager)
|
||||
will pick up the change and reapply their routing */
|
||||
pa_subscription_post(so->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_CHANGE, so->index);
|
||||
pa_source_output_set_preferred_source(so, NULL);
|
||||
}
|
||||
} else if ((s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) {
|
||||
pa_log_info("Restoring device for stream %s.", name);
|
||||
pa_source_output_move_to(so, s, true);
|
||||
pa_source_output_set_preferred_source(so, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue