node: add send command API

This commit is contained in:
Julian Bouzas 2020-05-21 14:10:41 -04:00
parent 469c35edc8
commit 182d4d6276
2 changed files with 38 additions and 0 deletions

View file

@ -506,6 +506,25 @@ wp_node_lookup_port_full (WpNode * self, WpObjectInterest * interest)
wp_object_manager_lookup_full (priv->ports_om, interest);
}
/**
* wp_node_send_command:
* @self: the node
* @command: the command
*
* Sends a command to a node
*/
void wp_node_send_command (WpNode * self, WpNodeCommand command)
{
struct pw_node *pwp;
struct spa_command cmd =
SPA_NODE_COMMAND_INIT((enum spa_node_command) command);
g_return_if_fail (WP_IS_NODE (self));
pwp = (struct pw_node *) wp_proxy_get_pw_proxy (WP_PROXY (self));
pw_node_send_command (pwp, &cmd);
}
enum {
PROP_0,

View file

@ -34,6 +34,22 @@ typedef enum {
WP_NODE_STATE_RUNNING = 3,
} WpNodeState;
/**
* WpNodeCommand:
* @WP_NODE_COMMAND_SUSPEND: suspends the node, the device might close
* @WP_NODE_COMMAND_PAUSE: pauses the node, the device will not close
* @WP_NODE_COMMAND_START: starts procesing data
* @WP_NODE_COMMAND_ENABLE: enables the node
* @WP_NODE_COMMAND_DISABLE: disables the node
*/
typedef enum {
WP_NODE_COMMAND_SUSPEND = 0,
WP_NODE_COMMAND_PAUSE = 1,
WP_NODE_COMMAND_START = 2,
WP_NODE_COMMAND_ENABLE = 3,
WP_NODE_COMMAND_DISABLE = 4,
} WpNodeCommand;
/**
* WpNodeFeatures:
* @WP_NODE_FEATURE_PORTS: caches information about ports, enabling
@ -103,6 +119,9 @@ WpPort * wp_node_lookup_port (WpNode * self, ...) G_GNUC_NULL_TERMINATED;
WP_API
WpPort * wp_node_lookup_port_full (WpNode * self, WpObjectInterest * interest);
WP_API
void wp_node_send_command (WpNode * self, WpNodeCommand command);
/**
* WP_TYPE_IMPL_NODE:
*