node: remove obsolete enabled state

We will create/destroy nodes instead of enabled/disable
This commit is contained in:
Wim Taymans 2019-04-24 15:39:29 +02:00
parent 24f6fc2a34
commit 9b1da77bfc
6 changed files with 4 additions and 48 deletions

View file

@ -87,8 +87,6 @@ static void complete_init(struct impl *impl)
struct pw_node *this = impl->this; struct pw_node *this = impl->this;
impl->init_pending = SPA_ID_INVALID; impl->init_pending = SPA_ID_INVALID;
if (SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_DISABLE))
pw_node_set_enabled(this, false);
if (SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_ACTIVATE)) if (SPA_FLAG_CHECK(impl->flags, PW_SPA_NODE_FLAG_ACTIVATE))
pw_node_set_active(this, true); pw_node_set_active(this, true);

View file

@ -35,10 +35,9 @@ extern "C" {
#endif #endif
enum pw_spa_node_flags { enum pw_spa_node_flags {
PW_SPA_NODE_FLAG_DISABLE = (1 << 0), PW_SPA_NODE_FLAG_ACTIVATE = (1 << 0),
PW_SPA_NODE_FLAG_ACTIVATE = (1 << 1), PW_SPA_NODE_FLAG_NO_REGISTER = (1 << 1),
PW_SPA_NODE_FLAG_NO_REGISTER = (1 << 2), PW_SPA_NODE_FLAG_ASYNC = (1 << 2),
PW_SPA_NODE_FLAG_ASYNC = (1 << 3),
}; };
struct pw_node * struct pw_node *

View file

@ -731,9 +731,6 @@ struct pw_port *pw_core_find_port(struct pw_core *core,
!PW_PERM_IS_R(pw_global_get_permissions(n->global, core->current_client))) !PW_PERM_IS_R(pw_global_get_permissions(n->global, core->current_client)))
continue; continue;
if (!n->enabled)
continue;
pw_log_debug("node id \"%d\"", n->global->id); pw_log_debug("node id \"%d\"", n->global->id);
if (have_id) { if (have_id) {

View file

@ -776,7 +776,6 @@ struct pw_node *pw_node_new(struct pw_core *core,
if (properties == NULL) if (properties == NULL)
goto clean_impl; goto clean_impl;
this->enabled = true;
this->properties = properties; this->properties = properties;
size = sizeof(struct pw_node_activation); size = sizeof(struct pw_node_activation);
@ -1437,7 +1436,7 @@ int pw_node_set_active(struct pw_node *node, bool active)
node->active = active; node->active = active;
pw_node_emit_active_changed(node, active); pw_node_emit_active_changed(node, active);
if (active && node->enabled) if (active)
node_activate(node); node_activate(node);
pw_core_recalc_graph(node->core); pw_core_recalc_graph(node->core);
@ -1450,30 +1449,3 @@ bool pw_node_is_active(struct pw_node *node)
{ {
return node->active; return node->active;
} }
SPA_EXPORT
int pw_node_set_enabled(struct pw_node *node, bool enabled)
{
bool old = node->enabled;
if (old != enabled) {
pw_log_debug("node %p: %s", node, enabled ? "enable" : "disable");
node->enabled = enabled;
pw_node_emit_enabled_changed(node, enabled);
if (enabled) {
if (node->active)
node_activate(node);
}
else {
pw_node_set_state(node, PW_NODE_STATE_SUSPENDED);
}
}
return 0;
}
SPA_EXPORT
bool pw_node_is_enabled(struct pw_node *node)
{
return node->enabled;
}

View file

@ -77,8 +77,6 @@ struct pw_node_events {
const struct pw_port_info *info); const struct pw_port_info *info);
/** the node active state changed */ /** the node active state changed */
void (*active_changed) (void *data, bool active); void (*active_changed) (void *data, bool active);
/** the node enabled state changed */
void (*enabled_changed) (void *data, bool enabled);
/** a new state is requested on the node */ /** a new state is requested on the node */
void (*state_request) (void *data, enum pw_node_state state); void (*state_request) (void *data, enum pw_node_state state);
@ -194,12 +192,6 @@ int pw_node_set_active(struct pw_node *node, bool active);
/** Check if a node is active */ /** Check if a node is active */
bool pw_node_is_active(struct pw_node *node); bool pw_node_is_active(struct pw_node *node);
/** Set a node enabled. The node will be able to be activated */
int pw_node_set_enabled(struct pw_node *node, bool enabled);
/** Check if a node is enabled */
bool pw_node_is_enabled(struct pw_node *node);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -344,7 +344,6 @@ struct pw_node_activation {
#define pw_node_emit_info_changed(n,i) pw_node_emit(n, info_changed, 0, i) #define pw_node_emit_info_changed(n,i) pw_node_emit(n, info_changed, 0, i)
#define pw_node_emit_port_info_changed(n,p,i) pw_node_emit(n, port_info_changed, 0, p, i) #define pw_node_emit_port_info_changed(n,p,i) pw_node_emit(n, port_info_changed, 0, p, i)
#define pw_node_emit_active_changed(n,a) pw_node_emit(n, active_changed, 0, a) #define pw_node_emit_active_changed(n,a) pw_node_emit(n, active_changed, 0, a)
#define pw_node_emit_enabled_changed(n,e) pw_node_emit(n, enabled_changed, 0, e)
#define pw_node_emit_state_request(n,s) pw_node_emit(n, state_request, 0, s) #define pw_node_emit_state_request(n,s) pw_node_emit(n, state_request, 0, s)
#define pw_node_emit_state_changed(n,o,s,e) pw_node_emit(n, state_changed, 0, o, s, e) #define pw_node_emit_state_changed(n,o,s,e) pw_node_emit(n, state_changed, 0, o, s, e)
#define pw_node_emit_async_complete(n,s,r) pw_node_emit(n, async_complete, 0, s, r) #define pw_node_emit_async_complete(n,s,r) pw_node_emit(n, async_complete, 0, s, r)
@ -366,7 +365,6 @@ struct pw_node {
struct spa_param_info params[MAX_PARAMS]; struct spa_param_info params[MAX_PARAMS];
unsigned int registered:1; unsigned int registered:1;
unsigned int enabled:1; /**< if the node is enabled */
unsigned int active:1; /**< if the node is active */ unsigned int active:1; /**< if the node is active */
unsigned int live:1; /**< if the node is live */ unsigned int live:1; /**< if the node is live */
unsigned int driver:1; /**< if the node can drive the graph */ unsigned int driver:1; /**< if the node can drive the graph */