PipeWire  0.3.66
Node

A spa_node is a component that can consume and produce buffers. More...

Files

file  node/command.h
 spa/node/command.h
 
file  node/event.h
 spa/node/event.h
 
file  io.h
 spa/node/io.h
 
file  spa/include/spa/node/keys.h
 spa/node/keys.h
 
file  spa/include/spa/node/node.h
 spa/node/node.h
 
file  node/type-info.h
 spa/node/type-info.h
 

Data Structures

struct  spa_io_buffers
 IO area to exchange buffers. More...
 
struct  spa_io_memory
 IO area to exchange a memory region. More...
 
struct  spa_io_range
 A range, suitable for input ports that can suggest a range to output ports. More...
 
struct  spa_io_clock
 Absolute time reporting. More...
 
struct  spa_io_video_size
 
struct  spa_io_latency
 latency reporting More...
 
struct  spa_io_sequence
 control stream, io area for SPA_IO_Control and SPA_IO_Notify More...
 
struct  spa_io_segment_bar
 bar and beat segment More...
 
struct  spa_io_segment_video
 video frame segment More...
 
struct  spa_io_segment
 A segment converts a running time to a segment (stream) position. More...
 
struct  spa_io_position
 The position information adds extra meaning to the raw clock times. More...
 
struct  spa_io_rate_match
 rate matching More...
 
struct  spa_node
 
struct  spa_node_info
 Node information structure. More...
 
struct  spa_port_info
 Port information structure. More...
 
struct  spa_result_node_error
 an error result More...
 
struct  spa_result_node_params
 the result of enum_params or port_enum_params. More...
 
struct  spa_node_events
 events from the spa_node. More...
 
struct  spa_node_callbacks
 Node callbacks. More...
 
struct  spa_node_methods
 Node methods. More...
 
struct  spa_result_node_params_data
 

Macros

#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)
 
#define SPA_NODE_EVENT_ID(ev)   SPA_EVENT_ID(ev, SPA_TYPE_EVENT_Node)
 
#define SPA_NODE_EVENT_INIT(id)   SPA_EVENT_INIT(SPA_TYPE_EVENT_Node, id)
 
#define SPA_STATUS_OK   0
 
#define SPA_STATUS_NEED_DATA   (1<<0)
 
#define SPA_STATUS_HAVE_DATA   (1<<1)
 
#define SPA_STATUS_STOPPED   (1<<2)
 
#define SPA_STATUS_DRAINED   (1<<3)
 
#define SPA_IO_BUFFERS_INIT   ((struct spa_io_buffers) { SPA_STATUS_OK, SPA_ID_INVALID, })
 
#define SPA_IO_MEMORY_INIT   ((struct spa_io_memory) { SPA_STATUS_OK, 0, NULL, })
 
#define SPA_IO_CLOCK_FLAG_FREEWHEEL   (1u<<0)
 
#define SPA_IO_VIDEO_SIZE_VALID   (1<<0)
 
#define SPA_IO_SEGMENT_BAR_FLAG_VALID   (1<<0)
 
#define SPA_IO_SEGMENT_VIDEO_FLAG_VALID   (1<<0)
 
#define SPA_IO_SEGMENT_VIDEO_FLAG_DROP_FRAME   (1<<1)
 
#define SPA_IO_SEGMENT_VIDEO_FLAG_PULL_DOWN   (1<<2)
 
#define SPA_IO_SEGMENT_VIDEO_FLAG_INTERLACED   (1<<3)
 
#define SPA_IO_SEGMENT_FLAG_LOOPING   (1<<0)
 after the duration, the segment repeats More...
 
#define SPA_IO_SEGMENT_FLAG_NO_POSITION   (1<<1)
 position is invalid. More...
 
#define SPA_IO_POSITION_MAX_SEGMENTS   8
 the maximum number of segments visible in the future More...
 
#define SPA_IO_RATE_MATCH_FLAG_ACTIVE   (1 << 0)
 
#define SPA_KEY_NODE_NAME   "node.name"
 node keys More...
 
#define SPA_KEY_NODE_LATENCY   "node.latency"
 the requested node latency More...
 
#define SPA_KEY_NODE_MAX_LATENCY   "node.max-latency"
 maximum supported latency More...
 
#define SPA_KEY_NODE_DRIVER   "node.driver"
 the node can be a driver More...
 
#define SPA_KEY_NODE_ALWAYS_PROCESS   "node.always-process"
 call the process function even if not linked. More...
 
#define SPA_KEY_NODE_PAUSE_ON_IDLE   "node.pause-on-idle"
 if the node should be paused immediately when idle. More...
 
#define SPA_KEY_NODE_MONITOR   "node.monitor"
 the node has monitor ports More...
 
#define SPA_KEY_PORT_NAME   "port.name"
 port keys More...
 
#define SPA_KEY_PORT_ALIAS   "port.alias"
 a port alias More...
 
#define SPA_KEY_PORT_MONITOR   "port.monitor"
 this port is a monitor port More...
 
#define SPA_TYPE_INTERFACE_Node   SPA_TYPE_INFO_INTERFACE_BASE "Node"
 
#define SPA_VERSION_NODE   0
 
#define SPA_NODE_CHANGE_MASK_FLAGS   (1u<<0)
 
#define SPA_NODE_CHANGE_MASK_PROPS   (1u<<1)
 
#define SPA_NODE_CHANGE_MASK_PARAMS   (1u<<2)
 
#define SPA_NODE_FLAG_RT   (1u<<0)
 node can do real-time processing More...
 
#define SPA_NODE_FLAG_IN_DYNAMIC_PORTS   (1u<<1)
 input ports can be added/removed More...
 
#define SPA_NODE_FLAG_OUT_DYNAMIC_PORTS   (1u<<2)
 output ports can be added/removed More...
 
#define SPA_NODE_FLAG_IN_PORT_CONFIG   (1u<<3)
 input ports can be reconfigured with PortConfig parameter More...
 
#define SPA_NODE_FLAG_OUT_PORT_CONFIG   (1u<<4)
 output ports can be reconfigured with PortConfig parameter More...
 
#define SPA_NODE_FLAG_NEED_CONFIGURE   (1u<<5)
 node needs configuration before it can be started. More...
 
#define SPA_NODE_FLAG_ASYNC   (1u<<6)
 the process function might not immediately produce or consume data but might offload the work to a worker thread. More...
 
#define SPA_NODE_INFO_INIT()   ((struct spa_node_info) { 0, })
 
#define SPA_PORT_CHANGE_MASK_FLAGS   (1u<<0)
 
#define SPA_PORT_CHANGE_MASK_RATE   (1u<<1)
 
#define SPA_PORT_CHANGE_MASK_PROPS   (1u<<2)
 
#define SPA_PORT_CHANGE_MASK_PARAMS   (1u<<3)
 
#define SPA_PORT_FLAG_REMOVABLE   (1u<<0)
 port can be removed More...
 
#define SPA_PORT_FLAG_OPTIONAL   (1u<<1)
 processing on port is optional More...
 
#define SPA_PORT_FLAG_CAN_ALLOC_BUFFERS   (1u<<2)
 the port can allocate buffer data More...
 
#define SPA_PORT_FLAG_IN_PLACE   (1u<<3)
 the port can process data in-place and will need a writable input buffer More...
 
#define SPA_PORT_FLAG_NO_REF   (1u<<4)
 the port does not keep a ref on the buffer. More...
 
#define SPA_PORT_FLAG_LIVE   (1u<<5)
 output buffers from this port are timestamped against a live clock. More...
 
#define SPA_PORT_FLAG_PHYSICAL   (1u<<6)
 connects to some device More...
 
#define SPA_PORT_FLAG_TERMINAL   (1u<<7)
 data was not created from this port or will not be made available on another port More...
 
#define SPA_PORT_FLAG_DYNAMIC_DATA   (1u<<8)
 data pointer on buffers can be changed. More...
 
#define SPA_PORT_INFO_INIT()   ((struct spa_port_info) { 0, })
 
#define SPA_RESULT_TYPE_NODE_ERROR   1
 
#define SPA_RESULT_TYPE_NODE_PARAMS   2
 
#define SPA_NODE_EVENT_INFO   0
 
#define SPA_NODE_EVENT_PORT_INFO   1
 
#define SPA_NODE_EVENT_RESULT   2
 
#define SPA_NODE_EVENT_EVENT   3
 
#define SPA_NODE_EVENT_NUM   4
 
#define SPA_VERSION_NODE_EVENTS   0
 
#define SPA_NODE_CALLBACK_READY   0
 
#define SPA_NODE_CALLBACK_REUSE_BUFFER   1
 
#define SPA_NODE_CALLBACK_XRUN   2
 
#define SPA_NODE_CALLBACK_NUM   3
 
#define SPA_VERSION_NODE_CALLBACKS   0
 
#define SPA_NODE_PARAM_FLAG_TEST_ONLY   (1 << 0)
 flags that can be passed to set_param and port_set_param functions More...
 
#define SPA_NODE_PARAM_FLAG_FIXATE   (1 << 1)
 Fixate the non-optional unset fields. More...
 
#define SPA_NODE_PARAM_FLAG_NEAREST   (1 << 2)
 Allow set fields to be rounded to the nearest allowed field value. More...
 
#define SPA_NODE_BUFFERS_FLAG_ALLOC   (1 << 0)
 flags to pass to the use_buffers functions More...
 
#define SPA_NODE_METHOD_ADD_LISTENER   0
 
#define SPA_NODE_METHOD_SET_CALLBACKS   1
 
#define SPA_NODE_METHOD_SYNC   2
 
#define SPA_NODE_METHOD_ENUM_PARAMS   3
 
#define SPA_NODE_METHOD_SET_PARAM   4
 
#define SPA_NODE_METHOD_SET_IO   5
 
#define SPA_NODE_METHOD_SEND_COMMAND   6
 
#define SPA_NODE_METHOD_ADD_PORT   7
 
#define SPA_NODE_METHOD_REMOVE_PORT   8
 
#define SPA_NODE_METHOD_PORT_ENUM_PARAMS   9
 
#define SPA_NODE_METHOD_PORT_SET_PARAM   10
 
#define SPA_NODE_METHOD_PORT_USE_BUFFERS   11
 
#define SPA_NODE_METHOD_PORT_SET_IO   12
 
#define SPA_NODE_METHOD_PORT_REUSE_BUFFER   13
 
#define SPA_NODE_METHOD_PROCESS   14
 
#define SPA_NODE_METHOD_NUM   15
 
#define SPA_VERSION_NODE_METHODS   0
 
#define spa_node_method(o, method, version, ...)
 
#define spa_node_add_listener(n, ...)   spa_node_method(n, add_listener, 0, __VA_ARGS__)
 Adds an event listener on node. More...
 
#define spa_node_set_callbacks(n, ...)   spa_node_method(n, set_callbacks, 0, __VA_ARGS__)
 Set callbacks to on node. More...
 
#define spa_node_sync(n, ...)   spa_node_method(n, sync, 0, __VA_ARGS__)
 Perform a sync operation. More...
 
#define spa_node_enum_params(n, ...)   spa_node_method(n, enum_params, 0, __VA_ARGS__)
 Enumerate the parameters of a node. More...
 
#define spa_node_set_param(n, ...)   spa_node_method(n, set_param, 0, __VA_ARGS__)
 Set the configurable parameter in node. More...
 
#define spa_node_set_io(n, ...)   spa_node_method(n, set_io, 0, __VA_ARGS__)
 Configure the given memory area with id on node. More...
 
#define spa_node_send_command(n, ...)   spa_node_method(n, send_command, 0, __VA_ARGS__)
 Send a command to a node. More...
 
#define spa_node_add_port(n, ...)   spa_node_method(n, add_port, 0, __VA_ARGS__)
 Make a new port with port_id. More...
 
#define spa_node_remove_port(n, ...)   spa_node_method(n, remove_port, 0, __VA_ARGS__)
 Remove a port with port_id. More...
 
#define spa_node_port_enum_params(n, ...)   spa_node_method(n, port_enum_params, 0, __VA_ARGS__)
 Enumerate all possible parameters of id on port_id of node that are compatible with filter. More...
 
#define spa_node_port_set_param(n, ...)   spa_node_method(n, port_set_param, 0, __VA_ARGS__)
 Set a parameter on port_id of node. More...
 
#define spa_node_port_use_buffers(n, ...)   spa_node_method(n, port_use_buffers, 0, __VA_ARGS__)
 Tell the port to use the given buffers. More...
 
#define spa_node_port_set_io(n, ...)   spa_node_method(n, port_set_io, 0, __VA_ARGS__)
 Configure the given memory area with id on port_id. More...
 
#define spa_node_port_reuse_buffer(n, ...)   spa_node_method(n, port_reuse_buffer, 0, __VA_ARGS__)
 Tell an output port to reuse a buffer. More...
 
#define spa_node_process(n)   spa_node_method(n, process, 0)
 Process the node. More...
 
#define SPA_TYPE_INFO_IO   SPA_TYPE_INFO_ENUM_BASE "IO"
 
#define SPA_TYPE_INFO_IO_BASE   SPA_TYPE_INFO_IO ":"
 
#define SPA_TYPE_INFO_NodeEvent   SPA_TYPE_INFO_EVENT_BASE "Node"
 
#define SPA_TYPE_INFO_NODE_EVENT_BASE   SPA_TYPE_INFO_NodeEvent ":"
 
#define SPA_TYPE_INFO_NodeCommand   SPA_TYPE_INFO_COMMAND_BASE "Node"
 
#define SPA_TYPE_INFO_NODE_COMMAND_BASE   SPA_TYPE_INFO_NodeCommand ":"
 
#define spa_node_emit(hooks, method, version, ...)
 
#define spa_node_emit_info(hooks, ...)   spa_node_emit(hooks,info, 0, __VA_ARGS__)
 
#define spa_node_emit_port_info(hooks, ...)   spa_node_emit(hooks,port_info, 0, __VA_ARGS__)
 
#define spa_node_emit_result(hooks, ...)   spa_node_emit(hooks,result, 0, __VA_ARGS__)
 
#define spa_node_emit_event(hooks, ...)   spa_node_emit(hooks,event, 0, __VA_ARGS__)
 
#define spa_node_call(callbacks, method, version, ...)
 
#define spa_node_call_ready(hook, ...)   spa_node_call(hook, ready, 0, __VA_ARGS__)
 
#define spa_node_call_reuse_buffer(hook, ...)   spa_node_call(hook, reuse_buffer, 0, __VA_ARGS__)
 
#define spa_node_call_xrun(hook, ...)   spa_node_call(hook, xrun, 0, __VA_ARGS__)
 

Enumerations

enum  spa_node_command {
  SPA_NODE_COMMAND_Suspend , SPA_NODE_COMMAND_Pause , SPA_NODE_COMMAND_Start , SPA_NODE_COMMAND_Enable ,
  SPA_NODE_COMMAND_Disable , SPA_NODE_COMMAND_Flush , SPA_NODE_COMMAND_Drain , SPA_NODE_COMMAND_Marker ,
  SPA_NODE_COMMAND_ParamBegin , SPA_NODE_COMMAND_ParamEnd , SPA_NODE_COMMAND_RequestProcess
}
 
enum  spa_node_event { SPA_NODE_EVENT_Error , SPA_NODE_EVENT_Buffering , SPA_NODE_EVENT_RequestRefresh , SPA_NODE_EVENT_RequestProcess }
 
enum  spa_event_node { SPA_EVENT_NODE_START }
 
enum  spa_io_type {
  SPA_IO_Invalid , SPA_IO_Buffers , SPA_IO_Range , SPA_IO_Clock ,
  SPA_IO_Latency , SPA_IO_Control , SPA_IO_Notify , SPA_IO_Position ,
  SPA_IO_RateMatch , SPA_IO_Memory
}
 IO areas. More...
 
enum  spa_io_position_state { SPA_IO_POSITION_STATE_STOPPED , SPA_IO_POSITION_STATE_STARTING , SPA_IO_POSITION_STATE_RUNNING }
 

Functions

static void spa_result_func_node_params (void *data, int seq, int res, uint32_t type, const void *result)
 
static int spa_node_enum_params_sync (struct spa_node *node, uint32_t id, uint32_t *index, const struct spa_pod *filter, struct spa_pod **param, struct spa_pod_builder *builder)
 
static int spa_node_port_enum_params_sync (struct spa_node *node, enum spa_direction direction, uint32_t port_id, uint32_t id, uint32_t *index, const struct spa_pod *filter, struct spa_pod **param, struct spa_pod_builder *builder)
 

Variables

static const struct spa_type_info spa_type_io []
 
static const struct spa_type_info spa_type_node_event_id []
 
static const struct spa_type_info spa_type_node_event []
 
static const struct spa_type_info spa_type_node_command_id []
 
static const struct spa_type_info spa_type_node_command []
 

Detailed Description

A spa_node is a component that can consume and produce buffers.

Macro Definition Documentation

◆ SPA_NODE_COMMAND_ID

#define SPA_NODE_COMMAND_ID (   cmd)    SPA_COMMAND_ID(cmd, SPA_TYPE_COMMAND_Node)

◆ SPA_NODE_COMMAND_INIT

◆ SPA_NODE_EVENT_ID

#define SPA_NODE_EVENT_ID (   ev)    SPA_EVENT_ID(ev, SPA_TYPE_EVENT_Node)

◆ SPA_NODE_EVENT_INIT

#define SPA_NODE_EVENT_INIT (   id)    SPA_EVENT_INIT(SPA_TYPE_EVENT_Node, id)

◆ SPA_STATUS_OK

#define SPA_STATUS_OK   0

◆ SPA_STATUS_NEED_DATA

◆ SPA_STATUS_HAVE_DATA

◆ SPA_STATUS_STOPPED

#define SPA_STATUS_STOPPED   (1<<2)

◆ SPA_STATUS_DRAINED

#define SPA_STATUS_DRAINED   (1<<3)

◆ SPA_IO_BUFFERS_INIT

◆ SPA_IO_MEMORY_INIT

#define SPA_IO_MEMORY_INIT   ((struct spa_io_memory) { SPA_STATUS_OK, 0, NULL, })

◆ SPA_IO_CLOCK_FLAG_FREEWHEEL

#define SPA_IO_CLOCK_FLAG_FREEWHEEL   (1u<<0)

◆ SPA_IO_VIDEO_SIZE_VALID

#define SPA_IO_VIDEO_SIZE_VALID   (1<<0)

◆ SPA_IO_SEGMENT_BAR_FLAG_VALID

#define SPA_IO_SEGMENT_BAR_FLAG_VALID   (1<<0)

◆ SPA_IO_SEGMENT_VIDEO_FLAG_VALID

#define SPA_IO_SEGMENT_VIDEO_FLAG_VALID   (1<<0)

◆ SPA_IO_SEGMENT_VIDEO_FLAG_DROP_FRAME

#define SPA_IO_SEGMENT_VIDEO_FLAG_DROP_FRAME   (1<<1)

◆ SPA_IO_SEGMENT_VIDEO_FLAG_PULL_DOWN

#define SPA_IO_SEGMENT_VIDEO_FLAG_PULL_DOWN   (1<<2)

◆ SPA_IO_SEGMENT_VIDEO_FLAG_INTERLACED

#define SPA_IO_SEGMENT_VIDEO_FLAG_INTERLACED   (1<<3)

◆ SPA_IO_SEGMENT_FLAG_LOOPING

#define SPA_IO_SEGMENT_FLAG_LOOPING   (1<<0)

after the duration, the segment repeats

◆ SPA_IO_SEGMENT_FLAG_NO_POSITION

#define SPA_IO_SEGMENT_FLAG_NO_POSITION   (1<<1)

position is invalid.

The position can be invalid after a seek, for example, when the exact mapping of the extra segment info (bar, video, ...) to position has not been determined yet

◆ SPA_IO_POSITION_MAX_SEGMENTS

#define SPA_IO_POSITION_MAX_SEGMENTS   8

the maximum number of segments visible in the future

◆ SPA_IO_RATE_MATCH_FLAG_ACTIVE

#define SPA_IO_RATE_MATCH_FLAG_ACTIVE   (1 << 0)

◆ SPA_KEY_NODE_NAME

#define SPA_KEY_NODE_NAME   "node.name"

node keys

a node name

◆ SPA_KEY_NODE_LATENCY

#define SPA_KEY_NODE_LATENCY   "node.latency"

the requested node latency

◆ SPA_KEY_NODE_MAX_LATENCY

#define SPA_KEY_NODE_MAX_LATENCY   "node.max-latency"

maximum supported latency

◆ SPA_KEY_NODE_DRIVER

#define SPA_KEY_NODE_DRIVER   "node.driver"

the node can be a driver

◆ SPA_KEY_NODE_ALWAYS_PROCESS

#define SPA_KEY_NODE_ALWAYS_PROCESS   "node.always-process"

call the process function even if not linked.

◆ SPA_KEY_NODE_PAUSE_ON_IDLE

#define SPA_KEY_NODE_PAUSE_ON_IDLE   "node.pause-on-idle"

if the node should be paused immediately when idle.

◆ SPA_KEY_NODE_MONITOR

#define SPA_KEY_NODE_MONITOR   "node.monitor"

the node has monitor ports

◆ SPA_KEY_PORT_NAME

#define SPA_KEY_PORT_NAME   "port.name"

port keys

a port name

◆ SPA_KEY_PORT_ALIAS

#define SPA_KEY_PORT_ALIAS   "port.alias"

a port alias

◆ SPA_KEY_PORT_MONITOR

#define SPA_KEY_PORT_MONITOR   "port.monitor"

this port is a monitor port

◆ SPA_TYPE_INTERFACE_Node

◆ SPA_VERSION_NODE

#define SPA_VERSION_NODE   0

◆ SPA_NODE_CHANGE_MASK_FLAGS

#define SPA_NODE_CHANGE_MASK_FLAGS   (1u<<0)

◆ SPA_NODE_CHANGE_MASK_PROPS

#define SPA_NODE_CHANGE_MASK_PROPS   (1u<<1)

◆ SPA_NODE_CHANGE_MASK_PARAMS

#define SPA_NODE_CHANGE_MASK_PARAMS   (1u<<2)

◆ SPA_NODE_FLAG_RT

#define SPA_NODE_FLAG_RT   (1u<<0)

node can do real-time processing

◆ SPA_NODE_FLAG_IN_DYNAMIC_PORTS

#define SPA_NODE_FLAG_IN_DYNAMIC_PORTS   (1u<<1)

input ports can be added/removed

◆ SPA_NODE_FLAG_OUT_DYNAMIC_PORTS

#define SPA_NODE_FLAG_OUT_DYNAMIC_PORTS   (1u<<2)

output ports can be added/removed

◆ SPA_NODE_FLAG_IN_PORT_CONFIG

#define SPA_NODE_FLAG_IN_PORT_CONFIG   (1u<<3)

input ports can be reconfigured with PortConfig parameter

◆ SPA_NODE_FLAG_OUT_PORT_CONFIG

#define SPA_NODE_FLAG_OUT_PORT_CONFIG   (1u<<4)

output ports can be reconfigured with PortConfig parameter

◆ SPA_NODE_FLAG_NEED_CONFIGURE

#define SPA_NODE_FLAG_NEED_CONFIGURE   (1u<<5)

node needs configuration before it can be started.

◆ SPA_NODE_FLAG_ASYNC

#define SPA_NODE_FLAG_ASYNC   (1u<<6)

the process function might not immediately produce or consume data but might offload the work to a worker thread.

◆ SPA_NODE_INFO_INIT

#define SPA_NODE_INFO_INIT ( )    ((struct spa_node_info) { 0, })

◆ SPA_PORT_CHANGE_MASK_FLAGS

#define SPA_PORT_CHANGE_MASK_FLAGS   (1u<<0)

◆ SPA_PORT_CHANGE_MASK_RATE

#define SPA_PORT_CHANGE_MASK_RATE   (1u<<1)

◆ SPA_PORT_CHANGE_MASK_PROPS

#define SPA_PORT_CHANGE_MASK_PROPS   (1u<<2)
Examples
export-source.c.

◆ SPA_PORT_CHANGE_MASK_PARAMS

#define SPA_PORT_CHANGE_MASK_PARAMS   (1u<<3)

◆ SPA_PORT_FLAG_REMOVABLE

#define SPA_PORT_FLAG_REMOVABLE   (1u<<0)

port can be removed

◆ SPA_PORT_FLAG_OPTIONAL

#define SPA_PORT_FLAG_OPTIONAL   (1u<<1)

processing on port is optional

◆ SPA_PORT_FLAG_CAN_ALLOC_BUFFERS

#define SPA_PORT_FLAG_CAN_ALLOC_BUFFERS   (1u<<2)

the port can allocate buffer data

◆ SPA_PORT_FLAG_IN_PLACE

#define SPA_PORT_FLAG_IN_PLACE   (1u<<3)

the port can process data in-place and will need a writable input buffer

◆ SPA_PORT_FLAG_NO_REF

#define SPA_PORT_FLAG_NO_REF   (1u<<4)

the port does not keep a ref on the buffer.

This means the node will always completely consume the input buffer and it will be recycled after process.

◆ SPA_PORT_FLAG_LIVE

#define SPA_PORT_FLAG_LIVE   (1u<<5)

output buffers from this port are timestamped against a live clock.

◆ SPA_PORT_FLAG_PHYSICAL

#define SPA_PORT_FLAG_PHYSICAL   (1u<<6)

connects to some device

◆ SPA_PORT_FLAG_TERMINAL

#define SPA_PORT_FLAG_TERMINAL   (1u<<7)

data was not created from this port or will not be made available on another port

◆ SPA_PORT_FLAG_DYNAMIC_DATA

#define SPA_PORT_FLAG_DYNAMIC_DATA   (1u<<8)

data pointer on buffers can be changed.

Only the buffer data marked as DYNAMIC can be changed.

◆ SPA_PORT_INFO_INIT

#define SPA_PORT_INFO_INIT ( )    ((struct spa_port_info) { 0, })

◆ SPA_RESULT_TYPE_NODE_ERROR

#define SPA_RESULT_TYPE_NODE_ERROR   1

◆ SPA_RESULT_TYPE_NODE_PARAMS

#define SPA_RESULT_TYPE_NODE_PARAMS   2

◆ SPA_NODE_EVENT_INFO

#define SPA_NODE_EVENT_INFO   0

◆ SPA_NODE_EVENT_PORT_INFO

#define SPA_NODE_EVENT_PORT_INFO   1

◆ SPA_NODE_EVENT_RESULT

#define SPA_NODE_EVENT_RESULT   2

◆ SPA_NODE_EVENT_EVENT

#define SPA_NODE_EVENT_EVENT   3

◆ SPA_NODE_EVENT_NUM

#define SPA_NODE_EVENT_NUM   4

◆ SPA_VERSION_NODE_EVENTS

#define SPA_VERSION_NODE_EVENTS   0

◆ SPA_NODE_CALLBACK_READY

#define SPA_NODE_CALLBACK_READY   0

◆ SPA_NODE_CALLBACK_REUSE_BUFFER

#define SPA_NODE_CALLBACK_REUSE_BUFFER   1

◆ SPA_NODE_CALLBACK_XRUN

#define SPA_NODE_CALLBACK_XRUN   2

◆ SPA_NODE_CALLBACK_NUM

#define SPA_NODE_CALLBACK_NUM   3

◆ SPA_VERSION_NODE_CALLBACKS

◆ SPA_NODE_PARAM_FLAG_TEST_ONLY

#define SPA_NODE_PARAM_FLAG_TEST_ONLY   (1 << 0)

flags that can be passed to set_param and port_set_param functions

Just check if the param is accepted

◆ SPA_NODE_PARAM_FLAG_FIXATE

#define SPA_NODE_PARAM_FLAG_FIXATE   (1 << 1)

Fixate the non-optional unset fields.

◆ SPA_NODE_PARAM_FLAG_NEAREST

#define SPA_NODE_PARAM_FLAG_NEAREST   (1 << 2)

Allow set fields to be rounded to the nearest allowed field value.

◆ SPA_NODE_BUFFERS_FLAG_ALLOC

#define SPA_NODE_BUFFERS_FLAG_ALLOC   (1 << 0)

flags to pass to the use_buffers functions

Allocate memory for the buffers. This flag is ignored when the port does not have the SPA_PORT_FLAG_CAN_ALLOC_BUFFERS set.

Examples
spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ SPA_NODE_METHOD_ADD_LISTENER

#define SPA_NODE_METHOD_ADD_LISTENER   0

◆ SPA_NODE_METHOD_SET_CALLBACKS

#define SPA_NODE_METHOD_SET_CALLBACKS   1

◆ SPA_NODE_METHOD_SYNC

#define SPA_NODE_METHOD_SYNC   2

◆ SPA_NODE_METHOD_ENUM_PARAMS

#define SPA_NODE_METHOD_ENUM_PARAMS   3

◆ SPA_NODE_METHOD_SET_PARAM

#define SPA_NODE_METHOD_SET_PARAM   4

◆ SPA_NODE_METHOD_SET_IO

#define SPA_NODE_METHOD_SET_IO   5

◆ SPA_NODE_METHOD_SEND_COMMAND

#define SPA_NODE_METHOD_SEND_COMMAND   6

◆ SPA_NODE_METHOD_ADD_PORT

#define SPA_NODE_METHOD_ADD_PORT   7

◆ SPA_NODE_METHOD_REMOVE_PORT

#define SPA_NODE_METHOD_REMOVE_PORT   8

◆ SPA_NODE_METHOD_PORT_ENUM_PARAMS

#define SPA_NODE_METHOD_PORT_ENUM_PARAMS   9

◆ SPA_NODE_METHOD_PORT_SET_PARAM

#define SPA_NODE_METHOD_PORT_SET_PARAM   10

◆ SPA_NODE_METHOD_PORT_USE_BUFFERS

#define SPA_NODE_METHOD_PORT_USE_BUFFERS   11

◆ SPA_NODE_METHOD_PORT_SET_IO

#define SPA_NODE_METHOD_PORT_SET_IO   12

◆ SPA_NODE_METHOD_PORT_REUSE_BUFFER

#define SPA_NODE_METHOD_PORT_REUSE_BUFFER   13

◆ SPA_NODE_METHOD_PROCESS

#define SPA_NODE_METHOD_PROCESS   14

◆ SPA_NODE_METHOD_NUM

#define SPA_NODE_METHOD_NUM   15

◆ SPA_VERSION_NODE_METHODS

#define SPA_VERSION_NODE_METHODS   0

◆ spa_node_method

#define spa_node_method (   o,
  method,
  version,
  ... 
)

◆ spa_node_add_listener

#define spa_node_add_listener (   n,
  ... 
)    spa_node_method(n, add_listener, 0, __VA_ARGS__)

Adds an event listener on node.

Setting the events will trigger the info event and a port_info event for each managed port on the new listener.

Parameters
nodea spa_node
listenera listener
eventsa struct spa_node_events
datadata passed as first argument in functions of events
Returns
0 on success < 0 errno on error
See also
spa_node_methods.add_listener

◆ spa_node_set_callbacks

#define spa_node_set_callbacks (   n,
  ... 
)    spa_node_method(n, set_callbacks, 0, __VA_ARGS__)

Set callbacks to on node.

if callbacks is NULL, the current callbacks are removed.

This function must be called from the main thread.

All callbacks are called from the data thread.

Parameters
nodea spa_node
callbackscallbacks to set
Returns
0 on success -EINVAL when node is NULL
See also
spa_node_methods.set_callbacks
Examples
spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ spa_node_sync

#define spa_node_sync (   n,
  ... 
)    spa_node_method(n, sync, 0, __VA_ARGS__)

Perform a sync operation.

This method will emit the result event with the given sequence number synchronously or with the returned async return value asynchronously.

Because all methods are serialized in the node, this can be used to wait for completion of all previous method calls.

Parameters
seqa sequence number
Returns
0 on success -EINVAL when node is NULL an async result
See also
spa_node_methods.sync

◆ spa_node_enum_params

#define spa_node_enum_params (   n,
  ... 
)    spa_node_method(n, enum_params, 0, __VA_ARGS__)

Enumerate the parameters of a node.

Parameters are identified with an id. Some parameters can have multiple values, see the documentation of the parameter id.

Parameters can be filtered by passing a non-NULL filter.

The function will emit the result event up to max times with the result value. The seq in the result will either be the seq number when executed synchronously or the async return value of this function when executed asynchronously.

This function must be called from the main thread.

Parameters
nodea Node
seqa sequence number to pass to the result event when this method is executed synchronously.
idthe param id to enumerate
startthe index of enumeration, pass 0 for the first item
maxthe maximum number of parameters to enumerate
filterand optional filter to use
Returns
0 when no more items can be iterated. -EINVAL when invalid arguments are given -ENOENT the parameter id is unknown -ENOTSUP when there are no parameters implemented on node an async return value when the result event will be emitted later.
See also
spa_node_methods.enum_params

◆ spa_node_set_param

#define spa_node_set_param (   n,
  ... 
)    spa_node_method(n, set_param, 0, __VA_ARGS__)

Set the configurable parameter in node.

Usually, param will be obtained from enum_params and then modified but it is also possible to set another spa_pod as long as its keys and types match a supported object.

Objects with property keys that are not known are ignored.

This function must be called from the main thread.

Parameters
nodea Node
idthe parameter id to configure
flagsadditional flags
paramthe parameter to configure
Returns
0 on success -EINVAL when node is NULL -ENOTSUP when there are no parameters implemented on node -ENOENT the parameter is unknown
See also
spa_node_methods.set_param
Examples
spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ spa_node_set_io

#define spa_node_set_io (   n,
  ... 
)    spa_node_method(n, set_io, 0, __VA_ARGS__)

Configure the given memory area with id on node.

This structure is allocated by the host and is used to exchange data and parameters with the node.

Setting an io of NULL will disable the node io.

This function must be called from the main thread.

Parameters
idthe id of the io area, the available ids can be enumerated with the node parameters.
dataa io area memory
sizethe size of data
Returns
0 on success -EINVAL when invalid input is given -ENOENT when id is unknown -ENOSPC when size is too small
See also
spa_node_methods.set_io
Examples
spa/examples/adapter-control.c.

◆ spa_node_send_command

#define spa_node_send_command (   n,
  ... 
)    spa_node_method(n, send_command, 0, __VA_ARGS__)

Send a command to a node.

Upon completion, a command might change the state of a node.

This function must be called from the main thread.

Parameters
nodea spa_node
commanda spa_command
Returns
0 on success -EINVAL when node or command is NULL -ENOTSUP when this node can't process commands -EINVAL command is an invalid command
See also
spa_node_methods.send_command
Examples
spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ spa_node_add_port

#define spa_node_add_port (   n,
  ... 
)    spa_node_method(n, add_port, 0, __VA_ARGS__)

Make a new port with port_id.

The caller should use the lowest unused port id for the given direction.

Port ids should be between 0 and max_ports as obtained from the info event.

This function must be called from the main thread.

Parameters
nodea spa_node
directiona enum spa_direction
port_idan unused port id
propsextra properties
Returns
0 on success -EINVAL when node is NULL
See also
spa_node_methods.add_port

◆ spa_node_remove_port

#define spa_node_remove_port (   n,
  ... 
)    spa_node_method(n, remove_port, 0, __VA_ARGS__)

Remove a port with port_id.

Parameters
nodea spa_node
directiona enum spa_direction
port_ida port id
Returns
0 on success -EINVAL when node is NULL or when port_id is unknown or when the port can't be removed.
See also
spa_node_methods.remove_port

◆ spa_node_port_enum_params

#define spa_node_port_enum_params (   n,
  ... 
)    spa_node_method(n, port_enum_params, 0, __VA_ARGS__)

Enumerate all possible parameters of id on port_id of node that are compatible with filter.

The result parameters can be queried and modified and ultimately be used to call port_set_param.

The function will emit the result event up to max times with the result value. The seq in the result event will either be the seq number when executed synchronously or the async return value of this function when executed asynchronously.

This function must be called from the main thread.

Parameters
nodea spa_node
seqa sequence number to pass to the result event when this method is executed synchronously.
directionan spa_direction
port_idthe port to query
idthe parameter id to query
startthe first index to query, 0 to get the first item
maxthe maximum number of params to query
filtera parameter filter or NULL for no filter
Returns
0 when no more items can be iterated. -EINVAL when invalid parameters are given -ENOENT when id is unknown an async return value when the result event will be emitted later.
See also
spa_node_methods.port_enum_params

◆ spa_node_port_set_param

#define spa_node_port_set_param (   n,
  ... 
)    spa_node_method(n, port_set_param, 0, __VA_ARGS__)

Set a parameter on port_id of node.

When param is NULL, the parameter will be unset.

This function must be called from the main thread.

Parameters
nodea struct Node
directiona enum spa_direction
port_idthe port to configure
idthe parameter id to set
flagsoptional flags
parama struct POD with the parameter to set
Returns
0 on success 1 on success, the value of param might have been changed depending on flags and the final value can be found by doing port_enum_params. -EINVAL when node is NULL or invalid arguments are given -ESRCH when one of the mandatory param properties is not specified and SPA_NODE_PARAM_FLAG_FIXATE was not set in flags. -ESRCH when the type or size of a property is not correct. -ENOENT when the param id is not found
See also
spa_node_methods.port_set_param
Examples
spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ spa_node_port_use_buffers

#define spa_node_port_use_buffers (   n,
  ... 
)    spa_node_method(n, port_use_buffers, 0, __VA_ARGS__)

Tell the port to use the given buffers.

When flags contains SPA_NODE_BUFFERS_FLAG_ALLOC, the data in the buffers should point to an array of at least 1 data entry with the desired supported type that will be filled by this function.

The port should also have a spa_io_buffers io area configured to exchange the buffers with the port.

For an input port, all the buffers will remain dequeued. Once a buffer has been queued on a port in the spa_io_buffers, it should not be reused until the reuse_buffer callback is notified or when the buffer has been returned in the spa_io_buffers of the port.

For output ports, all buffers will be queued in the port. When process returns SPA_STATUS_HAVE_DATA, buffers are available in one or more of the spa_io_buffers areas.

When a buffer can be reused, port_reuse_buffer() should be called or the buffer_id should be placed in the spa_io_buffers area before calling process.

Passing NULL as buffers will remove the reference that the port has on the buffers.

When this function returns async, use the spa_node_sync operation to wait for completion.

This function must be called from the main thread.

Parameters
objectan object implementing the interface
directiona port direction
port_ida port id
flagsextra flags
buffersan array of buffer pointers
n_buffersnumber of elements in buffers
Returns
0 on success
See also
spa_node_methods.port_use_buffers
Examples
spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ spa_node_port_set_io

#define spa_node_port_set_io (   n,
  ... 
)    spa_node_method(n, port_set_io, 0, __VA_ARGS__)

Configure the given memory area with id on port_id.

This structure is allocated by the host and is used to exchange data and parameters with the port.

Setting an io of NULL will disable the port io.

This function must be called from the main thread.

Parameters
directiona spa_direction
port_ida port id
idthe id of the io area, the available ids can be enumerated with the port parameters.
dataa io area memory
sizethe size of data
Returns
0 on success -EINVAL when invalid input is given -ENOENT when id is unknown -ENOSPC when size is too small
See also
spa_node_methods.port_set_io
Examples
spa/examples/adapter-control.c, spa/examples/example-control.c, spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ spa_node_port_reuse_buffer

#define spa_node_port_reuse_buffer (   n,
  ... 
)    spa_node_method(n, port_reuse_buffer, 0, __VA_ARGS__)

Tell an output port to reuse a buffer.

This function must be called from the data thread.

Parameters
nodea spa_node
port_ida port id
buffer_ida buffer id to reuse
Returns
0 on success -EINVAL when node is NULL
See also
spa_node_methods.port_reuse_buffer

◆ spa_node_process

#define spa_node_process (   n)    spa_node_method(n, process, 0)

Process the node.

This function must be called from the data thread.

Output io areas with SPA_STATUS_NEED_DATA will recycle the buffers if any.

Input areas with SPA_STATUS_HAVE_DATA are consumed if possible and the status is set to SPA_STATUS_NEED_DATA or SPA_STATUS_OK.

When the node has new output buffers, the SPA_STATUS_HAVE_DATA bit will be set.

When the node can accept new input in the next cycle, the SPA_STATUS_NEED_DATA bit will be set.

Note that the node might return SPA_STATUS_NEED_DATA even when no input ports have this status. This means that the amount of data still available on the input ports is likely not going to be enough for the next cycle and the host might need to prefetch data for the next cycle.

See also
spa_node_methods.process
Examples
spa/examples/local-libcamera.c, and spa/examples/local-v4l2.c.

◆ SPA_TYPE_INFO_IO

#define SPA_TYPE_INFO_IO   SPA_TYPE_INFO_ENUM_BASE "IO"

◆ SPA_TYPE_INFO_IO_BASE

#define SPA_TYPE_INFO_IO_BASE   SPA_TYPE_INFO_IO ":"

◆ SPA_TYPE_INFO_NodeEvent

#define SPA_TYPE_INFO_NodeEvent   SPA_TYPE_INFO_EVENT_BASE "Node"

◆ SPA_TYPE_INFO_NODE_EVENT_BASE

#define SPA_TYPE_INFO_NODE_EVENT_BASE   SPA_TYPE_INFO_NodeEvent ":"

◆ SPA_TYPE_INFO_NodeCommand

#define SPA_TYPE_INFO_NodeCommand   SPA_TYPE_INFO_COMMAND_BASE "Node"

◆ SPA_TYPE_INFO_NODE_COMMAND_BASE

#define SPA_TYPE_INFO_NODE_COMMAND_BASE   SPA_TYPE_INFO_NodeCommand ":"

◆ spa_node_emit

#define spa_node_emit (   hooks,
  method,
  version,
  ... 
)

◆ spa_node_emit_info

#define spa_node_emit_info (   hooks,
  ... 
)    spa_node_emit(hooks,info, 0, __VA_ARGS__)

◆ spa_node_emit_port_info

#define spa_node_emit_port_info (   hooks,
  ... 
)    spa_node_emit(hooks,port_info, 0, __VA_ARGS__)

◆ spa_node_emit_result

#define spa_node_emit_result (   hooks,
  ... 
)    spa_node_emit(hooks,result, 0, __VA_ARGS__)

◆ spa_node_emit_event

#define spa_node_emit_event (   hooks,
  ... 
)    spa_node_emit(hooks,event, 0, __VA_ARGS__)

◆ spa_node_call

#define spa_node_call (   callbacks,
  method,
  version,
  ... 
)

◆ spa_node_call_ready

#define spa_node_call_ready (   hook,
  ... 
)    spa_node_call(hook, ready, 0, __VA_ARGS__)

◆ spa_node_call_reuse_buffer

#define spa_node_call_reuse_buffer (   hook,
  ... 
)    spa_node_call(hook, reuse_buffer, 0, __VA_ARGS__)

◆ spa_node_call_xrun

#define spa_node_call_xrun (   hook,
  ... 
)    spa_node_call(hook, xrun, 0, __VA_ARGS__)

Enumeration Type Documentation

◆ spa_node_command

Enumerator
SPA_NODE_COMMAND_Suspend 

suspend a node, this removes all configured formats and closes any devices

SPA_NODE_COMMAND_Pause 

pause a node.

this makes it stop emitting scheduling events

SPA_NODE_COMMAND_Start 

start a node, this makes it start emitting scheduling events

SPA_NODE_COMMAND_Enable 
SPA_NODE_COMMAND_Disable 
SPA_NODE_COMMAND_Flush 
SPA_NODE_COMMAND_Drain 
SPA_NODE_COMMAND_Marker 
SPA_NODE_COMMAND_ParamBegin 

begin a set of parameter enumerations or configuration that require the device to remain opened, like query formats and then set a format

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_event

Enumerator
SPA_NODE_EVENT_Error 
SPA_NODE_EVENT_Buffering 
SPA_NODE_EVENT_RequestRefresh 
SPA_NODE_EVENT_RequestProcess 

◆ spa_event_node

Enumerator
SPA_EVENT_NODE_START 

◆ spa_io_type

IO areas.

IO information for a port on a node. This is allocated by the host and configured on a node or all ports for which IO is requested.

The plugin will communicate with the host through the IO areas. Different IO area types

Enumerator
SPA_IO_Invalid 
SPA_IO_Buffers 

area to exchange buffers, struct spa_io_buffers

SPA_IO_Range 

expected byte range, struct spa_io_range

SPA_IO_Clock 

area to update clock information, struct spa_io_clock

SPA_IO_Latency 

latency reporting, struct spa_io_latency

SPA_IO_Control 

area for control messages, struct spa_io_sequence

SPA_IO_Notify 

area for notify messages, struct spa_io_sequence

SPA_IO_Position 

position information in the graph, struct spa_io_position

SPA_IO_RateMatch 

rate matching between nodes, struct spa_io_rate_match

SPA_IO_Memory 

memory pointer, struct spa_io_memory

◆ spa_io_position_state

Enumerator
SPA_IO_POSITION_STATE_STOPPED 
SPA_IO_POSITION_STATE_STARTING 
SPA_IO_POSITION_STATE_RUNNING 

Function Documentation

◆ spa_result_func_node_params()

static void spa_result_func_node_params ( void *  data,
int  seq,
int  res,
uint32_t  type,
const void *  result 
)
inlinestatic

◆ spa_node_enum_params_sync()

static int spa_node_enum_params_sync ( struct spa_node node,
uint32_t  id,
uint32_t *  index,
const struct spa_pod filter,
struct spa_pod **  param,
struct spa_pod_builder builder 
)
inlinestatic

◆ spa_node_port_enum_params_sync()

static int spa_node_port_enum_params_sync ( struct spa_node node,
enum spa_direction  direction,
uint32_t  port_id,
uint32_t  id,
uint32_t *  index,
const struct spa_pod filter,
struct spa_pod **  param,
struct spa_pod_builder builder 
)
inlinestatic

Variable Documentation

◆ spa_type_io

const struct spa_type_info spa_type_io[]
static

◆ spa_type_node_event_id

const struct spa_type_info spa_type_node_event_id[]
static

◆ spa_type_node_event

const struct spa_type_info spa_type_node_event[]
static

◆ spa_type_node_command_id

const struct spa_type_info spa_type_node_command_id[]
static

◆ spa_type_node_command

const struct spa_type_info spa_type_node_command[]
static