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

@ -1232,7 +1232,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
}
/* Called from main context */
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t new_state) {
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
pa_sink_state_t old_state;
struct userdata *u;

View file

@ -1087,7 +1087,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
}
/* Called from main context */
static int source_set_state_cb(pa_source *s, pa_source_state_t new_state) {
static int source_set_state_cb(pa_source *s, pa_source_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
pa_source_state_t old_state;
struct userdata *u;

View file

@ -477,7 +477,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
}
/* Called from main context */
static int source_set_state_cb(pa_source *s, pa_source_state_t state) {
static int source_set_state_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);
@ -502,7 +502,7 @@ static int source_set_state_cb(pa_source *s, pa_source_state_t state) {
}
/* Called from main context */
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);

View file

@ -353,7 +353,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
return pa_source_process_msg(o, code, data, offset, chunk);;
}
static int ca_sink_set_state(pa_sink *s, pa_sink_state_t state) {
static int ca_sink_set_state(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
coreaudio_sink *sink = s->userdata;
switch (state) {
@ -511,7 +511,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx
return 0;
}
static int ca_source_set_state(pa_source *s, pa_source_state_t state) {
static int ca_source_set_state(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
coreaudio_source *source = s->userdata;
switch (state) {

View file

@ -680,12 +680,17 @@ static void unsuspend(struct userdata *u) {
}
/* Called from main context */
static int sink_set_state(pa_sink *sink, pa_sink_state_t state) {
static int sink_set_state(pa_sink *sink, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(sink);
pa_assert_se(u = sink->userdata);
/* It may be that only the suspend cause is changing, in which
* case there's nothing to do. */
if (state == u->sink->state)
return 0;
/* Please note that in contrast to the ALSA modules we call
* suspend/unsuspend from main context here! */

View file

@ -285,7 +285,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
}
/* Called from main context */
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);

View file

@ -392,7 +392,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
}
/* Called from main context */
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);

View file

@ -112,7 +112,7 @@ 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);

View file

@ -108,7 +108,7 @@ static int source_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t
}
/* Called from main context */
static int source_set_state_cb(pa_source *s, pa_source_state_t state) {
static int source_set_state_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);

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:

View file

@ -124,7 +124,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
}
/* Called from main context */
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);

View file

@ -111,7 +111,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
}
/* Called from main context */
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);
@ -194,7 +194,7 @@ static int source_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t
}
/* Called from main context */
static int source_set_state_cb(pa_source *s, pa_source_state_t state) {
static int source_set_state_cb(pa_source *s, pa_source_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_source_assert_ref(s);

View file

@ -152,7 +152,7 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
}
/* Called from main context */
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) {
static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state, pa_suspend_cause_t suspend_cause) {
struct userdata *u;
pa_sink_assert_ref(s);