Source and sink are passed in arguments to set_state_in_io_thread() callbacks. There is optimal to access them directly. --- src/modules/alsa/alsa-sink.c | 6 +++--- src/modules/alsa/alsa-source.c | 6 +++--- src/modules/bluetooth/module-bluez4-device.c | 8 ++++---- src/modules/bluetooth/module-bluez5-device.c | 8 ++++---- src/modules/echo-cancel/module-echo-cancel.c | 2 +- src/modules/module-equalizer-sink.c | 2 +- src/modules/module-esound-sink.c | 4 ++-- src/modules/module-ladspa-sink.c | 2 +- src/modules/module-null-sink.c | 2 +- src/modules/module-pipe-sink.c | 4 ++-- src/modules/module-remap-sink.c | 2 +- src/modules/module-solaris.c | 16 ++++++++-------- src/modules/module-virtual-sink.c | 2 +- src/modules/module-virtual-surround-sink.c | 2 +- src/modules/oss/module-oss.c | 12 ++++++------ src/modules/raop/raop-sink.c | 4 ++-- 16 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index afdf813..5f10546 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1291,7 +1291,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, switch (new_state) { case PA_SINK_SUSPENDED: { - pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); + pa_assert(PA_SINK_IS_OPENED(s->thread_info.state)); suspend(u); @@ -1302,7 +1302,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_RUNNING: { int r; - if (u->sink->thread_info.state == PA_SINK_INIT) { + if (s->thread_info.state == PA_SINK_INIT) { if (build_pollfd(u) < 0) /* FIXME: This will cause an assertion failure, because * with the current design pa_sink_put() is not allowed @@ -1312,7 +1312,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, return -PA_ERR_IO; } - if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { + if (s->thread_info.state == PA_SINK_SUSPENDED) { if ((r = unsuspend(u)) < 0) return r; } diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 73c2a25..d6e9bf0 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -1146,7 +1146,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ switch (new_state) { case PA_SOURCE_SUSPENDED: { - pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state)); + pa_assert(PA_SOURCE_IS_OPENED(s->thread_info.state)); suspend(u); @@ -1157,7 +1157,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_RUNNING: { int r; - if (u->source->thread_info.state == PA_SOURCE_INIT) { + if (s->thread_info.state == PA_SOURCE_INIT) { if (build_pollfd(u) < 0) /* FIXME: This will cause an assertion failure, because * with the current design pa_source_put() is not allowed @@ -1167,7 +1167,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ return -PA_ERR_IO; } - if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) { + if (s->thread_info.state == PA_SOURCE_SUSPENDED) { if ((r = unsuspend(u)) < 0) return r; } diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c index 79d75c1..8759283 100644 --- a/src/modules/bluetooth/module-bluez4-device.c +++ b/src/modules/bluetooth/module-bluez4-device.c @@ -423,7 +423,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_SUSPENDED: /* Ignore if transition is PA_SINK_INIT->PA_SINK_SUSPENDED */ - if (!PA_SINK_IS_OPENED(u->sink->thread_info.state)) + if (!PA_SINK_IS_OPENED(s->thread_info.state)) break; /* Stop the device if the source is suspended as well */ @@ -437,7 +437,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_IDLE: case PA_SINK_RUNNING: - if (u->sink->thread_info.state != PA_SINK_SUSPENDED) + if (s->thread_info.state != PA_SINK_SUSPENDED) break; /* Resume the device if the source was suspended as well */ @@ -497,7 +497,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_SUSPENDED: /* Ignore if transition is PA_SOURCE_INIT->PA_SOURCE_SUSPENDED */ - if (!PA_SOURCE_IS_OPENED(u->source->thread_info.state)) + if (!PA_SOURCE_IS_OPENED(s->thread_info.state)) break; /* Stop the device if the sink is suspended as well */ @@ -510,7 +510,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_IDLE: case PA_SOURCE_RUNNING: - if (u->source->thread_info.state != PA_SOURCE_SUSPENDED) + if (s->thread_info.state != PA_SOURCE_SUSPENDED) break; /* Resume the device if the sink was suspended as well */ diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index c3acc1d..dfae682 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -925,7 +925,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_SUSPENDED: /* Ignore if transition is PA_SOURCE_INIT->PA_SOURCE_SUSPENDED */ - if (!PA_SOURCE_IS_OPENED(u->source->thread_info.state)) + if (!PA_SOURCE_IS_OPENED(s->thread_info.state)) break; /* Stop the device if the sink is suspended as well */ @@ -939,7 +939,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_IDLE: case PA_SOURCE_RUNNING: - if (u->source->thread_info.state != PA_SOURCE_SUSPENDED) + if (s->thread_info.state != PA_SOURCE_SUSPENDED) break; /* Resume the device if the sink was suspended as well */ @@ -1102,7 +1102,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_SUSPENDED: /* Ignore if transition is PA_SINK_INIT->PA_SINK_SUSPENDED */ - if (!PA_SINK_IS_OPENED(u->sink->thread_info.state)) + if (!PA_SINK_IS_OPENED(s->thread_info.state)) break; /* Stop the device if the source is suspended as well */ @@ -1116,7 +1116,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_IDLE: case PA_SINK_RUNNING: - if (u->sink->thread_info.state != PA_SINK_SUSPENDED) + if (s->thread_info.state != PA_SINK_SUSPENDED) break; /* Resume the device if the source was suspended as well */ diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index c8065d8..0f4af44 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -522,7 +522,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, /* When set to running or idle for the first time, request a rewind * of the master sink to make sure we are heard immediately */ - if ((new_state == PA_SINK_IDLE || new_state == PA_SINK_RUNNING) && u->sink->thread_info.state == PA_SINK_INIT) { + if (PA_SINK_IS_OPENED(new_state) && s->thread_info.state == PA_SINK_INIT) { pa_log_debug("Requesting rewind due to state change."); pa_sink_input_request_rewind(u->sink_input, 0, false, true, true); } diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c index 4337599..681f44d 100644 --- a/src/modules/module-equalizer-sink.c +++ b/src/modules/module-equalizer-sink.c @@ -296,7 +296,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, /* When set to running or idle for the first time, request a rewind * of the master sink to make sure we are heard immediately */ - if ((new_state == PA_SINK_IDLE || new_state == PA_SINK_RUNNING) && u->sink->thread_info.state == PA_SINK_INIT) { + if (PA_SINK_IS_OPENED(new_state) && s->thread_info.state == PA_SINK_INIT) { pa_log_debug("Requesting rewind due to state change."); pa_sink_input_request_rewind(u->sink_input, 0, false, true, true); } diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c index 3f6b811..5ff0451 100644 --- a/src/modules/module-esound-sink.c +++ b/src/modules/module-esound-sink.c @@ -183,7 +183,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, switch (new_state) { case PA_SINK_SUSPENDED: - pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); + pa_assert(PA_SINK_IS_OPENED(s->thread_info.state)); pa_smoother_pause(u->smoother, pa_rtclock_now()); break; @@ -191,7 +191,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_IDLE: case PA_SINK_RUNNING: - if (u->sink->thread_info.state == PA_SINK_SUSPENDED) + if (s->thread_info.state == PA_SINK_SUSPENDED) pa_smoother_resume(u->smoother, pa_rtclock_now(), true); break; diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index d677381..c30c7b2 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -403,7 +403,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, /* When set to running or idle for the first time, request a rewind * of the master sink to make sure we are heard immediately */ - if ((new_state == PA_SINK_IDLE || new_state == PA_SINK_RUNNING) && u->sink->thread_info.state == PA_SINK_INIT) { + if (PA_SINK_IS_OPENED(new_state) && s->thread_info.state == PA_SINK_INIT) { pa_log_debug("Requesting rewind due to state change."); pa_sink_input_request_rewind(u->sink_input, 0, false, true, true); } diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c index baaf064..6cbe588 100644 --- a/src/modules/module-null-sink.c +++ b/src/modules/module-null-sink.c @@ -109,7 +109,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, pa_assert(s); pa_assert_se(u = s->userdata); - if (u->sink->thread_info.state == PA_SINK_SUSPENDED || u->sink->thread_info.state == PA_SINK_INIT) { + if (s->thread_info.state == PA_SINK_SUSPENDED || s->thread_info.state == PA_SINK_INIT) { if (PA_SINK_IS_OPENED(new_state)) u->timestamp = pa_rtclock_now(); } diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c index fc01206..765e751 100644 --- a/src/modules/module-pipe-sink.c +++ b/src/modules/module-pipe-sink.c @@ -142,10 +142,10 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, pa_assert(s); pa_assert_se(u = s->userdata); - if (u->sink->thread_info.state == PA_SINK_SUSPENDED || u->sink->thread_info.state == PA_SINK_INIT) { + if (s->thread_info.state == PA_SINK_SUSPENDED || s->thread_info.state == PA_SINK_INIT) { if (PA_SINK_IS_OPENED(new_state)) u->timestamp = pa_rtclock_now(); - } else if (u->sink->thread_info.state == PA_SINK_RUNNING || u->sink->thread_info.state == PA_SINK_IDLE) { + } else if (PA_SINK_IS_OPENED(s->thread_info.state)) { if (new_state == PA_SINK_SUSPENDED) { /* Clear potential FIFO error flag */ u->fifo_error = false; diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c index f53b6b1..503fcf5 100644 --- a/src/modules/module-remap-sink.c +++ b/src/modules/module-remap-sink.c @@ -123,7 +123,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, /* When set to running or idle for the first time, request a rewind * of the master sink to make sure we are heard immediately */ - if ((new_state == PA_SINK_IDLE || new_state == PA_SINK_RUNNING) && u->sink->thread_info.state == PA_SINK_INIT) { + if (PA_SINK_IS_OPENED(new_state) && s->thread_info.state == PA_SINK_INIT) { pa_log_debug("Requesting rewind due to state change."); pa_sink_input_request_rewind(u->sink_input, 0, false, true, true); } diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index ef42b3d..240ed85 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -411,7 +411,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_SUSPENDED: - pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); + pa_assert(PA_SINK_IS_OPENED(s->thread_info.state)); pa_smoother_pause(u->smoother, pa_rtclock_now()); @@ -424,16 +424,16 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_IDLE: case PA_SINK_RUNNING: - if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { + if (s->thread_info.state == PA_SINK_SUSPENDED) { pa_smoother_resume(u->smoother, pa_rtclock_now(), true); if (!u->source || u->source_suspended) { bool mute; if (unsuspend(u) < 0) return -1; - u->sink->get_volume(u->sink); - if (u->sink->get_mute(u->sink, &mute) >= 0) - pa_sink_set_mute(u->sink, mute, false); + s->get_volume(s); + if (s->get_mute(s, &mute) >= 0) + pa_sink_set_mute(s, mute, false); } u->sink_suspended = false; } @@ -477,7 +477,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_SUSPENDED: - pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state)); + pa_assert(PA_SOURCE_IS_OPENED(s->thread_info.state)); if (!u->sink || u->sink_suspended) suspend(u); @@ -488,11 +488,11 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_IDLE: case PA_SOURCE_RUNNING: - if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) { + if (s->thread_info.state == PA_SOURCE_SUSPENDED) { if (!u->sink || u->sink_suspended) { if (unsuspend(u) < 0) return -1; - u->source->get_volume(u->source); + s->get_volume(s); } u->source_suspended = false; } diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c index e134552..3a81822 100644 --- a/src/modules/module-virtual-sink.c +++ b/src/modules/module-virtual-sink.c @@ -135,7 +135,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, /* When set to running or idle for the first time, request a rewind * of the master sink to make sure we are heard immediately */ - if ((new_state == PA_SINK_IDLE || new_state == PA_SINK_RUNNING) && u->sink->thread_info.state == PA_SINK_INIT) { + if (PA_SINK_IS_OPENED(new_state) && s->thread_info.state == PA_SINK_INIT) { pa_log_debug("Requesting rewind due to state change."); pa_sink_input_request_rewind(u->sink_input, 0, false, true, true); } diff --git a/src/modules/module-virtual-surround-sink.c b/src/modules/module-virtual-surround-sink.c index 2c3d54b..f14f137 100644 --- a/src/modules/module-virtual-surround-sink.c +++ b/src/modules/module-virtual-surround-sink.c @@ -163,7 +163,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, /* When set to running or idle for the first time, request a rewind * of the master sink to make sure we are heard immediately */ - if ((new_state == PA_SINK_IDLE || new_state == PA_SINK_RUNNING) && u->sink->thread_info.state == PA_SINK_INIT) { + if (PA_SINK_IS_OPENED(new_state) && s->thread_info.state == PA_SINK_INIT) { pa_log_debug("Requesting rewind due to state change."); pa_sink_input_request_rewind(u->sink_input, 0, false, true, true); } diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c index 42a6e3b..6a70f9a 100644 --- a/src/modules/oss/module-oss.c +++ b/src/modules/oss/module-oss.c @@ -682,7 +682,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, switch (new_state) { case PA_SINK_SUSPENDED: - pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); + pa_assert(PA_SINK_IS_OPENED(s->thread_info.state)); if (!u->source || u->source_suspended) suspend(u); @@ -695,12 +695,12 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_IDLE: case PA_SINK_RUNNING: - if (u->sink->thread_info.state == PA_SINK_INIT) { + if (s->thread_info.state == PA_SINK_INIT) { do_trigger = true; quick = u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state); } - if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { + if (s->thread_info.state == PA_SINK_SUSPENDED) { if (!u->source || u->source_suspended) { if (unsuspend(u) < 0) @@ -770,7 +770,7 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ switch (new_state) { case PA_SOURCE_SUSPENDED: - pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state)); + pa_assert(PA_SOURCE_IS_OPENED(s->thread_info.state)); if (!u->sink || u->sink_suspended) suspend(u); @@ -783,12 +783,12 @@ static int source_set_state_in_io_thread_cb(pa_source *s, pa_source_state_t new_ case PA_SOURCE_IDLE: case PA_SOURCE_RUNNING: - if (u->source->thread_info.state == PA_SOURCE_INIT) { + if (s->thread_info.state == PA_SOURCE_INIT) { do_trigger = true; quick = u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state); } - if (u->source->thread_info.state == PA_SOURCE_SUSPENDED) { + if (s->thread_info.state == PA_SOURCE_SUSPENDED) { if (!u->sink || u->sink_suspended) { if (unsuspend(u) < 0) diff --git a/src/modules/raop/raop-sink.c b/src/modules/raop/raop-sink.c index 818cdfe..ec6f826 100644 --- a/src/modules/raop/raop-sink.c +++ b/src/modules/raop/raop-sink.c @@ -236,7 +236,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, case PA_SINK_SUSPENDED: pa_log_debug("RAOP: SUSPENDED"); - pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); + pa_assert(PA_SINK_IS_OPENED(s->thread_info.state)); /* Issue a TEARDOWN if we are still connected */ if (pa_raop_client_is_alive(u->raop)) { @@ -249,7 +249,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, pa_log_debug("RAOP: IDLE"); /* Issue a FLUSH if we're comming from running state */ - if (u->sink->thread_info.state == PA_SINK_RUNNING) { + if (s->thread_info.state == PA_SINK_RUNNING) { pa_rtpoll_set_timer_disabled(u->rtpoll); pa_raop_client_flush(u->raop); } -- 1.8.3.1