Loading...
Searching...
No Matches
Loop
Core API

PipeWire loop object provides an implementation of the spa loop interfaces. More...

## Files

file | loop.h
| pipewire/loop.h

## Data Structures

struct | pw_loop

## Macros

#define | PW_API_LOOP_IMPL static inline

## Functions

struct pw_loop * | pw_loop_new (const struct spa_dict *props)
| Create a new loop.
void | pw_loop_destroy (struct pw_loop *loop)
| Destroy a loop.
int | pw_loop_set_name (struct pw_loop *loop, const char *name)
PW_API_LOOP_IMPL int | pw_loop_add_source (struct pw_loop *object, struct spa_source *source)
PW_API_LOOP_IMPL int | pw_loop_update_source (struct pw_loop *object, struct spa_source *source)
PW_API_LOOP_IMPL int | pw_loop_remove_source (struct pw_loop *object, struct spa_source *source)
PW_API_LOOP_IMPL int | pw_loop_invoke (struct pw_loop *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data)
PW_API_LOOP_IMPL int | pw_loop_locked (struct pw_loop *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, void *user_data)
PW_API_LOOP_IMPL int | pw_loop_get_fd (struct pw_loop *object)
PW_API_LOOP_IMPL void | pw_loop_add_hook (struct pw_loop *object, struct spa_hook *hook, const struct spa_loop_control_hooks *hooks, void *data)
PW_API_LOOP_IMPL void | pw_loop_enter (struct pw_loop *object)
PW_API_LOOP_IMPL void | pw_loop_leave (struct pw_loop *object)
PW_API_LOOP_IMPL int | pw_loop_iterate (struct pw_loop *object, int timeout)
PW_API_LOOP_IMPL int | pw_loop_check (struct pw_loop *object)
PW_API_LOOP_IMPL int | pw_loop_lock (struct pw_loop *object)
PW_API_LOOP_IMPL int | pw_loop_unlock (struct pw_loop *object)
PW_API_LOOP_IMPL int | pw_loop_get_time (struct pw_loop *object, struct timespec *abstime, int64_t timeout)
PW_API_LOOP_IMPL int | pw_loop_wait (struct pw_loop *object, const struct timespec *abstime)
PW_API_LOOP_IMPL int | pw_loop_signal (struct pw_loop *object, bool wait_for_accept)
PW_API_LOOP_IMPL int | pw_loop_accept (struct pw_loop *object)
PW_API_LOOP_IMPL struct spa_source * | pw_loop_add_io (struct pw_loop *object, int fd, uint32_t mask, bool close, spa_source_io_func_t func, void *data)
PW_API_LOOP_IMPL int | pw_loop_update_io (struct pw_loop *object, struct spa_source *source, uint32_t mask)
PW_API_LOOP_IMPL struct spa_source * | pw_loop_add_idle (struct pw_loop *object, bool enabled, spa_source_idle_func_t func, void *data)
PW_API_LOOP_IMPL int | pw_loop_enable_idle (struct pw_loop *object, struct spa_source *source, bool enabled)
PW_API_LOOP_IMPL struct spa_source * | pw_loop_add_event (struct pw_loop *object, spa_source_event_func_t func, void *data)
PW_API_LOOP_IMPL int | pw_loop_signal_event (struct pw_loop *object, struct spa_source *source)
PW_API_LOOP_IMPL struct spa_source * | pw_loop_add_timer (struct pw_loop *object, spa_source_timer_func_t func, void *data)
PW_API_LOOP_IMPL int | pw_loop_update_timer (struct pw_loop *object, struct spa_source *source, struct timespec *value, struct timespec *interval, bool absolute)
PW_API_LOOP_IMPL struct spa_source * | pw_loop_add_signal (struct pw_loop *object, int signal_number, spa_source_signal_func_t func, void *data)
PW_API_LOOP_IMPL void | pw_loop_destroy_source (struct pw_loop *object, struct spa_source *source)

## Detailed Description

PipeWire loop object provides an implementation of the spa loop interfaces.

It can be used to implement various event loops.

The members of Loop are read-only.

## Macro Definition Documentation

## PW_API_LOOP_IMPL

#define PW_API_LOOP_IMPL static inline

## Function Documentation

## pw_loop_new()

struct pw_loop * pw_loop_new | ( | const struct spa_dict * | props | ) |

Create a new loop.

Returns
  a newly allocated loop

Examples
  gmain.c.

## pw_loop_destroy()

void pw_loop_destroy | ( | struct pw_loop * | loop | ) |

Destroy a loop.

Parameters

  loop | a loop to destroy

Examples
  gmain.c.

## pw_loop_set_name()

int pw_loop_set_name | ( | struct pw_loop * | loop,
|  | const char * | name )

## pw_loop_add_source()

PW_API_LOOP_IMPL int pw_loop_add_source | ( | struct pw_loop * | object,
|  | struct spa_source * | source )

## pw_loop_update_source()

PW_API_LOOP_IMPL int pw_loop_update_source | ( | struct pw_loop * | object,
|  | struct spa_source * | source )

## pw_loop_remove_source()

PW_API_LOOP_IMPL int pw_loop_remove_source | ( | struct pw_loop * | object,
|  | struct spa_source * | source )

## pw_loop_invoke()

PW_API_LOOP_IMPL int pw_loop_invoke | ( | struct pw_loop * | object,
|  | spa_invoke_func_t | func,
|  | uint32_t | seq,
|  | const void * | data,
|  | size_t | size,
|  | bool | block,
|  | void * | user_data )

Examples
  export-sink.c.

## pw_loop_locked()

PW_API_LOOP_IMPL int pw_loop_locked | ( | struct pw_loop * | object,
|  | spa_invoke_func_t | func,
|  | uint32_t | seq,
|  | const void * | data,
|  | size_t | size,
|  | void * | user_data )

## pw_loop_get_fd()

PW_API_LOOP_IMPL int pw_loop_get_fd | ( | struct pw_loop * | object | ) |

Examples
  gmain.c.

## pw_loop_add_hook()

PW_API_LOOP_IMPL void pw_loop_add_hook | ( | struct pw_loop * | object,
|  | struct spa_hook * | hook,
|  | const struct spa_loop_control_hooks * | hooks,
|  | void * | data )

## pw_loop_enter()

PW_API_LOOP_IMPL void pw_loop_enter | ( | struct pw_loop * | object | ) |

Examples
  gmain.c, and internal.c.

## pw_loop_leave()

PW_API_LOOP_IMPL void pw_loop_leave | ( | struct pw_loop * | object | ) |

Examples
  gmain.c, and internal.c.

## pw_loop_iterate()

PW_API_LOOP_IMPL int pw_loop_iterate | ( | struct pw_loop * | object,
|  | int | timeout )

Examples
  gmain.c, and internal.c.

## pw_loop_check()

PW_API_LOOP_IMPL int pw_loop_check | ( | struct pw_loop * | object | ) |

## pw_loop_lock()

PW_API_LOOP_IMPL int pw_loop_lock | ( | struct pw_loop * | object | ) |

## pw_loop_unlock()

PW_API_LOOP_IMPL int pw_loop_unlock | ( | struct pw_loop * | object | ) |

## pw_loop_get_time()

PW_API_LOOP_IMPL int pw_loop_get_time | ( | struct pw_loop * | object,
|  | struct timespec * | abstime,
|  | int64_t | timeout )

## pw_loop_wait()

PW_API_LOOP_IMPL int pw_loop_wait | ( | struct pw_loop * | object,
|  | const struct timespec * | abstime )

## pw_loop_signal()

PW_API_LOOP_IMPL int pw_loop_signal | ( | struct pw_loop * | object,
|  | bool | wait_for_accept )

## pw_loop_accept()

PW_API_LOOP_IMPL int pw_loop_accept | ( | struct pw_loop * | object | ) |

## pw_loop_add_io()

PW_API_LOOP_IMPL struct spa_source * pw_loop_add_io | ( | struct pw_loop * | object,
|  | int | fd,
|  | uint32_t | mask,
|  | bool | close,
|  | spa_source_io_func_t | func,
|  | void * | data )

## pw_loop_update_io()

PW_API_LOOP_IMPL int pw_loop_update_io | ( | struct pw_loop * | object,
|  | struct spa_source * | source,
|  | uint32_t | mask )

## pw_loop_add_idle()

PW_API_LOOP_IMPL struct spa_source * pw_loop_add_idle | ( | struct pw_loop * | object,
|  | bool | enabled,
|  | spa_source_idle_func_t | func,
|  | void * | data )

## pw_loop_enable_idle()

PW_API_LOOP_IMPL int pw_loop_enable_idle | ( | struct pw_loop * | object,
|  | struct spa_source * | source,
|  | bool | enabled )

## pw_loop_add_event()

PW_API_LOOP_IMPL struct spa_source * pw_loop_add_event | ( | struct pw_loop * | object,
|  | spa_source_event_func_t | func,
|  | void * | data )

Examples
  audio-src-ring.c, and video-play-fixate.c.

## pw_loop_signal_event()

PW_API_LOOP_IMPL int pw_loop_signal_event | ( | struct pw_loop * | object,
|  | struct spa_source * | source )

Examples
  audio-src-ring.c, and video-play-fixate.c.

## pw_loop_add_timer()

PW_API_LOOP_IMPL struct spa_source * pw_loop_add_timer | ( | struct pw_loop * | object,
|  | spa_source_timer_func_t | func,
|  | void * | data )

Examples
  video-dsp-src.c, video-play-pull.c, video-play-reneg.c, video-src-alloc.c, video-src-fixate.c, video-src-reneg.c, video-src-sync.c, and video-src.c.

## pw_loop_update_timer()

PW_API_LOOP_IMPL int pw_loop_update_timer | ( | struct pw_loop * | object,
|  | struct spa_source * | source,
|  | struct timespec * | value,
|  | struct timespec * | interval,
|  | bool | absolute )

Examples
  video-dsp-src.c, video-play-pull.c, video-play-reneg.c, video-src-alloc.c, video-src-fixate.c, video-src-reneg.c, video-src-sync.c, and video-src.c.

## pw_loop_add_signal()

PW_API_LOOP_IMPL struct spa_source * pw_loop_add_signal | ( | struct pw_loop * | object,
|  | int | signal_number,
|  | spa_source_signal_func_t | func,
|  | void * | data )

Examples
  audio-capture.c, audio-dsp-filter.c, audio-dsp-sink.c, audio-dsp-sink2.c, audio-dsp-src.c, audio-src-ring.c, audio-src-ring2.c, audio-src.c, export-spa-device.c, export-spa.c, internal.c, midi-src.c, tutorial7.c, video-dsp-src.c, video-play-fixate.c, video-play-pull.c, video-play-reneg.c, video-play-sync.c, video-play.c, video-src-alloc.c, video-src-fixate.c, video-src-reneg.c, video-src-sync.c, and video-src.c.

## pw_loop_destroy_source()

PW_API_LOOP_IMPL void pw_loop_destroy_source | ( | struct pw_loop * | object,
|  | struct spa_source * | source )

Examples
  audio-src-ring.c.