PipeWire 1.2.5
Loading...
Searching...
No Matches

Files

file  data-loop.h
 pipewire/data-loop.h
 

Data Structures

struct  pw_data_loop_events
 Loop events, use pw_data_loop_add_listener to add a listener. More...
 
struct  pw_data_loop
 

Macros

#define PW_VERSION_DATA_LOOP_EVENTS   0
 

Functions

struct pw_data_looppw_data_loop_new (const struct spa_dict *props)
 Make a new loop.
 
void pw_data_loop_add_listener (struct pw_data_loop *loop, struct spa_hook *listener, const struct pw_data_loop_events *events, void *data)
 Add an event listener to loop.
 
int pw_data_loop_wait (struct pw_data_loop *loop, int timeout)
 wait for activity on the loop up to timeout milliseconds.
 
void pw_data_loop_exit (struct pw_data_loop *loop)
 make sure the thread will exit.
 
struct pw_looppw_data_loop_get_loop (struct pw_data_loop *loop)
 Get the loop implementation of this data loop.
 
const char * pw_data_loop_get_name (struct pw_data_loop *loop)
 Get the loop name.
 
const char * pw_data_loop_get_class (struct pw_data_loop *loop)
 Get the loop class.
 
void pw_data_loop_destroy (struct pw_data_loop *loop)
 Destroy the loop.
 
int pw_data_loop_start (struct pw_data_loop *loop)
 Start the processing thread.
 
int pw_data_loop_stop (struct pw_data_loop *loop)
 Stop the processing thread.
 
bool pw_data_loop_in_thread (struct pw_data_loop *loop)
 Check if the current thread is the processing thread.
 
struct spa_threadpw_data_loop_get_thread (struct pw_data_loop *loop)
 Get the thread object.
 
int pw_data_loop_invoke (struct pw_data_loop *loop, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data)
 invoke func in the context of the thread or in the caller thread when the loop is not running.
 
void pw_data_loop_set_thread_utils (struct pw_data_loop *loop, struct spa_thread_utils *impl)
 Set a custom spa_thread_utils for this loop.
 

Detailed Description

PipeWire rt-loop object

This loop starts a new real-time thread that is designed to run the processing graph.

Macro Definition Documentation

◆ PW_VERSION_DATA_LOOP_EVENTS

#define PW_VERSION_DATA_LOOP_EVENTS   0

Function Documentation

◆ pw_data_loop_new()

struct pw_data_loop * pw_data_loop_new ( const struct spa_dict * props)

Make a new loop.

Make a new loop.

Returns
a newly allocated data loop

◆ pw_data_loop_add_listener()

void pw_data_loop_add_listener ( struct pw_data_loop * loop,
struct spa_hook * listener,
const struct pw_data_loop_events * events,
void * data )

Add an event listener to loop.

◆ pw_data_loop_wait()

int pw_data_loop_wait ( struct pw_data_loop * loop,
int timeout )

wait for activity on the loop up to timeout milliseconds.

Should be called from the loop function

◆ pw_data_loop_exit()

void pw_data_loop_exit ( struct pw_data_loop * loop)

make sure the thread will exit.

Can be called from a loop callback

◆ pw_data_loop_get_loop()

struct pw_loop * pw_data_loop_get_loop ( struct pw_data_loop * loop)

Get the loop implementation of this data loop.

◆ pw_data_loop_get_name()

const char * pw_data_loop_get_name ( struct pw_data_loop * loop)

Get the loop name.

Since 1.1.0

Parameters
loopthe data loop to query
Returns
the data loop name

Get the name of the data loop. The data loop name is a unique name that identifies this data loop.

Since
1.1.0

◆ pw_data_loop_get_class()

const char * pw_data_loop_get_class ( struct pw_data_loop * loop)

Get the loop class.

Since 1.1.0

Parameters
loopthe data loop to query
Returns
the data loop class

Get the class of the data loop. Multiple data loop can have the same class and processing can be assigned to any data loop from the same class.

Since
1.1.0

◆ pw_data_loop_destroy()

void pw_data_loop_destroy ( struct pw_data_loop * loop)

Destroy the loop.

Destroy the loop.

Parameters
loopthe data loop to destroy

◆ pw_data_loop_start()

int pw_data_loop_start ( struct pw_data_loop * loop)

Start the processing thread.

Start the processing thread.

Parameters
loopthe data loop to start
Returns
0 if ok, -1 on error

This will start the realtime thread that manages the loop.

◆ pw_data_loop_stop()

int pw_data_loop_stop ( struct pw_data_loop * loop)

Stop the processing thread.

Stop the processing thread.

Parameters
loopthe data loop to Stop
Returns
0

This will stop and join the realtime thread that manages the loop.

◆ pw_data_loop_in_thread()

bool pw_data_loop_in_thread ( struct pw_data_loop * loop)

Check if the current thread is the processing thread.

May be called from any thread.

Check if the current thread is the processing thread.

Parameters
loopthe data loop to check
Returns
true is the current thread is the data loop thread

◆ pw_data_loop_get_thread()

struct spa_thread * pw_data_loop_get_thread ( struct pw_data_loop * loop)

Get the thread object.

Parameters
loopthe data loop to get the thread of
Returns
the thread object or NULL when the thread is not running

On posix based systems this returns a pthread_t

◆ pw_data_loop_invoke()

int pw_data_loop_invoke ( struct pw_data_loop * loop,
spa_invoke_func_t func,
uint32_t seq,
const void * data,
size_t size,
bool block,
void * user_data )

invoke func in the context of the thread or in the caller thread when the loop is not running.

May be called from the loop's thread, but otherwise can only be called by a single thread at a time. If called from the loop's thread, all callbacks previously queued with pw_data_loop_invoke() will be run synchronously, which might cause unexpected reentrancy problems.

Parameters
[in]loopThe loop to invoke func on.
funcThe function to be invoked.
seqA sequence number, opaque to PipeWire. This will be made available to func.
[in]dataData that will be copied into the internal ring buffer and made available to func. Because this data is copied, it is okay to pass a pointer to a local variable, but do not pass a pointer to an object that has identity.
sizeThe size of data to copy.
blockIf \true, do not return until func has been called. Otherwise, returns immediately. Passing \true does not risk a deadlock because the data thread is never allowed to wait on any other thread.
user_dataAn opaque pointer passed to func.
Returns
-EPIPE if the internal ring buffer filled up, if block is \false, 0 is returned when seq is SPA_ID_INVALID or the sequence number with the ASYNC bit set otherwise. When block is \true, the return value of func is returned.

Since 0.3.3

◆ pw_data_loop_set_thread_utils()

void pw_data_loop_set_thread_utils ( struct pw_data_loop * loop,
struct spa_thread_utils * impl )

Set a custom spa_thread_utils for this loop.

Setting NULL restores the system default implementation. Since 0.3.50

Set a custom spa_thread_utils for this loop.

Parameters
loopthe data loop to set the thread utils on
implthe thread utils implementation

This configures a custom spa_thread_utils implementation for this data loop. Use NULL to restore the system default implementation.