sink-input, source-output: Add hooks for preferred device changes

The hooks are fired when the preferred device changes. This is useful
for module-stream-restore.

I added new set_preferred_sink/source() functions for firing the hooks.
The functions also log the preferred device changes.

There was already pa_sink_input_set_preferred_sink(), but that had a
side effect of moving the stream, so I needed a new function. Since it
can be confusing when the two similarly named functions should be
called, I added a comment for pa_sink_input_set_preferred_sink() that
explains the different situations.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/535>
This commit is contained in:
Tanu Kaskinen 2021-04-05 17:13:27 +03:00 committed by PulseAudio Marge Bot
parent 1f204a1357
commit 737ebcdfdb
3 changed files with 72 additions and 14 deletions

View file

@ -104,6 +104,7 @@ typedef enum pa_core_hook {
PA_CORE_HOOK_SINK_INPUT_PROPLIST_CHANGED,
PA_CORE_HOOK_SINK_INPUT_VOLUME_CHANGED,
PA_CORE_HOOK_SINK_INPUT_MUTE_CHANGED,
PA_CORE_HOOK_SINK_INPUT_PREFERRED_SINK_CHANGED,
PA_CORE_HOOK_SINK_INPUT_SEND_EVENT,
PA_CORE_HOOK_SOURCE_OUTPUT_NEW,
PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE,
@ -117,6 +118,7 @@ typedef enum pa_core_hook {
PA_CORE_HOOK_SOURCE_OUTPUT_PROPLIST_CHANGED,
PA_CORE_HOOK_SOURCE_OUTPUT_VOLUME_CHANGED,
PA_CORE_HOOK_SOURCE_OUTPUT_MUTE_CHANGED,
PA_CORE_HOOK_SOURCE_OUTPUT_PREFERRED_SOURCE_CHANGED,
PA_CORE_HOOK_SOURCE_OUTPUT_SEND_EVENT,
PA_CORE_HOOK_CLIENT_NEW,
PA_CORE_HOOK_CLIENT_PUT,