<div dir="auto">Thanks a ton for the info. </div><div dir="auto"><br></div><div dir="auto">I dug at this for awhile and yes, I wound up just calling into the pulse audio api to switch sink inputs. </div><div dir="auto"><br></div><div dir="auto">I dug enough to find that this file: <div><a href="https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/modules/module-protocol-pulse/modules/module-stream-restore.c?ref_type=heads">https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/modules/module-protocol-pulse/modules/module-stream-restore.c?ref_type=heads</a></div><div dir="auto"><br></div><div dir="auto">Is writing to metadata. I kinda quit there, because I couldnt tell if the metadata it was writing was "stuck" in the pulse audio module or was made available to the pipewire api proper. </div><div dir="auto"><br></div><div dir="auto">Sounds like from your response that the state that the pa stream restore module stashes on metadata is indeed available at the "default-metadata" object that I can retrieve on the registry? </div><div dir="auto"><br></div><div dir="auto">If so, thats great, i can remove the call into pulse-audio library and just use wireplumber/pipewire. </div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 8, 2024 at 3:46 PM George Kiagiadakis <<a href="mailto:mail@gkiagia.gr">mail@gkiagia.gr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Hi,<br>
<br>
Yes, it is easy to re-link streams to different sinks, similar to pavucontrol.<br>
<br>
You can do this by setting the “target.object” property in the “default” metadata object. The value may be the “<a href="http://node.name" rel="noreferrer" target="_blank">node.name</a>" or the “object.serial” of the target sink/source that you want to link your stream with.<br>
<br>
On the command line:<br>
<br>
pw-metadata -n default <ID of the stream> “target.object” “<name of the sink>” “Spa:String"<br>
<br>
For example:<br>
<br>
pw-metadata -n default 45 “target.object” “alsa_output.pci-0000_00_1f.3.analog-stereo” “Spa:String"<br>
<br>
Using the WirePlumber C API, you need to find the WpMetadata object first, using an object manager (use a constraint on “<a href="http://metadata.name" rel="noreferrer" target="_blank">metadata.name</a>” to match “default”) and then set the value with:<br>
<br>
wp_metadata_set (metadata, stream_node_id, PW_KEY_TARGET_OBJECT, “Spa:String”, target_node_name);<br>
<br>
PS: If you set the “object.serial” instead of the name, then the type should be “Spa:Id” instead.<br>
<br>
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.<br>
<br>
I hope this helps.<br>
<br>
Best regards,<br>
George<br>
<br>
<br>
> On 26 Jan 2024, at 18:09, Louis DeLosSantos <<a href="mailto:louis.delos@gmail.com" target="_blank">louis.delos@gmail.com</a>> wrote:<br>
> <br>
> Hey all,<br>
> <br>
> I'm writing a Linux desktop shell which will have a built in audio mixer.<br>
> I'm trying to isolate the API usage to the WirePlumber C API.<br>
> <br>
> Is it currently possible to "re-link" input or output streams to a<br>
> different sink/source via WirePlumber?<br>
> <br>
> Is anyone able to point me to examples of doing this? I'm a bit<br>
> confused about whether I need to delete the existing link and create a<br>
> new one, or if I can update the existing link with new input/output<br>
> ports.<br>
> <br>
> Thanks a lot.<br>
<br>
</blockquote></div></div>