Go to the documentation of this file.
20 #ifndef __PIPEWIRE_STREAM_H__
21 #define __PIPEWIRE_STREAM_H__
149 #include <spa/buffer/buffer.h>
150 #include <spa/param/param.h>
178 #define PW_VERSION_STREAM_EVENTS 0
238 struct spa_hook *listener,
249 #define PW_STREAM_PROP_IS_LIVE "pipewire.latency.is-live"
251 #define PW_STREAM_PROP_LATENCY_MIN "pipewire.latency.min"
253 #define PW_STREAM_PROP_LATENCY_MAX "pipewire.latency.max"
265 const char *port_path,
268 const struct spa_pod **params,
290 const struct spa_pod **params,
297 #define PW_STREAM_CONTROL_VOLUME "volume"
300 #define PW_STREAM_CONTROL_CONTRAST "contrast"
301 #define PW_STREAM_CONTROL_BRIGHTNESS "brightness"
302 #define PW_STREAM_CONTROL_HUE "hue"
303 #define PW_STREAM_CONTROL_SATURATION "saturation"
parameters to map a memory range
Definition: mem.h:69
void * user_data
Definition: stream.h:168
static bool pw_array_ensure_size(struct pw_array *arr, size_t size)
Make sure size bytes can be added to the array.
Definition: array.h:76
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:1417
#define MAX_BUFFERS
Definition: link.c:39
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:456
enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **error)
Definition: stream.c:436
void(* destroy)(void *data)
Definition: stream.h:181
@ PW_STREAM_FLAG_DRIVER
be a driver
Definition: stream.h:212
Represents a connection with a remote PipeWire instance.
const SPA_EXPORT char * pw_stream_get_name(struct pw_stream *stream)
Definition: stream.c:444
const char * pw_stream_get_name(struct pw_stream *stream)
Definition: stream.c:444
#define PW_STREAM_PROP_LATENCY_MIN
The minimum latency of the stream, int, default 0.
Definition: stream.h:251
const struct pw_properties * pw_stream_get_properties(struct pw_stream *stream)
Definition: stream.c:450
@ PW_DIRECTION_INPUT
an input port direction
Definition: introspect.h:48
#define pw_loop_add_io(l,...)
Definition: loop.h:60
void(* remove_buffer)(void *data, struct pw_buffer *buffer)
when a buffer was destroyed for this stream
Definition: stream.h:193
void(* add_buffer)(void *data, struct pw_buffer *buffer)
when a new buffer was created for this stream
Definition: stream.h:191
void pw_stream_finish_format(struct pw_stream *stream, int res, const struct spa_pod **params, uint32_t n_params)
Complete the negotiation process with result code res.
Definition: stream.c:1314
@ PW_STREAM_FLAG_EXCLUSIVE
require exclusive access to the device
Definition: stream.h:216
SPA_EXPORT int pw_stream_set_control(struct pw_stream *stream, const char *name, float value)
Set a control value.
Definition: stream.c:1390
int pw_stream_set_active(struct pw_stream *stream, bool active)
Activate or deactivate the stream.
Definition: stream.c:1357
A time structure.
Definition: stream.h:314
SPA_EXPORT void pw_proxy_destroy(struct pw_proxy *proxy)
Destroy a proxy object.
Definition: proxy.c:124
Proxy events, use pw_proxy_add_listener.
Definition: proxy.h:102
pw_direction
Definition: introspect.h:47
#define pw_array_for_each(pos, array)
Definition: array.h:56
@ PW_STREAM_STATE_PAUSED
paused, fully configured but not processing data yet
Definition: stream.h:161
PipeWire type support struct.
Definition: type.h:51
#define PW_NODE_PROP_AUTOCONNECT
Automatically connect this node to a compatible node.
Definition: node.h:104
void pw_log_info(const char *format,...)
uint64_t ticks
the ticks at now.
Definition: stream.h:317
static struct spa_pod * pw_spa_pod_copy(const struct spa_pod *pod)
Copy a pod structure.
Definition: utils.h:52
#define pw_loop_update_timer(l,...)
Definition: loop.h:67
An array object.
Definition: array.h:36
uint32_t core
Definition: type.h:54
struct spa_type_io io
Definition: type.h:70
#define PW_MAP_RANGE_INIT
Definition: mem.h:75
#define PW_VERSION_PROXY_EVENTS
Definition: proxy.h:103
@ PW_STREAM_STATE_ERROR
the strean is in error
Definition: stream.h:156
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:338
void(* format_changed)(void *data, const struct spa_pod *format)
when the format changed.
Definition: stream.h:188
void pw_log_trace(const char *format,...)
uint64_t size
Definition: stream.h:169
SPA_EXPORT struct pw_remote * pw_stream_get_remote(struct pw_stream *stream)
Definition: stream.c:1300
#define PW_NODE_PROP_TARGET_NODE
Try to connect the node to this node id.
Definition: node.h:106
#define pw_loop_destroy_source(l,...)
Definition: loop.h:69
int64_t now
the monotonic time
Definition: stream.h:315
struct pw_remote * pw_stream_get_remote(struct pw_stream *stream)
Definition: stream.c:1300
uint32_t version
Definition: stream.h:179
Represents an object on the client side.
SPA_EXPORT const struct pw_properties * pw_stream_get_properties(struct pw_stream *stream)
Definition: stream.c:450
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:429
@ PW_STREAM_FLAG_AUTOCONNECT
try to automatically connect this stream
Definition: stream.h:208
@ PW_STREAM_FLAG_MAP_BUFFERS
mmap the buffers
Definition: stream.h:211
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:361
int pw_stream_connect(struct pw_stream *stream, enum pw_direction direction, const char *port_path, 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:1259
@ PW_STREAM_STATE_READY
stream is ready
Definition: stream.h:160
@ PW_STREAM_STATE_CONFIGURE
stream is being configured
Definition: stream.h:159
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:1402
static void * pw_array_add(struct pw_array *arr, size_t size)
Add ref size bytes to arr.
Definition: array.h:98
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:1417
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:308
uint64_t delay
delay to device, add to ticks for INPUT streams and subtract from ticks for OUTPUT streams to get the...
Definition: stream.h:319
@ PW_STREAM_FLAG_RT_PROCESS
call process from the realtime thread
Definition: stream.h:213
@ PW_STREAM_STATE_STREAMING
streaming
Definition: stream.h:163
SPA_EXPORT int pw_stream_get_control(struct pw_stream *stream, const char *name, float *value)
Get a control value.
Definition: stream.c:1396
const char * pw_stream_state_as_string(enum pw_stream_state state)
Convert a stream state to a readable string.
Definition: stream.c:352
pw_stream_flags
Definition: stream.h:206
#define pw_loop_add_timer(l,...)
Definition: loop.h:66
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:98
int pw_stream_disconnect(struct pw_stream *stream)
Disconnect stream.
Definition: stream.c:1339
#define pw_loop_update_io(l,...)
Definition: loop.h:61
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:1402
@ PW_STREAM_FLAG_INACTIVE
start the stream inactive
Definition: stream.h:210
struct spa_type_param param
Definition: type.h:71
void(* process)(void *data)
when a buffer can be queued (for playback streams) or dequeued (for capture streams).
Definition: stream.h:199
struct spa_buffer * buffer
Definition: stream.h:167
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:183
struct pw_control this
Definition: control.c:26
void pw_stream_destroy(struct pw_stream *stream)
Destroy a stream.
Definition: stream.c:536
int pw_stream_set_control(struct pw_stream *stream, const char *name, float value)
Set a control value.
Definition: stream.c:1390
int pw_stream_get_control(struct pw_stream *stream, const char *name, float *value)
Get a control value.
Definition: stream.c:1396
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:89
#define PW_STREAM_PROP_IS_LIVE
Indicates that the stream is live, boolean default false.
Definition: stream.h:249
struct pw_stream * pw_stream_new(struct pw_remote *remote, const char *name, struct pw_properties *props)
Create a new unconneced pw_stream.
Definition: stream.c:374
@ PW_STREAM_FLAG_NONE
no flags
Definition: stream.h:207
void pw_log_error(const char *format,...)
pw_stream_state
Definition: stream.h:155
struct spa_type_data data
Definition: type.h:73
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:1307
SPA_EXPORT enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **error)
Definition: stream.c:436
@ PW_STREAM_FLAG_NO_CONVERT
don't convert format
Definition: stream.h:215
@ PW_STREAM_STATE_CONNECTING
connection is in progress
Definition: stream.h:158
#define pw_loop_invoke(l,...)
Definition: loop.h:52
void pw_stream_add_listener(struct pw_stream *stream, struct spa_hook *listener, const struct pw_stream_events *events, void *data)
Definition: stream.c:456
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:429
struct spa_fraction rate
the rate of ticks
Definition: stream.h:316
void pw_log_warn(const char *format,...)
void pw_log_debug(const char *format,...)
int pw_stream_get_time(struct pw_stream *stream, struct pw_time *time)
Query the time on the stream.
Definition: stream.c:1370
@ PW_STREAM_STATE_UNCONNECTED
unconnected
Definition: stream.h:157
A collection of key/value pairs.
Definition: properties.h:38
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:245
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:322
static void pw_array_init(struct pw_array *arr, size_t extend)
Initialize the array with given extend.
Definition: array.h:62
uint32_t spa_format
Definition: type.h:67
Events for a stream.
Definition: stream.h:177