Go to the documentation of this file.
25 #ifndef PIPEWIRE_STREAM_H
26 #define PIPEWIRE_STREAM_H
152 #include <spa/buffer/buffer.h>
153 #include <spa/param/param.h>
185 struct spa_fraction
rate;
201 #define PW_VERSION_STREAM_EVENTS 0
276 struct spa_hook *listener,
302 const struct spa_pod **params,
318 const char *error, ... ) SPA_PRINTF_FUNC(3, 4);
328 const struct spa_pod **params,
parameters to map a memory range
Definition: mem.h:171
static uint32_t int int res
Definition: core.h:323
void * user_data
user data attached to the buffer
Definition: stream.h:166
void(* param_changed)(void *data, uint32_t id, const struct spa_pod *param)
when a parameter changed
Definition: stream.h:215
uint32_t max_values
max values that can be set on this control
Definition: stream.h:179
uint32_t flags
extra flags
Definition: properties.h:47
static uint32_t id
Definition: core.h:322
uint32_t n_params
number of items in params
Definition: node.h:79
SPA_EXPORT int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer)
Submit a buffer for playback or recycle a buffer for capture.
Definition: stream.c:1764
#define BUFFER_FLAG_MAPPED
Definition: stream.c:55
#define PW_KEY_FORMAT_DSP
format related properties
Definition: keys.h:256
struct pw_stream * pw_stream_new(struct pw_core *core, const char *name, struct pw_properties *props)
Create a new unconneced pw_stream.
Definition: stream.c:1146
#define pw_log_error(...)
unsigned int allow_mlock
Definition: stream.c:137
int pw_proxy_error(struct pw_proxy *proxy, int res, const char *error)
Generate an error for a proxy.
Definition: proxy.c:329
SPA_EXPORT void pw_stream_add_listener(struct pw_stream *stream, struct spa_hook *listener, const struct pw_stream_events *events, void *data)
Definition: stream.c:1266
struct spa_param_info * params
parameters
Definition: node.h:78
#define PW_KEY_STREAM_IS_LIVE
Stream properties.
Definition: keys.h:222
enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **error)
Definition: stream.c:1275
void(* destroy)(void *data)
Definition: stream.h:204
struct spa_hook stream_listener
Definition: stream.c:69
struct queue queued
Definition: stream.c:127
#define PW_TYPE_INTERFACE_Node
Definition: node.h:42
@ PW_STREAM_FLAG_DRIVER
be a driver
Definition: stream.h:245
const char * pw_stream_get_name(struct pw_stream *stream)
Definition: stream.c:1283
const struct pw_properties * pw_stream_get_properties(struct pw_stream *stream)
Definition: stream.c:1289
unsigned int drained
Definition: stream.c:136
SPA_EXPORT int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_values, float *values,...)
Set control values.
Definition: stream.c:1626
void(* remove_buffer)(void *data, struct pw_buffer *buffer)
when a buffer was destroyed for this stream
Definition: stream.h:220
SPA_EXPORT int pw_impl_node_set_param(struct pw_impl_node *node, uint32_t id, uint32_t flags, const struct spa_pod *param)
Definition: impl-node.c:1687
int pw_core_disconnect(struct pw_core *core)
disconnect and destroy a core
Definition: core.c:449
void(* add_buffer)(void *data, struct pw_buffer *buffer)
when a new buffer was created for this stream
Definition: stream.h:218
@ PW_STREAM_FLAG_EXCLUSIVE
require exclusive access to the device
Definition: stream.h:249
int pw_stream_set_active(struct pw_stream *stream, bool active)
Activate or deactivate the stream.
Definition: stream.c:1690
void pw_context_destroy(struct pw_context *context)
destroy a context object, all resources except the main_loop will be destroyed
SPA_EXPORT void pw_impl_node_destroy(struct pw_impl_node *node)
Destroy a node.
Definition: impl-node.c:1530
#define PW_KEY_NODE_AUTOCONNECT
node wants to be automatically connected to a compatible node
Definition: keys.h:134
#define pw_direction
Definition: port.h:47
A time structure.
Definition: stream.h:183
SPA_EXPORT void pw_proxy_destroy(struct pw_proxy *proxy)
Destroy a proxy object.
Definition: proxy.c:231
Proxy events, use pw_proxy_add_listener.
Definition: proxy.h:106
unsigned int warn_mlock
Definition: stream.c:138
struct spa_node impl_node
Definition: stream.c:103
void(* drained)(void *data)
The stream is drained.
Definition: stream.h:229
uint32_t ids[MAX_BUFFERS]
Definition: filter.c:64
uint32_t media_subtype
Definition: stream.c:121
uint32_t id
Definition: filter.c:76
unsigned int disconnecting
Definition: stream.c:133
int64_t delay
delay to device, add to ticks to get the time of the device.
Definition: stream.h:188
struct spa_list param_list
Definition: stream.c:117
void(* io_changed)(void *data, uint32_t id, void *area, uint32_t size)
when io changed on the stream.
Definition: stream.h:213
@ PW_STREAM_STATE_PAUSED
paused
Definition: stream.h:160
int pw_impl_node_set_active(struct pw_impl_node *node, bool active)
Set a node active.
Definition: impl-node.c:1867
SPA_EXPORT int pw_stream_set_error(struct pw_stream *stream, int res, const char *error,...)
Definition: stream.c:1587
struct spa_io_position * position
Definition: stream.c:108
#define PW_DIRECTION_INPUT
Definition: port.h:48
int pw_impl_node_set_implementation(struct pw_impl_node *node, struct spa_node *spa_node)
Set the node implementation.
Definition: impl-node.c:1471
struct spa_port_info port_info
Definition: stream.c:115
struct pw_impl_node * pw_context_create_node(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Create a new node.
Definition: impl-node.c:969
struct spa_dict dict
dictionary of key/values
Definition: properties.h:46
uint64_t ticks
the ticks at now.
Definition: stream.h:186
uintptr_t seq
Definition: stream.c:130
enum spa_direction direction
Definition: stream.c:98
const char * path
Definition: stream.c:93
SPA_EXPORT struct pw_core * pw_stream_get_core(struct pw_stream *stream)
Definition: stream.c:1312
unsigned int draining
Definition: stream.c:135
struct spa_hook_list hooks
Definition: stream.c:105
struct spa_pod * param
Definition: filter.c:80
#define pw_log(lev,...)
Definition: log.h:76
#define PW_VERSION_PROXY_EVENTS
Definition: proxy.h:107
void pw_impl_node_add_listener(struct pw_impl_node *node, struct spa_hook *listener, const struct pw_impl_node_events *events, void *data)
Add an event listener.
Definition: impl-node.c:1513
@ PW_STREAM_STATE_ERROR
the stream is in error
Definition: stream.h:157
SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:428
#define NAME
Definition: stream.c:45
struct pw_stream_control control
Definition: stream.c:84
uint64_t size
This field is set by the user and the sum of all queued buffer is returned in the time info.
Definition: stream.h:167
int int pw_stream_update_params(struct pw_stream *stream, const struct spa_pod **params, uint32_t n_params)
Complete the negotiation process with result code res.
Definition: stream.c:1609
enum pw_stream_flags flags
Definition: stream.c:99
unsigned int free_proxy
Definition: stream.c:134
buffer[1023]
Definition: core.h:327
#define BUFFER_FLAG_QUEUED
Definition: stream.c:56
#define PW_KEY_MEDIA_CLASS
class Ex: "Video/Source"
Definition: keys.h:242
uint32_t n_values
number of values in array
Definition: stream.h:178
struct spa_io_buffers * io
Definition: stream.c:109
@ PW_STREAM_FLAG_ALLOC_BUFFERS
the application will allocate buffer memory.
Definition: stream.h:253
struct data data
Definition: stream.c:129
SPA_EXPORT const struct pw_stream_control * pw_stream_get_control(struct pw_stream *stream, uint32_t id)
Definition: stream.c:1676
#define PW_KEY_NODE_EXCLUSIVE
node wants exclusive access to resources
Definition: keys.h:133
int64_t now
the monotonic time
Definition: stream.h:184
unsigned int emitted
Definition: stream.c:86
static uint32_t int int const char * message
Definition: core.h:323
#define PARAM_FLAG_LOCKED
Definition: stream.c:74
uint32_t id
Definition: stream.c:81
#define PW_VERSION_IMPL_NODE_EVENTS
Definition: impl-node.h:54
#define pw_log_debug(...)
struct spa_pod * info
Definition: stream.c:85
uint32_t version
Definition: stream.h:202
struct spa_list link
Definition: stream.c:83
void(* control_info)(void *data, uint32_t id, const struct pw_stream_control *control)
Notify information about a control.
Definition: stream.h:210
SPA_EXPORT int pw_stream_flush(struct pw_stream *stream, bool drain)
Flush a stream.
Definition: stream.c:1809
#define PW_KEY_APP_PROCESS_BINARY
binary name
Definition: keys.h:106
struct pw_impl_node * node
Definition: stream.c:101
SPA_EXPORT int pw_properties_update(struct pw_properties *props, const struct spa_dict *dict)
Update properties.
Definition: properties.c:258
SPA_EXPORT const struct pw_properties * pw_stream_get_properties(struct pw_stream *stream)
Definition: stream.c:1289
Node events, listen to them with pw_impl_node_add_listener.
Definition: impl-node.h:53
#define pw_core_add_listener(c,...)
Definition: core.h:313
#define PW_KEY_NODE_DONT_RECONNECT
don't reconnect this node
Definition: keys.h:140
struct pw_proxy * pw_core_export(struct pw_core *core, const char *type, const struct spa_dict *props, void *object, size_t user_data_size)
Export an object into the PipeWire instance associated with core.
Definition: core.c:242
SPA_EXPORT struct pw_stream * pw_stream_new_simple(struct pw_loop *loop, const char *name, struct pw_properties *props, const struct pw_stream_events *events, void *data)
Definition: stream.c:1168
@ PW_STREAM_FLAG_AUTOCONNECT
try to automatically connect this stream
Definition: stream.h:239
#define MAX_BUFFERS
Definition: stream.c:47
#define PW_NODE_CHANGE_MASK_PARAMS
Definition: node.h:70
uint32_t type
Definition: stream.c:82
void * pw_impl_factory_create_object(struct pw_impl_factory *factory, struct pw_resource *resource, const char *type, uint32_t version, struct pw_properties *properties, uint32_t new_id)
Definition: impl-factory.c:261
#define PW_KEY_NODE_NAME
node name
Definition: keys.h:125
@ PW_STREAM_FLAG_MAP_BUFFERS
mmap the buffers
Definition: stream.h:244
static uint32_t int int const char va_list args
Definition: core.h:324
#define PW_VERSION_CORE_EVENTS
Definition: core.h:103
SPA_EXPORT struct pw_buffer * pw_stream_dequeue_buffer(struct pw_stream *stream)
Get a buffer that can be filled for playback streams or consumed for capture streams.
Definition: stream.c:1746
#define MASK_BUFFERS
Definition: stream.c:49
#define PW_KEY_MEDIA_NAME
media name.
Definition: keys.h:243
struct pw_context * pw_context_new(struct pw_loop *main_loop, struct pw_properties *props, size_t user_data_size)
Make a new context object for a given main_loop.
struct buffer buffers[MAX_BUFFERS]
Definition: stream.c:123
int pw_stream_set_error(struct pw_stream *stream, int res, const char *error,...) SPA_PRINTF_FUNC(3
Set the stream in error state.
struct spa_hook context_listener
Definition: stream.c:96
struct pw_time time
Definition: stream.c:131
float values[64]
Definition: stream.c:87
int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer)
Submit a buffer for playback or recycle a buffer for capture.
Definition: stream.c:1764
SPA_EXPORT struct pw_properties * pw_properties_copy(const struct pw_properties *properties)
Copy a properties object.
Definition: properties.c:200
float * values
array of values
Definition: stream.h:177
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:395
struct spa_node_methods node_methods
Definition: stream.c:104
@ PW_STREAM_FLAG_RT_PROCESS
call process from the realtime thread
Definition: stream.h:246
@ PW_STREAM_STATE_STREAMING
streaming
Definition: stream.h:161
struct pw_properties * port_props
Definition: stream.c:116
struct pw_stream this
Definition: stream.c:91
const char * pw_stream_state_as_string(enum pw_stream_state state)
Convert a stream state to a readable string.
Definition: stream.c:1207
#define pw_log_trace(...)
uint32_t flags
Definition: filter.c:78
SPA_EXPORT struct pw_impl_factory * pw_context_find_factory(struct pw_context *context, const char *name)
Find a factory by name.
Definition: impl-factory.c:287
pw_stream_flags
Definition: stream.h:237
void pw_proxy_add_listener(struct pw_proxy *proxy, struct spa_hook *listener, const struct pw_proxy_events *events, void *data)
Add an event listener to proxy.
Definition: proxy.c:196
SPA_EXPORT const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:451
uint32_t media_type
Definition: stream.c:120
struct pw_context * context
Definition: stream.c:95
int pw_stream_disconnect(struct pw_stream *stream)
Disconnect stream.
Definition: stream.c:1559
uint32_t id
Definition: filter.c:57
uint32_t n_buffers
Definition: stream.c:124
struct pw_buffer * pw_stream_dequeue_buffer(struct pw_stream *stream)
Get a buffer that can be filled for playback streams or consumed for capture streams.
Definition: stream.c:1746
@ PW_STREAM_FLAG_INACTIVE
start the stream inactive, pw_stream_set_active() needs to be called explicitly
Definition: stream.h:241
int pw_impl_node_update_properties(struct pw_impl_node *node, const struct spa_dict *dict)
Update the node properties.
Definition: impl-node.c:1131
void(* process)(void *data)
when a buffer can be queued (for playback streams) or dequeued (for capture streams).
Definition: stream.h:226
float max
max value
Definition: stream.h:176
struct spa_param_info params[5]
Definition: stream.c:118
struct spa_buffer * buffer
the spa buffer
Definition: stream.h:165
struct pw_core * pw_stream_get_core(struct pw_stream *stream)
Definition: stream.c:1312
#define PW_KEY_NODE_DRIVER
node can drive the graph
Definition: keys.h:143
void(* state_changed)(void *data, enum pw_stream_state old, enum pw_stream_state state, const char *error)
when the stream state changes
Definition: stream.h:206
struct pw_buffer this
Definition: filter.c:56
float def
default value
Definition: stream.h:174
struct pw_control this
Definition: control.c:34
#define PW_KEY_APP_NAME
application keys
Definition: keys.h:95
SPA_EXPORT const char * pw_stream_get_name(struct pw_stream *stream)
Definition: stream.c:1283
struct spa_ringbuffer ring
Definition: filter.c:65
int pw_impl_node_for_each_param(struct pw_impl_node *node, int seq, uint32_t param_id, uint32_t index, uint32_t max, const struct spa_pod *filter, int(*callback)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param), void *data)
Definition: impl-node.c:1652
int pw_stream_flush(struct pw_stream *stream, bool drain)
Flush a stream.
Definition: stream.c:1809
void pw_stream_destroy(struct pw_stream *stream)
Destroy a stream.
Definition: stream.c:1225
@ PW_STREAM_FLAG_DONT_RECONNECT
don't try to reconnect this stream when the sink/source is removed
Definition: stream.h:251
int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_values, float *values,...)
Set control values.
Definition: stream.c:1626
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:95
@ PW_STREAM_FLAG_NONE
no flags
Definition: stream.h:238
struct spa_list link
Definition: filter.c:79
pw_stream_state
Definition: stream.h:156
SPA_EXPORT int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict *dict)
Definition: stream.c:1295
static uint32_t int seq
Definition: core.h:322
PipeWire stream object class.
uint32_t pw_stream_get_node_id(struct pw_stream *stream)
Get the node ID of the stream.
Definition: stream.c:1553
SPA_EXPORT enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **error)
Definition: stream.c:1275
#define PW_ID_ANY
Definition: core.h:49
@ PW_STREAM_FLAG_NO_CONVERT
don't convert format
Definition: stream.h:248
struct queue dequeued
Definition: stream.c:126
@ PW_STREAM_STATE_CONNECTING
connection is in progress
Definition: stream.h:159
uint32_t change_mask_all
Definition: stream.c:114
#define pw_loop_invoke(l,...)
Definition: loop.h:57
void pw_stream_add_listener(struct pw_stream *stream, struct spa_hook *listener, const struct pw_stream_events *events, void *data)
Definition: stream.c:1266
#define PW_KEY_NODE_TARGET
node want to be connected to the target node/session
Definition: keys.h:136
struct spa_callbacks callbacks
Definition: stream.c:106
PipeWire factory interface.
int pw_stream_connect(struct pw_stream *stream, enum pw_direction direction, uint32_t target_id, enum pw_stream_flags flags, const struct spa_pod **params, uint32_t n_params)
Connect a stream for input or output on port_path.
Definition: stream.c:1384
uint64_t change_mask
bitfield of changed fields since last call
Definition: node.h:72
int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict *dict)
Definition: stream.c:1295
#define PW_KEY_STREAM_MONITOR
Indicates that the stream is monitoring and might select a less accurate but faster conversion algori...
Definition: keys.h:225
uint64_t incount
Definition: filter.c:66
SPA_EXPORT struct pw_core * pw_context_connect(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Definition: core.c:369
The node information.
Definition: node.h:62
uint32_t flags
Definition: filter.c:60
struct pw_stream * pw_stream_new_simple(struct pw_loop *loop, const char *name, struct pw_properties *props, const struct pw_stream_events *events, void *data)
Definition: stream.c:1168
struct spa_fraction rate
the rate of ticks and delay
Definition: stream.h:185
int pw_stream_get_time(struct pw_stream *stream, struct pw_time *time)
Query the time on the stream.
Definition: stream.c:1700
struct pw_context * context
Definition: filter.c:71
#define PW_VERSION_NODE
Definition: node.h:44
@ PW_STREAM_STATE_UNCONNECTED
unconnected
Definition: stream.h:158
float min
min value
Definition: stream.h:175
A collection of key/value pairs.
Definition: properties.h:45
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:330
uint32_t flags
extra flags (unused)
Definition: stream.h:173
uint64_t queued
data queued in the stream, this is the sum of the size fields in the pw_buffer that are currently que...
Definition: stream.h:191
Core events.
Definition: core.h:102
uint64_t outcount
Definition: filter.c:67
const char * name
name of the control
Definition: stream.h:172
Events for a stream.
Definition: stream.h:200