PipeWire  0.3.27
stream.h File Reference

Go to the source code of this file.

Data Structures

struct  pw_buffer
 
struct  pw_stream_control
 
struct  pw_time
 A time structure. More...
 
struct  pw_stream_events
 Events for a stream. More...
 

Macros

#define PW_VERSION_STREAM_EVENTS   0
 

Enumerations

enum  pw_stream_state {
  PW_STREAM_STATE_ERROR = -1, PW_STREAM_STATE_UNCONNECTED = 0, PW_STREAM_STATE_CONNECTING = 1, PW_STREAM_STATE_PAUSED = 2,
  PW_STREAM_STATE_STREAMING = 3
}
 The state of a stream. More...
 
enum  pw_stream_flags {
  PW_STREAM_FLAG_NONE = 0, PW_STREAM_FLAG_AUTOCONNECT = (1 << 0), PW_STREAM_FLAG_INACTIVE = (1 << 1), PW_STREAM_FLAG_MAP_BUFFERS = (1 << 2),
  PW_STREAM_FLAG_DRIVER = (1 << 3), PW_STREAM_FLAG_RT_PROCESS = (1 << 4), PW_STREAM_FLAG_NO_CONVERT = (1 << 5), PW_STREAM_FLAG_EXCLUSIVE = (1 << 6),
  PW_STREAM_FLAG_DONT_RECONNECT = (1 << 7), PW_STREAM_FLAG_ALLOC_BUFFERS = (1 << 8)
}
 Extra flags that can be used in pw_stream_connect() More...
 

Functions

struct pw_streampw_stream_new_simple (struct pw_loop *loop, const char *name, struct pw_properties *props, const struct pw_stream_events *events, void *data)
 
void pw_stream_add_listener (struct pw_stream *stream, struct spa_hook *listener, const struct pw_stream_events *events, void *data)
 
enum pw_stream_state pw_stream_get_state (struct pw_stream *stream, const char **error)
 
const char * pw_stream_get_name (struct pw_stream *stream)
 
struct pw_core * pw_stream_get_core (struct pw_stream *stream)
 
const struct pw_propertiespw_stream_get_properties (struct pw_stream *stream)
 
int pw_stream_update_properties (struct pw_stream *stream, const struct spa_dict *dict)
 
int pw_stream_set_error (struct pw_stream *stream, int res, const char *error,...) SPA_PRINTF_FUNC(3
 Set the stream in error state. More...
 
int pw_stream_set_control (struct pw_stream *stream, uint32_t id, uint32_t n_values, float *values,...)
 Set control values. More...
 
struct pw_bufferpw_stream_dequeue_buffer (struct pw_stream *stream)
 Get a buffer that can be filled for playback streams or consumed for capture streams. More...
 
int pw_stream_queue_buffer (struct pw_stream *stream, struct pw_buffer *buffer)
 Submit a buffer for playback or recycle a buffer for capture. More...
 
int pw_stream_flush (struct pw_stream *stream, bool drain)
 Flush a stream. More...
 

Macro Definition Documentation

◆ PW_VERSION_STREAM_EVENTS

#define PW_VERSION_STREAM_EVENTS   0

Enumeration Type Documentation

◆ pw_stream_flags

Extra flags that can be used in pw_stream_connect()

Enumerator
PW_STREAM_FLAG_NONE 

no flags

PW_STREAM_FLAG_AUTOCONNECT 

try to automatically connect this stream

PW_STREAM_FLAG_INACTIVE 

start the stream inactive, pw_stream_set_active() needs to be called explicitly

PW_STREAM_FLAG_MAP_BUFFERS 

mmap the buffers except DmaBuf

PW_STREAM_FLAG_DRIVER 

be a driver

PW_STREAM_FLAG_RT_PROCESS 

call process from the realtime thread.

You MUST use RT safe functions in the process callback.

PW_STREAM_FLAG_NO_CONVERT 

don't convert format

PW_STREAM_FLAG_EXCLUSIVE 

require exclusive access to the device

PW_STREAM_FLAG_DONT_RECONNECT 

don't try to reconnect this stream when the sink/source is removed

PW_STREAM_FLAG_ALLOC_BUFFERS 

the application will allocate buffer memory.

In the add_buffer event, the data of the buffer should be set

◆ pw_stream_state

The state of a stream.

Enumerator
PW_STREAM_STATE_ERROR 

the stream is in error

PW_STREAM_STATE_UNCONNECTED 

unconnected

PW_STREAM_STATE_CONNECTING 

connection is in progress

PW_STREAM_STATE_PAUSED 

paused

PW_STREAM_STATE_STREAMING 

streaming

Function Documentation

◆ pw_stream_add_listener()

void pw_stream_add_listener ( struct pw_stream stream,
struct spa_hook *  listener,
const struct pw_stream_events events,
void *  data 
)

◆ pw_stream_dequeue_buffer()

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.


References res.

◆ pw_stream_flush()

int pw_stream_flush ( struct pw_stream stream,
bool  drain 
)

Flush a stream.

When drain is true, the drained callback will be called when all data is played or recorded

References pw_loop_invoke.

◆ pw_stream_get_core()

struct pw_core* pw_stream_get_core ( struct pw_stream stream)

◆ pw_stream_get_name()

const char* pw_stream_get_name ( struct pw_stream stream)

◆ pw_stream_get_properties()

const struct pw_properties* pw_stream_get_properties ( struct pw_stream stream)

◆ pw_stream_get_state()

enum pw_stream_state pw_stream_get_state ( struct pw_stream stream,
const char **  error 
)

◆ pw_stream_new_simple()

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 
)
Parameters
loopa pw_loop to use
namea stream media name
propsstream properties, ownership is taken
eventsstream events
datadata passed to events

References pw_context_new(), pw_properties::pw_properties_new(), and res.

◆ pw_stream_queue_buffer()

int pw_stream_queue_buffer ( struct pw_stream stream,
struct pw_buffer buffer 
)

Submit a buffer for playback or recycle a buffer for capture.

References buffer::busy, buffer::id, NAME, pw_log::pw_log_trace, and res.

◆ pw_stream_set_control()

int pw_stream_set_control ( struct pw_stream stream,
uint32_t  id,
uint32_t  n_values,
float *  values,
  ... 
)

Set control values.

References NAME, pw_log::pw_log_debug, va_start(), and control::values.

◆ pw_stream_set_error()

int pw_stream_set_error ( struct pw_stream stream,
int  res,
const char *  error,
  ... 
)

Set the stream in error state.

Parameters
streama pw_stream
resa result code
...an error message

◆ pw_stream_update_properties()

int pw_stream_update_properties ( struct pw_stream stream,
const struct spa_dict dict 
)