mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
node: add User command and event
Add a User command and event id with a String property called 'extra' to
make it possible to send arbitrary User defined commands and events.
Also makes it possible to make User commands in pw-cli.
pw-cli c 86 User '{ extra="{ test: foo }" }'
This commit is contained in:
parent
5a54ecd8df
commit
7dc1d28b2c
3 changed files with 28 additions and 2 deletions
|
|
@ -36,12 +36,24 @@ enum spa_node_command {
|
|||
SPA_NODE_COMMAND_ParamEnd, /**< end a transaction */
|
||||
SPA_NODE_COMMAND_RequestProcess,/**< Sent to a driver when some other node emitted
|
||||
* the RequestProcess event. */
|
||||
SPA_NODE_COMMAND_User, /**< User defined command */
|
||||
};
|
||||
|
||||
#define SPA_NODE_COMMAND_ID(cmd) SPA_COMMAND_ID(cmd, SPA_TYPE_COMMAND_Node)
|
||||
#define SPA_NODE_COMMAND_INIT(id) SPA_COMMAND_INIT(SPA_TYPE_COMMAND_Node, id)
|
||||
|
||||
|
||||
/* properties for SPA_TYPE_COMMAND_Node */
|
||||
enum spa_command_node {
|
||||
SPA_COMMAND_NODE_START,
|
||||
|
||||
SPA_COMMAND_NODE_START_User = 0x1000,
|
||||
SPA_COMMAND_NODE_extra, /** extra info (String) */
|
||||
|
||||
SPA_COMMAND_NODE_START_CUSTOM = 0x1000000,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ enum spa_node_event {
|
|||
SPA_NODE_EVENT_RequestRefresh,
|
||||
SPA_NODE_EVENT_RequestProcess, /*< Ask the driver to start processing
|
||||
* the graph */
|
||||
SPA_NODE_EVENT_User, /* User defined event */
|
||||
};
|
||||
|
||||
#define SPA_NODE_EVENT_ID(ev) SPA_EVENT_ID(ev, SPA_TYPE_EVENT_Node)
|
||||
|
|
@ -31,6 +32,11 @@ enum spa_node_event {
|
|||
/* properties for SPA_TYPE_EVENT_Node */
|
||||
enum spa_event_node {
|
||||
SPA_EVENT_NODE_START,
|
||||
|
||||
SPA_EVENT_NODE_START_User = 0x1000,
|
||||
SPA_EVENT_NODE_extra, /** extra info (String) */
|
||||
|
||||
SPA_EVENT_NODE_START_CUSTOM = 0x1000000,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,16 +46,20 @@ static const struct spa_type_info spa_type_node_event_id[] = {
|
|||
{ SPA_NODE_EVENT_Buffering, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "Buffering", NULL },
|
||||
{ SPA_NODE_EVENT_RequestRefresh, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "RequestRefresh", NULL },
|
||||
{ SPA_NODE_EVENT_RequestProcess, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "RequestProcess", NULL },
|
||||
{ SPA_NODE_EVENT_User, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "User", NULL },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
static const struct spa_type_info spa_type_node_event[] = {
|
||||
{ SPA_EVENT_NODE_START, SPA_TYPE_Id, SPA_TYPE_INFO_NODE_EVENT_BASE, spa_type_node_event_id },
|
||||
|
||||
{ SPA_EVENT_NODE_extra, SPA_TYPE_String, SPA_TYPE_INFO_NODE_EVENT_BASE "extra", NULL },
|
||||
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
#define SPA_TYPE_INFO_NodeCommand SPA_TYPE_INFO_COMMAND_BASE "Node"
|
||||
#define SPA_TYPE_INFO_NODE_COMMAND_BASE SPA_TYPE_INFO_NodeCommand ":"
|
||||
#define SPA_TYPE_INFO_NODE_COMMAND_BASE SPA_TYPE_INFO_NodeCommand ":"
|
||||
|
||||
static const struct spa_type_info spa_type_node_command_id[] = {
|
||||
{ SPA_NODE_COMMAND_Suspend, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "Suspend", NULL },
|
||||
|
|
@ -69,11 +73,15 @@ static const struct spa_type_info spa_type_node_command_id[] = {
|
|||
{ SPA_NODE_COMMAND_ParamBegin, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "ParamBegin", NULL },
|
||||
{ SPA_NODE_COMMAND_ParamEnd, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "ParamEnd", NULL },
|
||||
{ SPA_NODE_COMMAND_RequestProcess, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "RequestProcess", NULL },
|
||||
{ SPA_NODE_COMMAND_User, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "User", NULL },
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
static const struct spa_type_info spa_type_node_command[] = {
|
||||
{ 0, SPA_TYPE_Id, SPA_TYPE_INFO_NODE_COMMAND_BASE, spa_type_node_command_id },
|
||||
{ SPA_COMMAND_NODE_START, SPA_TYPE_Id, SPA_TYPE_INFO_NODE_COMMAND_BASE, spa_type_node_command_id },
|
||||
|
||||
{ SPA_COMMAND_NODE_extra, SPA_TYPE_String, SPA_TYPE_INFO_NODE_COMMAND_BASE "extra", NULL },
|
||||
|
||||
{ 0, 0, NULL, NULL },
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue