- a stereo ALSA PCM playback device can appear as a sink with two input ports: front-left and front-right or
- a virtual ALSA device, to which clients which attempt to use ALSA directly connect, can appear as a source with two output ports: front-left and front right.
NOTE: `pw-jack` modifies the `LD_LIBRARY_PATH` environment variable so that applications will load PipeWire’s reimplementation of the JACK client libraries instead of JACK’s own libraries. This results in JACK clients being redirected to PipeWire.
The PipeWire server itself does not perform any management of the graph;
context-dependent behaviour such as monitoring for new ALSA devices, and configuring them so that they appear as nodes, or linking nodes is not done automatically.
It rather provides an API that allows spawning, linking and controlling these nodes.
This API is then relied upon by clients to control the graph structure, without having to worry about the graph execution process.
A recommended pattern that is often used is a single client be a daemon that deals with the session and policy management. Two implementations are known as of today:
- pipewire-media-session, which was the first implementation of a session manager.c
Today, it is used mainly in debugging scenarios.
- WirePlumber, which takes a modular approach:
It provides another, higher-level API compared to the PipeWire one, and runs Lua scripts that implement the management logic using the said API.
It ships with default scripts and configuration that handle linking policies as well as monitoring and automatic spawning of ALSA, bluez, libcamera and v4l2 devices.
The API is available for any process, not only from WirePlumber’s Lua scripts.
### Node implementation
With the nodes which they implement, clients can send multimedia data into the graph or obtain multimedia data from the graph.
A client can create multiple PipeWire nodes.
That allows one to create more complex applications;
a browser would for example be able to create a node per tab that requests the ability to play audio, letting the session manager handle the routing:
This allows the user to route different tab sources to different sinks.
Another example would be an application that requires many inputs.
## API Semantics
The current state of the PipeWire server and its capabilities, and the PipeWire graph are exposed towards clients -- including introspection tools like `pw-dump` -- as a collection of objects, each of which has a specific type.
These objects have associated parameters, and properties, methods, events, and permissions.
Parameters of an object are data with a specific, well defined meaning, which can be modified and read-out in a controlled fashion through the PipeWire API.
They are used to configure the object at run-time.
Parameters are the key that allow WirePlumber to negotiate data formats and port configuration with nodes by providing information such as:
Properties of an object are additional data which have been attached on the behalf of modules and of which the PipeWire server has no native understanding.
Certain properties are, by convention, expected for specific object types.
The session manager is responsible for defining the list of permissions each client has. Each permission entry is an object ID and four flags. The four flags are:
Modules are dynamic libraries that are loaded at run time in the clients and in the server and do arbitrary things, such as creating devices or provide methods to create links, nodes, etc.
Modules in PipeWire can only be loaded in their own process. A client, for example, can not load a module in the server.
Ports are the entry and exit point of data for a Node.
A port can either be used for input or output (but not both).
For nodes that work with audio, one type of configuration is whether they have `dsp` ports or a `passthrough` port.
In `dsp` mode, there is one port for channel of multichannel audio (so two ports for stereo audio, for example), and data is always in 32-bit floating point format.
In `passthrough` mode, there is one port for multichannel data in a format that is negotiated between ports.
Data flows between nodes when there is a Link between their ports.
Links may be `"passive"` in which case the existence of the link does not automatically cause data to flow between those nodes (some link in the graph must be `"active"` for the graph to have data flow).
The PipeWire server and PipeWire clients use the PipeWire API through their respective `pw_context`, the so called PipeWire context.
When a PipeWire context is created, it finds and parses a configuration file from the filesystem according to the rules of loading configuration files.