mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
node: add option to not register a node
This commit is contained in:
parent
fa07400c2e
commit
efa35c2911
6 changed files with 23 additions and 8 deletions
|
|
@ -1298,7 +1298,8 @@ static const struct pw_resource_events resource_events = {
|
||||||
* \memberof pw_client_node
|
* \memberof pw_client_node
|
||||||
*/
|
*/
|
||||||
struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
||||||
struct pw_properties *properties)
|
struct pw_properties *properties,
|
||||||
|
bool do_register)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
struct pw_client_node *this;
|
struct pw_client_node *this;
|
||||||
|
|
@ -1335,7 +1336,8 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
||||||
pw_resource_get_client(this->resource),
|
pw_resource_get_client(this->resource),
|
||||||
NULL,
|
NULL,
|
||||||
name,
|
name,
|
||||||
PW_SPA_NODE_FLAG_ASYNC,
|
PW_SPA_NODE_FLAG_ASYNC |
|
||||||
|
(do_register ? 0 : PW_SPA_NODE_FLAG_NO_REGISTER),
|
||||||
&impl->node.node,
|
&impl->node.node,
|
||||||
NULL,
|
NULL,
|
||||||
properties, 0);
|
properties, 0);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ struct pw_client_node {
|
||||||
|
|
||||||
struct pw_client_node *
|
struct pw_client_node *
|
||||||
pw_client_node_new(struct pw_resource *resource,
|
pw_client_node_new(struct pw_resource *resource,
|
||||||
struct pw_properties *properties);
|
struct pw_properties *properties,
|
||||||
|
bool do_register);
|
||||||
|
|
||||||
void
|
void
|
||||||
pw_client_node_destroy(struct pw_client_node *node);
|
pw_client_node_destroy(struct pw_client_node *node);
|
||||||
|
|
|
||||||
|
|
@ -75,10 +75,16 @@ static void pw_spa_node_destroy(void *data)
|
||||||
static void complete_init(struct impl *impl)
|
static void complete_init(struct impl *impl)
|
||||||
{
|
{
|
||||||
struct pw_node *this = impl->this;
|
struct pw_node *this = impl->this;
|
||||||
if (impl->flags & PW_SPA_NODE_FLAG_DISABLE)
|
|
||||||
|
if (SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_DISABLE))
|
||||||
pw_node_set_enabled(this, false);
|
pw_node_set_enabled(this, false);
|
||||||
|
|
||||||
|
if (!SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_NO_REGISTER))
|
||||||
pw_node_register(this, impl->owner, impl->parent, NULL);
|
pw_node_register(this, impl->owner, impl->parent, NULL);
|
||||||
if (impl->flags & PW_SPA_NODE_FLAG_ACTIVATE)
|
else
|
||||||
|
pw_node_initialized(this);
|
||||||
|
|
||||||
|
if (SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_ACTIVATE))
|
||||||
pw_node_set_active(this, true);
|
pw_node_set_active(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ enum pw_spa_node_flags {
|
||||||
PW_SPA_NODE_FLAG_ASYNC = (1 << 0),
|
PW_SPA_NODE_FLAG_ASYNC = (1 << 0),
|
||||||
PW_SPA_NODE_FLAG_DISABLE = (1 << 1),
|
PW_SPA_NODE_FLAG_DISABLE = (1 << 1),
|
||||||
PW_SPA_NODE_FLAG_ACTIVATE = (1 << 2),
|
PW_SPA_NODE_FLAG_ACTIVATE = (1 << 2),
|
||||||
|
PW_SPA_NODE_FLAG_NO_REGISTER = (1 << 3),
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pw_node *
|
struct pw_node *
|
||||||
|
|
|
||||||
|
|
@ -383,10 +383,13 @@ int pw_node_register(struct pw_node *this,
|
||||||
pw_port_register(port, owner, this->global,
|
pw_port_register(port, owner, this->global,
|
||||||
pw_properties_copy(port->properties));
|
pw_properties_copy(port->properties));
|
||||||
|
|
||||||
|
return pw_node_initialized(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
int pw_node_initialized(struct pw_node *this)
|
||||||
|
{
|
||||||
spa_hook_list_call(&this->listener_list, struct pw_node_events, initialized);
|
spa_hook_list_call(&this->listener_list, struct pw_node_events, initialized);
|
||||||
|
|
||||||
pw_node_update_state(this, PW_NODE_STATE_SUSPENDED, NULL);
|
pw_node_update_state(this, PW_NODE_STATE_SUSPENDED, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -599,6 +599,8 @@ void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *
|
||||||
|
|
||||||
int pw_node_update_ports(struct pw_node *node);
|
int pw_node_update_ports(struct pw_node *node);
|
||||||
|
|
||||||
|
int pw_node_initialized(struct pw_node *node);
|
||||||
|
|
||||||
/** Activate a link \memberof pw_link
|
/** Activate a link \memberof pw_link
|
||||||
* Starts the negotiation of formats and buffers on \a link and then
|
* Starts the negotiation of formats and buffers on \a link and then
|
||||||
* starts data streaming */
|
* starts data streaming */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue