PipeWire 1.2.5
|
SPA (Simple Plugin API) is an extensible API to implement all kinds of plugins.
It is inspired by many other plugin APIs, mostly LV2 and GStreamer. SPA provides two parts:
The usual approach is that PipeWire and PipeWire clients can use the header-only functions to interact with the plugins. Those plugins are usually loaded at runtime (through dlopen(3)
).
SPA was designed with the following goals in mind:
The original user of SPA is PipeWire, which uses SPA to implement the low-level multimedia processing plugins, device detection, mainloops, CPU detection, logging, among other things. SPA however can be used outside of PipeWire with minimal problems.
A very simple example on how SPA headers work are the Utilities, a set of utilities commonly required by C projects. SPA functions use the spa_
namespace and are easy to identify.
SPA plugins are shared libraries (.so
files) that can be loaded at runtime. Each library provides one or more "factories", each of which may implement several "interfaces". Code that uses SPA plugins then uses those interfaces (through SPA header files) to interact with the plugin.
For example, the PipeWire daemon can load the normal printf
-based logger or a systemd journal-based logger. Both of those provide the Log interface and once instantiated, PipeWire no longer has to differentiate between the two logging facilities.
Please see SPA Plugins for the details on how to use SPA plugins.