PipeWire: pw_stream Class Reference

PipeWire 0.3.25

Public Member Functions
pw_stream Class Reference

PipeWire stream object class. More...

## Public Member Functions
const char * | pw_stream_state_as_string (enum pw_stream_state state)
| Convert a stream state to a readable string. More...
struct pw_stream * | pw_stream_new (struct pw_core *core, const char *name, struct pw_properties *props)
| Create a new unconneced pw_stream. More...
void | pw_stream_destroy (struct pw_stream *stream)
| Destroy a stream. More...
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. More...
uint32_t | pw_stream_get_node_id (struct pw_stream *stream)
| Get the node ID of the stream. More...
int | pw_stream_disconnect (struct pw_stream *stream)
| Disconnect stream. More...
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. More...
int | pw_stream_get_time (struct pw_stream *stream, struct pw_time *time)
| Query the time on the stream. More...
int | pw_stream_set_active (struct pw_stream *stream, bool active)
| Activate or deactivate the stream. More...

## Detailed Description

PipeWire stream object class.

The stream object provides a convenient way to send and receive data streams from/to PipeWire.

See also Media Streams and Core API

## Member Function Documentation

## ◆ pw_stream_connect()

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.

Returns
  0 on success < 0 on error.

You should connect to the process event and use pw_stream_dequeue_buffer() to get the latest metadata and data.

Parameters

  stream | a pw_stream
  direction | the stream direction
  target_id | the target object id to connect to or PW_ID_ANY to let the manager select a target.
  flags | stream flags
  params | an array with params. The params should ideally contain supported formats.
  n_params | number of items in params

References NAME, PW_DIRECTION_INPUT, pw_log::pw_log_debug, and res.

## ◆ pw_stream_destroy()

void pw_stream_destroy | ( | struct pw_stream * | stream | ) |

Destroy a stream.

References NAME, pw_log::pw_log_debug, and pw_stream_disconnect().

## ◆ pw_stream_disconnect()

int pw_stream_disconnect | ( | struct pw_stream * | stream | ) |

Disconnect stream.

References NAME, pw_core_disconnect(), pw_impl_node::pw_impl_node_destroy(), pw_impl_node_set_active(), pw_log::pw_log_debug, and pw_proxy::pw_proxy_destroy().

Referenced by pw_stream_destroy().

## ◆ pw_stream_get_node_id()

uint32_t pw_stream_get_node_id | ( | struct pw_stream * | stream | ) |

Get the node ID of the stream.

Returns
  node ID.

## ◆ pw_stream_get_time()

int pw_stream_get_time | ( | struct pw_stream * | stream,
|  | struct pw_time * | time
| ) |  |

Query the time on the stream.

References pw_time::delay, NAME, pw_time::now, pw_log::pw_log_trace, pw_time::queued, pw_time::rate, pw_time::ticks, and stream::time.

## ◆ pw_stream_new()

struct pw_stream * pw_stream_new | ( | struct pw_core * | core,
|  | const char * | name,
|  | struct pw_properties * | props
| ) |  |

Create a new unconneced pw_stream.

Returns
  a newly allocated pw_stream

Parameters

  core | a pw_core
  name | a stream media name
  props | stream properties, ownership is taken

## ◆ pw_stream_set_active()

int pw_stream_set_active | ( | struct pw_stream * | stream,
|  | bool | active
| ) |  |

Activate or deactivate the stream.

References NAME, pw_impl_node_set_active(), and pw_log::pw_log_debug.

## ◆ pw_stream_state_as_string()

const char * pw_stream_state_as_string | ( | enum pw_stream_state | state | ) |

Convert a stream state to a readable string.

References PW_STREAM_STATE_CONNECTING, PW_STREAM_STATE_ERROR, PW_STREAM_STATE_PAUSED, PW_STREAM_STATE_STREAMING, and PW_STREAM_STATE_UNCONNECTED.

## ◆ pw_stream_update_params()

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.

This function should be called after notification of the format.

When res indicates success, params contain the parameters for the allocation state.

Parameters

  stream | a pw_stream
  params | an array of params. The params should ideally contain parameters for doing buffer allocation.
  n_params | number of elements in params

References NAME, pw_log::pw_log_debug, and res.

The documentation for this class was generated from the following file:

- stream.h