mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
link: refactor a little
This commit is contained in:
parent
374210c890
commit
2c2bb381b3
1 changed files with 9 additions and 7 deletions
|
|
@ -856,16 +856,21 @@ static void output_node_result(void *data, int seq, int res, uint32_t type, cons
|
||||||
node_result(impl, port, seq, res, type, result);
|
node_result(impl, port, seq, res, type, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void node_active_changed(void *data, bool active)
|
static void check_prepare(struct pw_impl_link *this)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
|
||||||
struct pw_impl_link *this = &impl->this;
|
|
||||||
pw_log_debug(NAME" %p: input active:%d output active:%d", impl,
|
pw_log_debug(NAME" %p: input active:%d output active:%d", impl,
|
||||||
impl->inode->active, impl->onode->active);
|
impl->inode->active, impl->onode->active);
|
||||||
if (impl->inode->active && impl->onode->active)
|
if (impl->inode->active && impl->onode->active)
|
||||||
pw_impl_link_prepare(this);
|
pw_impl_link_prepare(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void node_active_changed(void *data, bool active)
|
||||||
|
{
|
||||||
|
struct impl *impl = data;
|
||||||
|
check_prepare(&impl->this);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct pw_impl_node_events input_node_events = {
|
static const struct pw_impl_node_events input_node_events = {
|
||||||
PW_VERSION_IMPL_NODE_EVENTS,
|
PW_VERSION_IMPL_NODE_EVENTS,
|
||||||
.result = input_node_result,
|
.result = input_node_result,
|
||||||
|
|
@ -1218,10 +1223,7 @@ int pw_impl_link_register(struct pw_impl_link *link,
|
||||||
pw_global_add_listener(link->global, &link->global_listener, &global_events, link);
|
pw_global_add_listener(link->global, &link->global_listener, &global_events, link);
|
||||||
pw_global_register(link->global);
|
pw_global_register(link->global);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: output_active:%d input_active:%d", link,
|
check_prepare(link);
|
||||||
input_node->active, output_node->active);
|
|
||||||
if (input_node->active && output_node->active)
|
|
||||||
pw_impl_link_prepare(link);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue