PipeWire  0.1.4
pw_stream Class Reference

PipeWire stream object class. More...

Collaboration diagram for pw_stream:

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_streampw_stream_new (struct pw_remote *remote, 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...
 
bool pw_stream_connect (struct pw_stream *stream, enum pw_direction direction, enum pw_stream_mode mode, const char *port_path, enum pw_stream_flags flags, uint32_t n_possible_formats, const struct spa_format **possible_formats)
 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...
 
void pw_stream_disconnect (struct pw_stream *stream)
 Disconnect stream. More...
 
void pw_stream_finish_format (struct pw_stream *stream, int res, struct spa_param **params, uint32_t n_params)
 Complete the negotiation process with result code res. More...
 
bool pw_stream_get_time (struct pw_stream *stream, struct pw_time *time)
 Query the time on the stream. More...
 
uint32_t pw_stream_get_empty_buffer (struct pw_stream *stream)
 Get the id of an empty buffer that can be filled. More...
 
bool pw_stream_recycle_buffer (struct pw_stream *stream, uint32_t id)
 Recycle the buffer with id. More...
 
struct spa_buffer * pw_stream_peek_buffer (struct pw_stream *stream, uint32_t id)
 Get the buffer with id from stream. More...
 
bool pw_stream_send_buffer (struct pw_stream *stream, uint32_t id)
 Send a buffer with id to stream. More...
 

Data Fields

struct pw_remoteremote
 the owner remote More...
 
struct spa_list link
 link in the remote More...
 
char * name
 the name of the stream More...
 
uint32_t node_id
 node id for remote node, available from CONFIGURE state and higher More...
 
struct pw_propertiesproperties
 properties of the stream More...
 
enum pw_stream_state state
 stream state More...
 
char * error
 error reason when state is in error More...
 
struct spa_hook_list listener_list
 

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 page_client_api

Member Function Documentation

◆ pw_stream_connect()

bool pw_stream_connect ( struct pw_stream stream,
enum pw_direction  direction,
enum pw_stream_mode  mode,
const char *  port_path,
enum pw_stream_flags  flags,
uint32_t  n_possible_formats,
const struct spa_format **  possible_formats 
)

Connect a stream for input or output on port_path.

Returns
true on success.

When mode is PW_STREAM_MODE_BUFFER, you should connect to the new-buffer signal and use pw_stream_peek_buffer() to get the latest metadata and data.

Parameters
streama pw_stream
directionthe stream direction
modea pw_stream_mode
port_paththe port path to connect to or NULL to let the server choose a port
flagsstream flags
n_possible_formatsnumber of items in possible_formats
possible_formatsan array with possible accepted formats

◆ pw_stream_destroy()

void pw_stream_destroy ( struct pw_stream stream)

Destroy a stream.

◆ pw_stream_disconnect()

void pw_stream_disconnect ( struct pw_stream stream)

Disconnect stream.

◆ pw_stream_finish_format()

void pw_stream_finish_format ( struct pw_stream stream,
int  res,
struct spa_param **  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
streama pw_stream
resa result code
paramsan array of pointers to spa_param
n_paramsnumber of elements in params

◆ pw_stream_get_empty_buffer()

uint32_t pw_stream_get_empty_buffer ( struct pw_stream stream)

Get the id of an empty buffer that can be filled.

Returns
the id of an empty buffer or SPA_ID_INVALID when no buffer is available.

◆ 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()

bool pw_stream_get_time ( struct pw_stream stream,
struct pw_time time 
)

Query the time on the stream.

◆ pw_stream_new()

struct pw_stream * pw_stream_new ( struct pw_remote remote,
const char *  name,
struct pw_properties props 
)

Create a new unconneced pw_stream.

Returns
a newly allocated pw_stream
Parameters
remotea pw_remote
namea stream name
propsstream properties, ownership is taken

◆ pw_stream_peek_buffer()

struct spa_buffer * pw_stream_peek_buffer ( struct pw_stream stream,
uint32_t  id 
)

Get the buffer with id from stream.

Returns
a spa_buffer or NULL when there is no buffer

This function should be called from the new-buffer event.

◆ pw_stream_recycle_buffer()

bool pw_stream_recycle_buffer ( struct pw_stream stream,
uint32_t  id 
)

Recycle the buffer with id.

Returns
true on success, false when id is invalid or not a used buffer Let the PipeWire server know that it can reuse the buffer with id.

◆ pw_stream_send_buffer()

bool pw_stream_send_buffer ( struct pw_stream stream,
uint32_t  id 
)

Send a buffer with id to stream.

Returns
true when id was handled, false on error

For provider or playback streams, this function should be called whenever there is a new buffer available.

◆ 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.

Field Documentation

◆ error

char* pw_stream::error

error reason when state is in error

Referenced by pw_stream_get_state().

◆ link

struct spa_list pw_stream::link

link in the remote

Referenced by pw_remote_destroy(), pw_remote_disconnect(), and pw_stream_destroy().

◆ listener_list

struct spa_hook_list pw_stream::listener_list

◆ name

char* pw_stream::name

the name of the stream

Referenced by pw_stream_get_name().

◆ node_id

uint32_t pw_stream::node_id

node id for remote node, available from CONFIGURE state and higher

Referenced by pw_stream_get_node_id().

◆ properties

struct pw_properties* pw_stream::properties

properties of the stream

Referenced by pw_stream_get_properties(), and pw_stream_new().

◆ remote

struct pw_remote* pw_stream::remote

the owner remote

Referenced by pw_stream_new().

◆ state

enum pw_stream_state pw_stream::state

stream state

Referenced by pw_stream_get_state().


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