pass pa_suspend_cause_t to set_state() callbacks

The suspend cause isn't yet used by any of the callbacks. The alsa sink
and source will use it to sync the mixer when the SESSION suspend cause
is removed. Currently the syncing is done in pa_sink/source_suspend(),
and I want to change that, because pa_sink/source_suspend() shouldn't
have any alsa specific code.
This commit is contained in:
Tanu Kaskinen 2018-02-19 16:48:23 +02:00
parent 3da0de5418
commit 6ed37aeef2
17 changed files with 58 additions and 27 deletions

View file

@ -568,11 +568,16 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
}
/* Called from main context */
static int sink_set_state(pa_sink *s, pa_sink_state_t state) {
static int sink_set_state(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
u = s->userdata;
/* It may be that only the suspend cause is changing, in which
* case there's nothing to do. */
if (state == s->state)
return 0;
switch ((pa_sink_state_t) state) {
case PA_SINK_SUSPENDED:
@ -665,11 +670,16 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
}
/* Called from main context */
static int source_set_state(pa_source *s, pa_source_state_t state) {
static int source_set_state(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);
u = s->userdata;
/* It may be that only the suspend cause is changing, in which
* case there's nothing to do. */
if (state == s->state)
return 0;
switch ((pa_source_state_t) state) {
case PA_SOURCE_SUSPENDED: