A PipeWire client audio wrapper

Hello! It’s nothing groundbreaking, and I see a few other PipeWire bindings, but after struggling a bit with getting it to work myself, and seeing some others encounter issues with it, I thought I would post the PipeWire client wrapper I was sitting on.

It links libpipewire-0.3, negotiates a comptime-known buffer format, does its own SPA POD building/parsing so that SPA does not have to be linked, and provides a StreamContext object that connects to PipeWire and opens the audio stream. The PipeWire loop is contained in the StreamContext and can be iterated in the main function or on a dedicated thread.

It’s not super well tested, but I hope it might be useful to someone confused about PipeWire. Thanks for reading!

6 Likes

I have pure zig pipewire module here too (not updated past writergate). It can only query graph at the moment, but it generates the SPA stuff from the upstream headers. You might be interested in that stuff.
https://github.com/Cloudef/pipewrangler

1 Like