Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PipeWire implementation #938

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft

PipeWire implementation #938

wants to merge 14 commits into from

Conversation

midoriiro
Copy link

@midoriiro midoriiro commented Jan 15, 2025

PipeWire implementation based on pipewire/pipewire-rs/doc and others draft PRs in this repository (thanks to them).

There is two additional crates, one for the PW client and one for SPA utils (used for some POD deserialization).

Client capabilities:

  • Retrieve all Audio/(Sink/Source) nodes
    • Thats include default audio nodes (defined by your session manager)
    • Format information (sample rate, sample format, channels)
  • Retrieve metadata for global settings and default audio nodes (provided by session manager, AKA WirePlumber)
  • Create and manage stream
  • Create virtual node

I updated some CPAL examples (enumerate and beep).

TODO (just some ideas):

  • Duplex audio node:
    • Can be useful as a "loopback" device. In CPAL that mean input stream can be retrieved, updated and injected in output stream. Need a POC, I'm just supposing.
  • Updating Port/Link of an audio node: Use case, a virtual node is a DSP (EQ, Reverb, ...), clients nodes (Spotify, browser, ...), audio node (sound card playback). DSP node will be inserted between clients nodes and audio node, with all ports/links remapped correctly.
    • Or simple use case: create a virtual node and plug it to an audio node monitor ports
  • Subscribe to node/stream events/listeners: stream format or parameters changed, same for node.
  • Improve test coverage and create some integration test
    • Use TestContainer to test different cases with embed PipeWire and session manager installed in a container image
  • Improve documentation (README.md to explain client initialization flow, post initialization flow, how to handle PW object creation)
  • Improve client API: currently PipewireClient is just a struct with a bunch of function that send requests. I would like to create different structs to separate concern and improve readability/maintainability (struct API for node, struct API for stream, etc)
  • Improve quality code in general, clean some code, keep coherence in different parts on code base

I'm posting this PR as draft for now, if you have any suggestion/feedback or particular use cases, I'm glad to discuss it.

Note: You will need to install PipeWire development lib from your package manager. Having WirePlumber or PipeWire Media Session running. If your PW socket is located somewhere else you can define env vars:

  • (socket name): PIPEWIRE_REMOTE
  • (socket location): PIPEWIRE_RUNTIME_DIR or XDG_RUNTIME_DIR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant