Assistance with editing links via WirePlumber
George Kiagiadakis
mail at gkiagia.gr
Thu Feb 8 14:46:23 UTC 2024
Hi,
Yes, it is easy to re-link streams to different sinks, similar to pavucontrol.
You can do this by setting the “target.object” property in the “default” metadata object. The value may be the “node.name" or the “object.serial” of the target sink/source that you want to link your stream with.
On the command line:
pw-metadata -n default <ID of the stream> “target.object” “<name of the sink>” “Spa:String"
For example:
pw-metadata -n default 45 “target.object” “alsa_output.pci-0000_00_1f.3.analog-stereo” “Spa:String"
Using the WirePlumber C API, you need to find the WpMetadata object first, using an object manager (use a constraint on “metadata.name” to match “default”) and then set the value with:
wp_metadata_set (metadata, stream_node_id, PW_KEY_TARGET_OBJECT, “Spa:String”, target_node_name);
PS: If you set the “object.serial” instead of the name, then the type should be “Spa:Id” instead.
This is the same mechanism that is used by existing tools like pavucontrol. You can also use pavucontrol to see this in action. Use “pw-metadata -n default” to print the existing metadata values for inspection.
I hope this helps.
Best regards,
George
> On 26 Jan 2024, at 18:09, Louis DeLosSantos <louis.delos at gmail.com> wrote:
>
> Hey all,
>
> I'm writing a Linux desktop shell which will have a built in audio mixer.
> I'm trying to isolate the API usage to the WirePlumber C API.
>
> Is it currently possible to "re-link" input or output streams to a
> different sink/source via WirePlumber?
>
> Is anyone able to point me to examples of doing this? I'm a bit
> confused about whether I need to delete the existing link and create a
> new one, or if I can update the existing link with new input/output
> ports.
>
> Thanks a lot.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 509 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/pipewire-devel/attachments/20240208/da256c25/attachment.sig>
More information about the Pipewire-devel
mailing list