sink, source: remove the state getters

pa_sink_get_state() and pa_source_get_state() just return the state
variable. We can as well access the state variable directly.

There are no behaviour changes, except that module-virtual-source
accessed the main thread's sink state variable from its push() callback.
I fixed the module so that it uses the thread_info.state variable
instead. Also, the compiler started to complain about comparing a sink
state variable to a source state enum value in protocol-esound.c. The
underlying bug was that a source pointer was assigned to a variable
whose type was a sink pointer (somehow using the pa_source_get_state()
macro confused the compiler enough so that it didn't complain before).
I fixed the variable type.
This commit is contained in:
Tanu Kaskinen 2018-06-26 16:25:58 +03:00
parent b4a36453da
commit 6665b466d2
26 changed files with 82 additions and 87 deletions

View file

@ -1256,7 +1256,7 @@ static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t new_stat
&& !(new_suspend_cause & PA_SUSPEND_SESSION)) && !(new_suspend_cause & PA_SUSPEND_SESSION))
sync_mixer(u, s->active_port); sync_mixer(u, s->active_port);
old_state = pa_sink_get_state(u->sink); old_state = u->sink->state;
if (PA_SINK_IS_OPENED(old_state) && new_state == PA_SINK_SUSPENDED) if (PA_SINK_IS_OPENED(old_state) && new_state == PA_SINK_SUSPENDED)
reserve_done(u); reserve_done(u);

View file

@ -1111,7 +1111,7 @@ static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t ne
&& !(new_suspend_cause & PA_SUSPEND_SESSION)) && !(new_suspend_cause & PA_SUSPEND_SESSION))
sync_mixer(u, s->active_port); sync_mixer(u, s->active_port);
old_state = pa_source_get_state(u->source); old_state = u->source->state;
if (PA_SOURCE_IS_OPENED(old_state) && new_state == PA_SOURCE_SUSPENDED) if (PA_SOURCE_IS_OPENED(old_state) && new_state == PA_SOURCE_SUSPENDED)
reserve_done(u); reserve_done(u);

View file

@ -849,7 +849,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
latency = pa_sink_get_latency(d->sink); latency = pa_sink_get_latency(d->sink);
is_hardware_device = !!(d->sink->flags & PA_SINK_HARDWARE); is_hardware_device = !!(d->sink->flags & PA_SINK_HARDWARE);
is_network_device = !!(d->sink->flags & PA_SINK_NETWORK); is_network_device = !!(d->sink->flags & PA_SINK_NETWORK);
state = pa_sink_get_state(d->sink); state = d->sink->state;
} else { } else {
idx = d->source->index; idx = d->source->index;
name = d->source->name; name = d->source->name;
@ -870,7 +870,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
latency = pa_source_get_latency(d->source); latency = pa_source_get_latency(d->source);
is_hardware_device = !!(d->source->flags & PA_SOURCE_HARDWARE); is_hardware_device = !!(d->source->flags & PA_SOURCE_HARDWARE);
is_network_device = !!(d->source->flags & PA_SOURCE_NETWORK); is_network_device = !!(d->source->flags & PA_SOURCE_NETWORK);
state = pa_source_get_state(d->source); state = d->source->state;
} }
if (owner_module) if (owner_module)
owner_module_path = pa_dbusiface_core_get_module_path(d->core, owner_module); owner_module_path = pa_dbusiface_core_get_module_path(d->core, owner_module);
@ -1158,9 +1158,9 @@ static pa_hook_result_t state_changed_cb(void *hook_data, void *call_data, void
return PA_HOOK_OK; return PA_HOOK_OK;
if (d->type == PA_DEVICE_TYPE_SINK) if (d->type == PA_DEVICE_TYPE_SINK)
new_sink_state = pa_sink_get_state(d->sink); new_sink_state = d->sink->state;
else else
new_source_state = pa_source_get_state(d->source); new_source_state = d->source->state;
if ((d->type == PA_DEVICE_TYPE_SINK && d->sink_state != new_sink_state) if ((d->type == PA_DEVICE_TYPE_SINK && d->sink_state != new_sink_state)
|| (d->type == PA_DEVICE_TYPE_SOURCE && d->source_state != new_source_state)) { || (d->type == PA_DEVICE_TYPE_SOURCE && d->source_state != new_source_state)) {
@ -1258,7 +1258,7 @@ pa_dbusiface_device *pa_dbusiface_device_new_sink(pa_dbusiface_core *core, pa_si
d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SINK_OBJECT_NAME, sink->index); d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SINK_OBJECT_NAME, sink->index);
d->volume = *pa_sink_get_volume(sink, false); d->volume = *pa_sink_get_volume(sink, false);
d->mute = pa_sink_get_mute(sink, false); d->mute = pa_sink_get_mute(sink, false);
d->sink_state = pa_sink_get_state(sink); d->sink_state = sink->state;
d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free); d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free);
d->next_port_index = 0; d->next_port_index = 0;
d->active_port = sink->active_port; d->active_port = sink->active_port;
@ -1301,7 +1301,7 @@ pa_dbusiface_device *pa_dbusiface_device_new_source(pa_dbusiface_core *core, pa_
d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SOURCE_OBJECT_NAME, source->index); d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SOURCE_OBJECT_NAME, source->index);
d->volume = *pa_source_get_volume(source, false); d->volume = *pa_source_get_volume(source, false);
d->mute = pa_source_get_mute(source, false); d->mute = pa_source_get_mute(source, false);
d->source_state = pa_source_get_state(source); d->source_state = source->state;
d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free); d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free);
d->next_port_index = 0; d->next_port_index = 0;
d->active_port = source->active_port; d->active_port = source->active_port;

View file

@ -146,8 +146,8 @@ static const pa_echo_canceller ec_table[] = {
#define MAX_LATENCY_BLOCKS 10 #define MAX_LATENCY_BLOCKS 10
/* Can only be used in main context */ /* Can only be used in main context */
#define IS_ACTIVE(u) ((pa_source_get_state((u)->source) == PA_SOURCE_RUNNING) && \ #define IS_ACTIVE(u) (((u)->source->state == PA_SOURCE_RUNNING) && \
(pa_sink_get_state((u)->sink) == PA_SINK_RUNNING)) ((u)->sink->state == PA_SINK_RUNNING))
/* This module creates a new (virtual) source and sink. /* This module creates a new (virtual) source and sink.
* *
@ -476,7 +476,7 @@ static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t st
if (state == PA_SOURCE_RUNNING) { if (state == PA_SOURCE_RUNNING) {
/* restart timer when both sink and source are active */ /* restart timer when both sink and source are active */
if ((pa_sink_get_state(u->sink) == PA_SINK_RUNNING) && u->adjust_time) if ((u->sink->state == PA_SINK_RUNNING) && u->adjust_time)
pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time); pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
pa_atomic_store(&u->request_resync, 1); pa_atomic_store(&u->request_resync, 1);
@ -501,7 +501,7 @@ static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, p
if (state == PA_SINK_RUNNING) { if (state == PA_SINK_RUNNING) {
/* restart timer when both sink and source are active */ /* restart timer when both sink and source are active */
if ((pa_source_get_state(u->source) == PA_SOURCE_RUNNING) && u->adjust_time) if ((u->source->state == PA_SOURCE_RUNNING) && u->adjust_time)
pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time); pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
pa_atomic_store(&u->request_resync, 1); pa_atomic_store(&u->request_resync, 1);
@ -597,7 +597,7 @@ static void source_set_volume_cb(pa_source *s) {
pa_source_assert_ref(s); pa_source_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) || if (!PA_SOURCE_IS_LINKED(s->state) ||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state)) !PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
return; return;
@ -611,7 +611,7 @@ static void sink_set_volume_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;
@ -626,7 +626,7 @@ static void source_get_volume_cb(pa_source *s) {
pa_source_assert_ref(s); pa_source_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) || if (!PA_SOURCE_IS_LINKED(s->state) ||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state)) !PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
return; return;
@ -647,7 +647,7 @@ static void source_set_mute_cb(pa_source *s) {
pa_source_assert_ref(s); pa_source_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) || if (!PA_SOURCE_IS_LINKED(s->state) ||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state)) !PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
return; return;
@ -661,7 +661,7 @@ static void sink_set_mute_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;

View file

@ -194,13 +194,13 @@ static void adjust_rates(struct userdata *u) {
if (pa_idxset_size(u->outputs) <= 0) if (pa_idxset_size(u->outputs) <= 0)
return; return;
if (!PA_SINK_IS_OPENED(pa_sink_get_state(u->sink))) if (!PA_SINK_IS_OPENED(u->sink->state))
return; return;
PA_IDXSET_FOREACH(o, u->outputs, idx) { PA_IDXSET_FOREACH(o, u->outputs, idx) {
pa_usec_t sink_latency; pa_usec_t sink_latency;
if (!o->sink_input || !PA_SINK_IS_OPENED(pa_sink_get_state(o->sink))) if (!o->sink_input || !PA_SINK_IS_OPENED(o->sink->state))
continue; continue;
o->total_latency = pa_sink_input_get_latency(o->sink_input, &sink_latency); o->total_latency = pa_sink_input_get_latency(o->sink_input, &sink_latency);
@ -237,7 +237,7 @@ static void adjust_rates(struct userdata *u) {
uint32_t new_rate = base_rate; uint32_t new_rate = base_rate;
uint32_t current_rate; uint32_t current_rate;
if (!o->sink_input || !PA_SINK_IS_OPENED(pa_sink_get_state(o->sink))) if (!o->sink_input || !PA_SINK_IS_OPENED(o->sink->state))
continue; continue;
current_rate = o->sink_input->sample_spec.rate; current_rate = o->sink_input->sample_spec.rate;
@ -273,7 +273,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
adjust_rates(u); adjust_rates(u);
if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED) { if (u->sink->state == PA_SINK_SUSPENDED) {
u->core->mainloop->time_free(e); u->core->mainloop->time_free(e);
u->time_event = NULL; u->time_event = NULL;
} else } else
@ -697,7 +697,7 @@ static int sink_set_state_in_main_thread_cb(pa_sink *sink, pa_sink_state_t state
switch (state) { switch (state) {
case PA_SINK_SUSPENDED: case PA_SINK_SUSPENDED:
pa_assert(PA_SINK_IS_OPENED(pa_sink_get_state(u->sink))); pa_assert(PA_SINK_IS_OPENED(u->sink->state));
suspend(u); suspend(u);
break; break;
@ -705,7 +705,7 @@ static int sink_set_state_in_main_thread_cb(pa_sink *sink, pa_sink_state_t state
case PA_SINK_IDLE: case PA_SINK_IDLE:
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED) if (u->sink->state == PA_SINK_SUSPENDED)
unsuspend(u); unsuspend(u);
break; break;
@ -1126,7 +1126,7 @@ static void output_enable(struct output *o) {
if (output_create_sink_input(o) >= 0) { if (output_create_sink_input(o) >= 0) {
if (pa_sink_get_state(o->sink) != PA_SINK_INIT) { if (o->sink->state != PA_SINK_INIT) {
/* Enable the sink input. That means that the sink /* Enable the sink input. That means that the sink
* is now asked for new data. */ * is now asked for new data. */
pa_sink_input_put(o->sink_input); pa_sink_input_put(o->sink_input);
@ -1162,7 +1162,7 @@ static void output_disable(struct output *o) {
static void output_verify(struct output *o) { static void output_verify(struct output *o) {
pa_assert(o); pa_assert(o);
if (PA_SINK_IS_OPENED(pa_sink_get_state(o->userdata->sink))) if (PA_SINK_IS_OPENED(o->userdata->sink->state))
output_enable(o); output_enable(o);
else else
output_disable(o); output_disable(o);

View file

@ -343,7 +343,7 @@ static void sink_set_volume_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;
@ -357,7 +357,7 @@ static void sink_set_mute_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;

View file

@ -99,7 +99,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
if (s == c->default_sink) if (s == c->default_sink)
continue; continue;
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s))) if (!PA_SINK_IS_LINKED(s->state))
continue; continue;
if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false, false)) if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false, false))
@ -147,7 +147,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
if (s == c->default_source) if (s == c->default_source)
continue; continue;
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s))) if (!PA_SOURCE_IS_LINKED(s->state))
continue; continue;
/* @todo: favour the highest priority device, not the first one we find? */ /* @todo: favour the highest priority device, not the first one we find? */
@ -293,7 +293,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
if (d == c->default_sink || d == sink) if (d == c->default_sink || d == sink)
continue; continue;
if (!PA_SINK_IS_LINKED(pa_sink_get_state(d))) if (!PA_SINK_IS_LINKED(d->state))
continue; continue;
if (role_match(d->proplist, role)) if (role_match(d->proplist, role))
@ -349,7 +349,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
if (d == c->default_source || d == source) if (d == c->default_source || d == source)
continue; continue;
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(d))) if (!PA_SOURCE_IS_LINKED(d->state))
continue; continue;
/* If moving from a monitor, move to another monitor */ /* If moving from a monitor, move to another monitor */

View file

@ -452,7 +452,7 @@ static void sink_set_mute_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;

View file

@ -714,7 +714,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
/* Uncork the sink input unless the destination is suspended for other /* Uncork the sink input unless the destination is suspended for other
* reasons than idle. */ * reasons than idle. */
if (pa_source_get_state(dest) == PA_SOURCE_SUSPENDED) if (dest->state == PA_SOURCE_SUSPENDED)
pa_sink_input_cork(u->sink_input, (dest->suspend_cause != PA_SUSPEND_IDLE)); pa_sink_input_cork(u->sink_input, (dest->suspend_cause != PA_SUSPEND_IDLE));
else else
pa_sink_input_cork(u->sink_input, false); pa_sink_input_cork(u->sink_input, false);
@ -1098,7 +1098,7 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
/* Uncork the source output unless the destination is suspended for other /* Uncork the source output unless the destination is suspended for other
* reasons than idle */ * reasons than idle */
if (pa_sink_get_state(dest) == PA_SINK_SUSPENDED) if (dest->state == PA_SINK_SUSPENDED)
pa_source_output_cork(u->source_output, (dest->suspend_cause != PA_SUSPEND_IDLE)); pa_source_output_cork(u->source_output, (dest->suspend_cause != PA_SUSPEND_IDLE));
else else
pa_source_output_cork(u->source_output, false); pa_source_output_cork(u->source_output, false);
@ -1565,10 +1565,10 @@ int pa__init(pa_module *m) {
pa_sink_input_put(u->sink_input); pa_sink_input_put(u->sink_input);
pa_source_output_put(u->source_output); pa_source_output_put(u->source_output);
if (pa_source_get_state(u->source_output->source) != PA_SOURCE_SUSPENDED) if (u->source_output->source->state != PA_SOURCE_SUSPENDED)
pa_sink_input_cork(u->sink_input, false); pa_sink_input_cork(u->sink_input, false);
if (pa_sink_get_state(u->sink_input->sink) != PA_SINK_SUSPENDED) if (u->sink_input->sink->state != PA_SINK_SUSPENDED)
pa_source_output_cork(u->source_output, false); pa_source_output_cork(u->source_output, false);
update_adjust_timer(u); update_adjust_timer(u);

View file

@ -114,7 +114,7 @@ static pa_sink* find_evacuation_sink(pa_core *c, pa_sink_input *i, pa_sink *skip
if (target == skip) if (target == skip)
continue; continue;
if (!PA_SINK_IS_LINKED(pa_sink_get_state(target))) if (!PA_SINK_IS_LINKED(target->state))
continue; continue;
if (!pa_sink_input_may_move_to(i, target)) if (!pa_sink_input_may_move_to(i, target))
@ -224,7 +224,7 @@ static pa_source* find_evacuation_source(pa_core *c, pa_source_output *o, pa_sou
if (skip && !target->monitor_of != !skip->monitor_of) if (skip && !target->monitor_of != !skip->monitor_of)
continue; continue;
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(target))) if (!PA_SOURCE_IS_LINKED(target->state))
continue; continue;
if (!pa_source_output_may_move_to(o, target)) if (!pa_source_output_may_move_to(o, target))

View file

@ -1453,7 +1453,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
/* It might happen that a stream and a sink are set up at the /* It might happen that a stream and a sink are set up at the
same time, in which case we want to make sure we don't same time, in which case we want to make sure we don't
interfere with that */ interfere with that */
if (s && PA_SINK_IS_LINKED(pa_sink_get_state(s))) if (s && PA_SINK_IS_LINKED(s->state))
if (pa_sink_input_new_data_set_sink(new_data, s, true, false)) if (pa_sink_input_new_data_set_sink(new_data, s, true, false))
pa_log_info("Restoring device for stream %s.", name); pa_log_info("Restoring device for stream %s.", name);
@ -1556,7 +1556,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
/* It might happen that a stream and a sink are set up at the /* It might happen that a stream and a sink are set up at the
same time, in which case we want to make sure we don't same time, in which case we want to make sure we don't
interfere with that */ interfere with that */
if (s && PA_SOURCE_IS_LINKED(pa_source_get_state(s))) { if (s && PA_SOURCE_IS_LINKED(s->state)) {
pa_log_info("Restoring device for stream %s.", name); pa_log_info("Restoring device for stream %s.", name);
pa_source_output_new_data_set_source(new_data, s, true, false); pa_source_output_new_data_set_source(new_data, s, true, false);
} }
@ -1764,7 +1764,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SINK)) && if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SINK)) &&
d != sink && d != sink &&
PA_SINK_IS_LINKED(pa_sink_get_state(d))) PA_SINK_IS_LINKED(d->state))
pa_sink_input_move_to(si, d, true); pa_sink_input_move_to(si, d, true);
} }
@ -1815,7 +1815,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE)) && if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE)) &&
d != source && d != source &&
PA_SOURCE_IS_LINKED(pa_source_get_state(d))) PA_SOURCE_IS_LINKED(d->state))
pa_source_output_move_to(so, d, true); pa_source_output_move_to(so, d, true);
} }

View file

@ -390,18 +390,16 @@ static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, s
if (pa_sink_isinstance(o)) { if (pa_sink_isinstance(o)) {
pa_sink *s = PA_SINK(o); pa_sink *s = PA_SINK(o);
pa_sink_state_t state = pa_sink_get_state(s);
if (pa_sink_check_suspend(s, NULL, NULL) <= 0) if (pa_sink_check_suspend(s, NULL, NULL) <= 0)
if (PA_SINK_IS_OPENED(state)) if (PA_SINK_IS_OPENED(s->state))
restart(d); restart(d);
} else if (pa_source_isinstance(o)) { } else if (pa_source_isinstance(o)) {
pa_source *s = PA_SOURCE(o); pa_source *s = PA_SOURCE(o);
pa_source_state_t state = pa_source_get_state(s);
if (pa_source_check_suspend(s, NULL) <= 0) if (pa_source_check_suspend(s, NULL) <= 0)
if (PA_SOURCE_IS_OPENED(state)) if (PA_SOURCE_IS_OPENED(s->state))
restart(d); restart(d);
} }
@ -481,12 +479,12 @@ void pa__done(pa_module*m) {
u = m->userdata; u = m->userdata;
PA_HASHMAP_FOREACH(d, u->device_infos, state) { PA_HASHMAP_FOREACH(d, u->device_infos, state) {
if (d->sink && pa_sink_get_state(d->sink) == PA_SINK_SUSPENDED) { if (d->sink && d->sink->state == PA_SINK_SUSPENDED) {
pa_log_debug("Resuming sink %s on module unload.", d->sink->name); pa_log_debug("Resuming sink %s on module unload.", d->sink->name);
pa_sink_suspend(d->sink, false, PA_SUSPEND_IDLE); pa_sink_suspend(d->sink, false, PA_SUSPEND_IDLE);
} }
if (d->source && pa_source_get_state(d->source) == PA_SOURCE_SUSPENDED) { if (d->source && d->source->state == PA_SOURCE_SUSPENDED) {
pa_log_debug("Resuming source %s on module unload.", d->source->name); pa_log_debug("Resuming source %s on module unload.", d->source->name);
pa_source_suspend(d->source, false, PA_SUSPEND_IDLE); pa_source_suspend(d->source, false, PA_SUSPEND_IDLE);
} }

View file

@ -1669,7 +1669,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
pa_tagstruct_putu32(reply, PA_INVALID_INDEX); pa_tagstruct_putu32(reply, PA_INVALID_INDEX);
pa_tagstruct_puts(reply, u->sink_name); pa_tagstruct_puts(reply, u->sink_name);
pa_tagstruct_putu32(reply, u->maxlength); pa_tagstruct_putu32(reply, u->maxlength);
pa_tagstruct_put_boolean(reply, !PA_SINK_IS_OPENED(pa_sink_get_state(u->sink))); pa_tagstruct_put_boolean(reply, !PA_SINK_IS_OPENED(u->sink->state));
pa_tagstruct_putu32(reply, u->tlength); pa_tagstruct_putu32(reply, u->tlength);
pa_tagstruct_putu32(reply, u->prebuf); pa_tagstruct_putu32(reply, u->prebuf);
pa_tagstruct_putu32(reply, u->minreq); pa_tagstruct_putu32(reply, u->minreq);
@ -1688,7 +1688,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
pa_tagstruct_putu32(reply, PA_INVALID_INDEX); pa_tagstruct_putu32(reply, PA_INVALID_INDEX);
pa_tagstruct_puts(reply, u->source_name); pa_tagstruct_puts(reply, u->source_name);
pa_tagstruct_putu32(reply, u->maxlength); pa_tagstruct_putu32(reply, u->maxlength);
pa_tagstruct_put_boolean(reply, !PA_SOURCE_IS_OPENED(pa_source_get_state(u->source))); pa_tagstruct_put_boolean(reply, !PA_SOURCE_IS_OPENED(u->source->state));
pa_tagstruct_putu32(reply, u->fragsize); pa_tagstruct_putu32(reply, u->fragsize);
#endif #endif

View file

@ -184,7 +184,7 @@ static void sink_set_volume_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;
@ -198,7 +198,7 @@ static void sink_set_mute_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;

View file

@ -232,7 +232,7 @@ static void source_set_volume_cb(pa_source *s) {
pa_source_assert_ref(s); pa_source_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) || if (!PA_SOURCE_IS_LINKED(s->state) ||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state)) !PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
return; return;
@ -246,7 +246,7 @@ static void source_set_mute_cb(pa_source *s) {
pa_source_assert_ref(s); pa_source_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) || if (!PA_SOURCE_IS_LINKED(s->state) ||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state)) !PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
return; return;
@ -273,7 +273,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
/* if uplink sink exists, pull data from there; simplify by using /* if uplink sink exists, pull data from there; simplify by using
same length as chunk provided by source */ same length as chunk provided by source */
if (u->sink && (pa_sink_get_state(u->sink) == PA_SINK_RUNNING)) { if (u->sink && (u->sink->thread_info.state == PA_SINK_RUNNING)) {
pa_memchunk tchunk; pa_memchunk tchunk;
size_t nbytes = chunk->length; size_t nbytes = chunk->length;
pa_mix_info streams[2]; pa_mix_info streams[2];

View file

@ -212,7 +212,7 @@ static void sink_set_volume_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;
@ -226,7 +226,7 @@ static void sink_set_mute_cb(pa_sink *s) {
pa_sink_assert_ref(s); pa_sink_assert_ref(s);
pa_assert_se(u = s->userdata); pa_assert_se(u = s->userdata);
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) || if (!PA_SINK_IS_LINKED(s->state) ||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state)) !PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
return; return;

View file

@ -1829,7 +1829,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool
pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_max(pa_sink_get_volume(sink, false))); pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_max(pa_sink_get_volume(sink, false)));
pa_strbuf_printf(buf, "set-sink-mute %s %s\n", sink->name, pa_yes_no(pa_sink_get_mute(sink, false))); pa_strbuf_printf(buf, "set-sink-mute %s %s\n", sink->name, pa_yes_no(pa_sink_get_mute(sink, false)));
pa_strbuf_printf(buf, "suspend-sink %s %s\n", sink->name, pa_yes_no(pa_sink_get_state(sink) == PA_SINK_SUSPENDED)); pa_strbuf_printf(buf, "suspend-sink %s %s\n", sink->name, pa_yes_no(sink->state == PA_SINK_SUSPENDED));
} }
nl = false; nl = false;
@ -1842,7 +1842,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool
pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_max(pa_source_get_volume(source, false))); pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_max(pa_source_get_volume(source, false)));
pa_strbuf_printf(buf, "set-source-mute %s %s\n", source->name, pa_yes_no(pa_source_get_mute(source, false))); pa_strbuf_printf(buf, "set-source-mute %s %s\n", source->name, pa_yes_no(pa_source_get_mute(source, false)));
pa_strbuf_printf(buf, "suspend-source %s %s\n", source->name, pa_yes_no(pa_source_get_state(source) == PA_SOURCE_SUSPENDED)); pa_strbuf_printf(buf, "suspend-source %s %s\n", source->name, pa_yes_no(source->state == PA_SOURCE_SUSPENDED));
} }
nl = false; nl = false;

View file

@ -250,7 +250,7 @@ char *pa_sink_list_to_string(pa_core *c) {
sink->flags & PA_SINK_LATENCY ? "LATENCY " : "", sink->flags & PA_SINK_LATENCY ? "LATENCY " : "",
sink->flags & PA_SINK_FLAT_VOLUME ? "FLAT_VOLUME " : "", sink->flags & PA_SINK_FLAT_VOLUME ? "FLAT_VOLUME " : "",
sink->flags & PA_SINK_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "", sink->flags & PA_SINK_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "",
pa_sink_state_to_string(pa_sink_get_state(sink)), pa_sink_state_to_string(sink->state),
pa_suspend_cause_to_string(sink->suspend_cause, suspend_cause_buf), pa_suspend_cause_to_string(sink->suspend_cause, suspend_cause_buf),
sink->priority, sink->priority,
pa_cvolume_snprint_verbose(cv, pa_cvolume_snprint_verbose(cv,
@ -361,7 +361,7 @@ char *pa_source_list_to_string(pa_core *c) {
source->flags & PA_SOURCE_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "", source->flags & PA_SOURCE_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "",
source->flags & PA_SOURCE_LATENCY ? "LATENCY " : "", source->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
source->flags & PA_SOURCE_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "", source->flags & PA_SOURCE_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "",
pa_source_state_to_string(pa_source_get_state(source)), pa_source_state_to_string(source->state),
pa_suspend_cause_to_string(source->suspend_cause, suspend_cause_buf), pa_suspend_cause_to_string(source->suspend_cause, suspend_cause_buf),
source->priority, source->priority,
pa_cvolume_snprint_verbose(cv, pa_cvolume_snprint_verbose(cv,

View file

@ -481,12 +481,12 @@ void pa_core_maybe_vacuum(pa_core *c) {
idx = 0; idx = 0;
PA_IDXSET_FOREACH(si, c->sinks, idx) PA_IDXSET_FOREACH(si, c->sinks, idx)
if (pa_sink_get_state(si) != PA_SINK_SUSPENDED) if (si->state != PA_SINK_SUSPENDED)
return; return;
idx = 0; idx = 0;
PA_IDXSET_FOREACH(so, c->sources, idx) PA_IDXSET_FOREACH(so, c->sources, idx)
if (pa_source_get_state(so) != PA_SOURCE_SUSPENDED) if (so->state != PA_SOURCE_SUSPENDED)
return; return;
pa_log_info("All sinks and sources are suspended, vacuuming memory"); pa_log_info("All sinks and sources are suspended, vacuuming memory");

View file

@ -966,18 +966,19 @@ static int esd_proto_standby_or_resume(connection *c, esd_proto_t request, const
static int esd_proto_standby_mode(connection *c, esd_proto_t request, const void *data, size_t length) { static int esd_proto_standby_mode(connection *c, esd_proto_t request, const void *data, size_t length) {
int32_t mode; int32_t mode;
pa_sink *sink, *source; pa_sink *sink;
pa_source *source;
connection_assert_ref(c); connection_assert_ref(c);
mode = ESM_RUNNING; mode = ESM_RUNNING;
if ((sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK))) if ((sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK)))
if (pa_sink_get_state(sink) == PA_SINK_SUSPENDED) if (sink->state == PA_SINK_SUSPENDED)
mode = ESM_ON_STANDBY; mode = ESM_ON_STANDBY;
if ((source = pa_namereg_get(c->protocol->core, c->options->default_source, PA_NAMEREG_SOURCE))) if ((source = pa_namereg_get(c->protocol->core, c->options->default_source, PA_NAMEREG_SOURCE)))
if (pa_source_get_state(source) == PA_SOURCE_SUSPENDED) if (source->state == PA_SOURCE_SUSPENDED)
mode = ESM_ON_STANDBY; mode = ESM_ON_STANDBY;
mode = PA_MAYBE_INT32_SWAP(c->swap_byte_order, mode); mode = PA_MAYBE_INT32_SWAP(c->swap_byte_order, mode);

View file

@ -1659,7 +1659,7 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
pa_tagstruct_putu32(t, s->index); pa_tagstruct_putu32(t, s->index);
pa_tagstruct_putu32(t, dest->index); pa_tagstruct_putu32(t, dest->index);
pa_tagstruct_puts(t, dest->name); pa_tagstruct_puts(t, dest->name);
pa_tagstruct_put_boolean(t, pa_sink_get_state(dest) == PA_SINK_SUSPENDED); pa_tagstruct_put_boolean(t, dest->state == PA_SINK_SUSPENDED);
if (s->connection->version >= 13) { if (s->connection->version >= 13) {
pa_tagstruct_putu32(t, s->buffer_attr.maxlength); pa_tagstruct_putu32(t, s->buffer_attr.maxlength);
@ -1798,7 +1798,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
pa_tagstruct_putu32(t, s->index); pa_tagstruct_putu32(t, s->index);
pa_tagstruct_putu32(t, dest->index); pa_tagstruct_putu32(t, dest->index);
pa_tagstruct_puts(t, dest->name); pa_tagstruct_puts(t, dest->name);
pa_tagstruct_put_boolean(t, pa_source_get_state(dest) == PA_SOURCE_SUSPENDED); pa_tagstruct_put_boolean(t, dest->state == PA_SOURCE_SUSPENDED);
if (s->connection->version >= 13) { if (s->connection->version >= 13) {
pa_tagstruct_putu32(t, s->buffer_attr.maxlength); pa_tagstruct_putu32(t, s->buffer_attr.maxlength);
@ -2080,7 +2080,7 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
pa_tagstruct_putu32(reply, s->sink_input->sink->index); pa_tagstruct_putu32(reply, s->sink_input->sink->index);
pa_tagstruct_puts(reply, s->sink_input->sink->name); pa_tagstruct_puts(reply, s->sink_input->sink->name);
pa_tagstruct_put_boolean(reply, pa_sink_get_state(s->sink_input->sink) == PA_SINK_SUSPENDED); pa_tagstruct_put_boolean(reply, s->sink_input->sink->state == PA_SINK_SUSPENDED);
} }
if (c->version >= 13) if (c->version >= 13)
@ -2394,7 +2394,7 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
pa_tagstruct_putu32(reply, s->source_output->source->index); pa_tagstruct_putu32(reply, s->source_output->source->index);
pa_tagstruct_puts(reply, s->source_output->source->name); pa_tagstruct_puts(reply, s->source_output->source->name);
pa_tagstruct_put_boolean(reply, pa_source_get_state(s->source_output->source) == PA_SOURCE_SUSPENDED); pa_tagstruct_put_boolean(reply, s->source_output->source->state == PA_SOURCE_SUSPENDED);
} }
if (c->version >= 13) if (c->version >= 13)
@ -2879,7 +2879,7 @@ static void command_get_playback_latency(pa_pdispatch *pd, uint32_t command, uin
pa_tagstruct_put_usec(reply, 0); pa_tagstruct_put_usec(reply, 0);
pa_tagstruct_put_boolean(reply, pa_tagstruct_put_boolean(reply,
s->playing_for > 0 && s->playing_for > 0 &&
pa_sink_get_state(s->sink_input->sink) == PA_SINK_RUNNING && s->sink_input->sink->state == PA_SINK_RUNNING &&
s->sink_input->state == PA_SINK_INPUT_RUNNING); s->sink_input->state == PA_SINK_INPUT_RUNNING);
pa_tagstruct_put_timeval(reply, &tv); pa_tagstruct_put_timeval(reply, &tv);
pa_tagstruct_put_timeval(reply, pa_gettimeofday(&now)); pa_tagstruct_put_timeval(reply, pa_gettimeofday(&now));
@ -2924,7 +2924,7 @@ static void command_get_record_latency(pa_pdispatch *pd, uint32_t command, uint3
s->current_source_latency + s->current_source_latency +
pa_bytes_to_usec(s->on_the_fly_snapshot, &s->source_output->sample_spec)); pa_bytes_to_usec(s->on_the_fly_snapshot, &s->source_output->sample_spec));
pa_tagstruct_put_boolean(reply, pa_tagstruct_put_boolean(reply,
pa_source_get_state(s->source_output->source) == PA_SOURCE_RUNNING && s->source_output->source->state == PA_SOURCE_RUNNING &&
s->source_output->state == PA_SOURCE_OUTPUT_RUNNING); s->source_output->state == PA_SOURCE_OUTPUT_RUNNING);
pa_tagstruct_put_timeval(reply, &tv); pa_tagstruct_put_timeval(reply, &tv);
pa_tagstruct_put_timeval(reply, pa_gettimeofday(&now)); pa_tagstruct_put_timeval(reply, pa_gettimeofday(&now));
@ -3167,9 +3167,9 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
if (c->version >= 15) { if (c->version >= 15) {
pa_tagstruct_put_volume(t, sink->base_volume); pa_tagstruct_put_volume(t, sink->base_volume);
if (PA_UNLIKELY(pa_sink_get_state(sink) == PA_SINK_INVALID_STATE)) if (PA_UNLIKELY(sink->state == PA_SINK_INVALID_STATE))
pa_log_error("Internal sink state is invalid."); pa_log_error("Internal sink state is invalid.");
pa_tagstruct_putu32(t, pa_sink_get_state(sink)); pa_tagstruct_putu32(t, sink->state);
pa_tagstruct_putu32(t, sink->n_volume_steps); pa_tagstruct_putu32(t, sink->n_volume_steps);
pa_tagstruct_putu32(t, sink->card ? sink->card->index : PA_INVALID_INDEX); pa_tagstruct_putu32(t, sink->card ? sink->card->index : PA_INVALID_INDEX);
} }
@ -3237,9 +3237,9 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
if (c->version >= 15) { if (c->version >= 15) {
pa_tagstruct_put_volume(t, source->base_volume); pa_tagstruct_put_volume(t, source->base_volume);
if (PA_UNLIKELY(pa_source_get_state(source) == PA_SOURCE_INVALID_STATE)) if (PA_UNLIKELY(source->state == PA_SOURCE_INVALID_STATE))
pa_log_error("Internal source state is invalid."); pa_log_error("Internal source state is invalid.");
pa_tagstruct_putu32(t, pa_source_get_state(source)); pa_tagstruct_putu32(t, source->state);
pa_tagstruct_putu32(t, source->n_volume_steps); pa_tagstruct_putu32(t, source->n_volume_steps);
pa_tagstruct_putu32(t, source->card ? source->card->index : PA_INVALID_INDEX); pa_tagstruct_putu32(t, source->card ? source->card->index : PA_INVALID_INDEX);
} }

View file

@ -357,7 +357,7 @@ int pa_sink_input_new(
return -PA_ERR_NOTSUPPORTED; return -PA_ERR_NOTSUPPORTED;
} }
pa_return_val_if_fail(PA_SINK_IS_LINKED(pa_sink_get_state(data->sink)), -PA_ERR_BADSTATE); pa_return_val_if_fail(PA_SINK_IS_LINKED(data->sink->state), -PA_ERR_BADSTATE);
pa_return_val_if_fail(!data->sync_base || (data->sync_base->sink == data->sink pa_return_val_if_fail(!data->sync_base || (data->sync_base->sink == data->sink
&& data->sync_base->state == PA_SINK_INPUT_CORKED), && data->sync_base->state == PA_SINK_INPUT_CORKED),
-PA_ERR_INVALID); -PA_ERR_INVALID);
@ -442,7 +442,7 @@ int pa_sink_input_new(
return r; return r;
if ((data->flags & PA_SINK_INPUT_NO_CREATE_ON_SUSPEND) && if ((data->flags & PA_SINK_INPUT_NO_CREATE_ON_SUSPEND) &&
pa_sink_get_state(data->sink) == PA_SINK_SUSPENDED) { data->sink->state == PA_SINK_SUSPENDED) {
pa_log_warn("Failed to create sink input: sink is suspended."); pa_log_warn("Failed to create sink input: sink is suspended.");
return -PA_ERR_BADSTATE; return -PA_ERR_BADSTATE;
} }
@ -720,7 +720,7 @@ void pa_sink_input_unlink(pa_sink_input *i) {
reset_callbacks(i); reset_callbacks(i);
if (i->sink) { if (i->sink) {
if (PA_SINK_IS_LINKED(pa_sink_get_state(i->sink))) if (PA_SINK_IS_LINKED(i->sink->state))
pa_sink_update_status(i->sink); pa_sink_update_status(i->sink);
i->sink = NULL; i->sink = NULL;

View file

@ -494,8 +494,6 @@ unsigned pa_sink_used_by(pa_sink *s); /* Number of connected streams which are n
* why "ignore_output" may be relevant). */ * why "ignore_output" may be relevant). */
unsigned pa_sink_check_suspend(pa_sink *s, pa_sink_input *ignore_input, pa_source_output *ignore_output); unsigned pa_sink_check_suspend(pa_sink *s, pa_sink_input *ignore_input, pa_source_output *ignore_output);
#define pa_sink_get_state(s) ((s)->state)
const char *pa_sink_state_to_string(pa_sink_state_t state); const char *pa_sink_state_to_string(pa_sink_state_t state);
/* Moves all inputs away, and stores them in pa_queue */ /* Moves all inputs away, and stores them in pa_queue */

View file

@ -301,7 +301,7 @@ int pa_source_output_new(
return -PA_ERR_NOTSUPPORTED; return -PA_ERR_NOTSUPPORTED;
} }
pa_return_val_if_fail(PA_SOURCE_IS_LINKED(pa_source_get_state(data->source)), -PA_ERR_BADSTATE); pa_return_val_if_fail(PA_SOURCE_IS_LINKED(data->source->state), -PA_ERR_BADSTATE);
pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID); pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID);
/* Routing is done. We have a source and a format. */ /* Routing is done. We have a source and a format. */
@ -390,7 +390,7 @@ int pa_source_output_new(
return r; return r;
if ((data->flags & PA_SOURCE_OUTPUT_NO_CREATE_ON_SUSPEND) && if ((data->flags & PA_SOURCE_OUTPUT_NO_CREATE_ON_SUSPEND) &&
pa_source_get_state(data->source) == PA_SOURCE_SUSPENDED) { data->source->state == PA_SOURCE_SUSPENDED) {
pa_log("Failed to create source output: source is suspended."); pa_log("Failed to create source output: source is suspended.");
return -PA_ERR_BADSTATE; return -PA_ERR_BADSTATE;
} }
@ -612,7 +612,7 @@ void pa_source_output_unlink(pa_source_output*o) {
reset_callbacks(o); reset_callbacks(o);
if (o->source) { if (o->source) {
if (PA_SOURCE_IS_LINKED(pa_source_get_state(o->source))) if (PA_SOURCE_IS_LINKED(o->source->state))
pa_source_update_status(o->source); pa_source_update_status(o->source);
o->source = NULL; o->source = NULL;

View file

@ -842,7 +842,7 @@ int pa_source_sync_suspend(pa_source *s) {
pa_assert(PA_SOURCE_IS_LINKED(s->state)); pa_assert(PA_SOURCE_IS_LINKED(s->state));
pa_assert(s->monitor_of); pa_assert(s->monitor_of);
state = pa_sink_get_state(s->monitor_of); state = s->monitor_of->state;
suspend_cause = s->monitor_of->suspend_cause; suspend_cause = s->monitor_of->suspend_cause;
/* The monitor source usually has the same state and suspend cause as the /* The monitor source usually has the same state and suspend cause as the

View file

@ -425,8 +425,6 @@ unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that ar
* "ignore" is non-NULL, that stream is not included in the count. */ * "ignore" is non-NULL, that stream is not included in the count. */
unsigned pa_source_check_suspend(pa_source *s, pa_source_output *ignore); unsigned pa_source_check_suspend(pa_source *s, pa_source_output *ignore);
#define pa_source_get_state(s) ((pa_source_state_t) (s)->state)
const char *pa_source_state_to_string(pa_source_state_t state); const char *pa_source_state_to_string(pa_source_state_t state);
/* Moves all inputs away, and stores them in pa_queue */ /* Moves all inputs away, and stores them in pa_queue */