Loading...
Searching...
No Matches
node.h
Go to the documentation of this file.
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_NODE_H
#define PIPEWIRE_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <errno.h>
#include <spa/utils/defs.h>
#include <spa/utils/hook.h>
#include <spa/node/command.h>
#include <spa/param/param.h>
#include <pipewire/proxy.h>
#define PW_TYPE_INTERFACE_Node PW_TYPE_INFO_INTERFACE_BASE "Node"
#define PW_NODE_PERM_MASK PW_PERM_RWXML
#define PW_VERSION_NODE 3
struct pw_node;
enum pw_node_state {
PW_NODE_STATE_ERROR = -1,
PW_NODE_STATE_CREATING = 0,
PW_NODE_STATE_SUSPENDED = 1,
PW_NODE_STATE_IDLE = 2,
PW_NODE_STATE_RUNNING = 3,
};
const char * pw_node_state_as_string(enum pw_node_state state);
struct pw_node_info {
uint32_t id;
uint32_t max_input_ports;
uint32_t max_output_ports;
#define PW_NODE_CHANGE_MASK_INPUT_PORTS (1 << 0)
#define PW_NODE_CHANGE_MASK_OUTPUT_PORTS (1 << 1)
#define PW_NODE_CHANGE_MASK_STATE (1 << 2)
#define PW_NODE_CHANGE_MASK_PROPS (1 << 3)
#define PW_NODE_CHANGE_MASK_PARAMS (1 << 4)
#define PW_NODE_CHANGE_MASK_ALL ((1 << 5)-1)
uint64_t change_mask;
uint32_t n_input_ports;
uint32_t n_output_ports;
enum pw_node_state state;
const char *error;
struct spa_dict *props;
struct spa_param_info *params;
uint32_t n_params;
};
struct pw_node_info *
pw_node_info_update(struct pw_node_info *info,
const struct pw_node_info *update);
struct pw_node_info *
pw_node_info_merge(struct pw_node_info *info,
const struct pw_node_info *update, bool reset);
void
pw_node_info_free(struct pw_node_info *info);
#define PW_NODE_EVENT_INFO 0
#define PW_NODE_EVENT_PARAM 1
#define PW_NODE_EVENT_NUM 2
struct pw_node_events {
#define PW_VERSION_NODE_EVENTS 0
uint32_t version;
void (*info) (void *data, const struct pw_node_info *info);
void (*param) (void *data, int seq,
uint32_t id, uint32_t index, uint32_t next,
const struct spa_pod *param);
};
#define PW_NODE_METHOD_ADD_LISTENER 0
#define PW_NODE_METHOD_SUBSCRIBE_PARAMS 1
#define PW_NODE_METHOD_ENUM_PARAMS 2
#define PW_NODE_METHOD_SET_PARAM 3
#define PW_NODE_METHOD_SEND_COMMAND 4
#define PW_NODE_METHOD_NUM 5
struct pw_node_methods {
#define PW_VERSION_NODE_METHODS 0
uint32_t version;
int (*add_listener) (void *object,
struct spa_hook *listener,
const struct pw_node_events *events,
void *data);
int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
int (*enum_params) (void *object, int seq, uint32_t id,
uint32_t start, uint32_t num,
const struct spa_pod *filter);
int (*set_param) (void *object, uint32_t id, uint32_t flags,
const struct spa_pod *param);
int (*send_command) (void *object, const struct spa_command *command);
};
#define pw_node_method(o,method,version,...) \
({ \
int _res = -ENOTSUP; \
spa_interface_call_res((struct spa_interface*)o, \
struct pw_node_methods, _res, \
method, version, ##__VA_ARGS__); \
_res; \
})
#define pw_node_add_listener(c,...) pw_node_method(c,add_listener,0,__VA_ARGS__)
#define pw_node_subscribe_params(c,...) pw_node_method(c,subscribe_params,0,__VA_ARGS__)
#define pw_node_enum_params(c,...) pw_node_method(c,enum_params,0,__VA_ARGS__)
#define pw_node_set_param(c,...) pw_node_method(c,set_param,0,__VA_ARGS__)
#define pw_node_send_command(c,...) pw_node_method(c,send_command,0,__VA_ARGS__)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* PIPEWIRE_NODE_H */
defs.h
spa/utils/defs.h
pw_node_info_free
void pw_node_info_free(struct pw_node_info *info)
Definition introspect.c:233
pw_node_info_merge
struct pw_node_info * pw_node_info_merge(struct pw_node_info *info, const struct pw_node_info *update, bool reset)
Definition introspect.c:158
pw_node_info_update
struct pw_node_info * pw_node_info_update(struct pw_node_info *info, const struct pw_node_info *update)
Definition introspect.c:226
pw_node_state_as_string
const char * pw_node_state_as_string(enum pw_node_state state)
Convert a pw_node_state to a readable string.
Definition introspect.c:15
pw_node_state
pw_node_state
The different node states.
Definition node.h:46
PW_NODE_STATE_ERROR
@ PW_NODE_STATE_ERROR
error state
Definition node.h:47
PW_NODE_STATE_SUSPENDED
@ PW_NODE_STATE_SUSPENDED
the node is suspended, the device might be closed
Definition node.h:49
PW_NODE_STATE_IDLE
@ PW_NODE_STATE_IDLE
the node is running but there is no active port
Definition node.h:51
PW_NODE_STATE_CREATING
@ PW_NODE_STATE_CREATING
the node is being created
Definition node.h:48
PW_NODE_STATE_RUNNING
@ PW_NODE_STATE_RUNNING
the node is running
Definition node.h:53
hook.h
spa/utils/hook.h
command.h
spa/node/command.h
param.h
spa/param/param.h
proxy.h
pipewire/proxy.h
pw_node_events
Node events.
Definition node.h:105
pw_node_events::info
void(* info)(void *data, const struct pw_node_info *info)
Notify node info.
Definition node.h:114
pw_node_events::version
uint32_t version
Definition node.h:108
pw_node_events::param
void(* param)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param)
Notify a node param.
Definition node.h:126
pw_node_info
The node information.
Definition node.h:60
pw_node_info::state
enum pw_node_state state
the current state of the node
Definition node.h:79
pw_node_info::max_input_ports
uint32_t max_input_ports
maximum number of inputs
Definition node.h:62
pw_node_info::error
const char * error
an error reason if state is error
Definition node.h:80
pw_node_info::id
uint32_t id
id of the global
Definition node.h:61
pw_node_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition node.h:76
pw_node_info::params
struct spa_param_info * params
parameters
Definition node.h:82
pw_node_info::n_output_ports
uint32_t n_output_ports
number of outputs
Definition node.h:78
pw_node_info::max_output_ports
uint32_t max_output_ports
maximum number of outputs
Definition node.h:63
pw_node_info::n_params
uint32_t n_params
number of items in params
Definition node.h:83
pw_node_info::n_input_ports
uint32_t n_input_ports
number of inputs
Definition node.h:77
pw_node_methods
Node methods.
Definition node.h:145
pw_node_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_node_events *events, void *data)
Definition node.h:150
pw_node_methods::set_param
int(* set_param)(void *object, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a parameter on the node.
Definition node.h:194
pw_node_methods::enum_params
int(* enum_params)(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
Enumerate node parameters.
Definition node.h:181
pw_node_methods::version
uint32_t version
Definition node.h:148
pw_node_methods::subscribe_params
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition node.h:165
pw_node_methods::send_command
int(* send_command)(void *object, const struct spa_command *command)
Send a command to the node.
Definition node.h:204
pw_node
spa_command
Definition command.h:29
spa_dict
Definition dict.h:39
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350
spa_param_info
information about a parameter
Definition param.h:51
spa_pod
Definition pod.h:43