Main Loop
Core API

A main loop object. More...

## Files

file | main-loop.h
| `pipewire/main-loop.h`

## Data Structures

struct | pw_main_loop_events
| Events of the main loop. More...
struct | pw_main_loop
| A main loop object. More...

## Macros

#define | PW_VERSION_MAIN_LOOP_EVENTS 0

## Functions

struct pw_main_loop * | pw_main_loop_new (const struct spa_dict *props)
| Create a new main loop. More...
void | pw_main_loop_add_listener (struct pw_main_loop *loop, struct spa_hook *listener, const struct pw_main_loop_events *events, void *data)
| Add an event listener. More...
struct pw_loop * | pw_main_loop_get_loop (struct pw_main_loop *loop)
| Get the loop implementation. More...
void | pw_main_loop_destroy (struct pw_main_loop *loop)
| Destroy a loop. More...
int | pw_main_loop_run (struct pw_main_loop *loop)
| Run a main loop. More...
int | pw_main_loop_quit (struct pw_main_loop *loop)
| Quit a main loop. More...

## Detailed Description

A main loop object.

## Macro Definition Documentation

## PW_VERSION_MAIN_LOOP_EVENTS

#define PW_VERSION_MAIN_LOOP_EVENTS 0

## Function Documentation

## pw_main_loop_new()

struct pw_main_loop* pw_main_loop_new | ( | const struct spa_dict * | props | ) |

Create a new main loop.

Returns
  a newly allocated Main Loop

Examples
  audio-dsp-filter.c, audio-dsp-src.c, audio-src.c, bluez-session.c, export-sink.c, export-source.c, export-spa-device.c, export-spa.c, local-v4l2.c, tutorial2.c, tutorial3.c, tutorial4.c, tutorial5.c, tutorial6.c, video-dsp-play.c, video-play-fixate.c, video-play-pull.c, video-play-reneg.c, video-play.c, and video-src.c.

## pw_main_loop_add_listener()

void pw_main_loop_add_listener | ( | struct pw_main_loop * | loop,
|  | struct spa_hook * | listener,
|  | const struct pw_main_loop_events * | events,
|  | void * | data
| ) |  |

Add an event listener.

## pw_main_loop_get_loop()

struct pw_loop* pw_main_loop_get_loop | ( | struct pw_main_loop * | loop | ) |

Get the loop implementation.

Examples
  audio-dsp-filter.c, audio-dsp-src.c, audio-src.c, bluez-session.c, export-sink.c, export-source.c, export-spa-device.c, export-spa.c, local-v4l2.c, tutorial2.c, tutorial3.c, tutorial4.c, tutorial5.c, tutorial6.c, video-dsp-play.c, video-play-fixate.c, video-play-pull.c, video-play-reneg.c, video-play.c, and video-src.c.

## pw_main_loop_destroy()

void pw_main_loop_destroy | ( | struct pw_main_loop * | loop | ) |

Destroy a loop.

Destroy a loop.

Parameters

  loop | the main loop to destroy

Examples
  audio-dsp-filter.c, audio-dsp-src.c, audio-src.c, bluez-session.c, export-sink.c, export-source.c, export-spa-device.c, export-spa.c, local-v4l2.c, tutorial2.c, tutorial3.c, tutorial4.c, tutorial5.c, tutorial6.c, video-dsp-play.c, video-play-fixate.c, video-play-pull.c, video-play-reneg.c, video-play.c, and video-src.c.

## pw_main_loop_run()

int pw_main_loop_run | ( | struct pw_main_loop * | loop | ) |

Run a main loop.

This blocks until pw_main_loop_quit is called

Run a main loop.

Parameters

  loop | the main loop to start

Start running loop. This function blocks until pw_main_loop_quit() has been called

Examples
  audio-dsp-filter.c, audio-dsp-src.c, audio-src.c, bluez-session.c, export-sink.c, export-source.c, export-spa-device.c, export-spa.c, local-v4l2.c, tutorial2.c, tutorial3.c, tutorial4.c, tutorial5.c, tutorial6.c, video-dsp-play.c, video-play-fixate.c, video-play-pull.c, video-play-reneg.c, video-play.c, and video-src.c.

## pw_main_loop_quit()

int pw_main_loop_quit | ( | struct pw_main_loop * | loop | ) |

Quit a main loop.

Quit a main loop.

Parameters

  loop | a Main Loop to stop

The call to pw_main_loop_run() will return

Examples
  audio-dsp-filter.c, audio-dsp-src.c, audio-src.c, bluez-session.c, export-sink.c, export-source.c, export-spa-device.c, export-spa.c, local-v4l2.c, tutorial3.c, tutorial6.c, video-dsp-play.c, video-play-fixate.c, video-play-pull.c, video-play-reneg.c, video-play.c, and video-src.c.