I'd be interested in this as well, but could not get it to work. libshairplay on Kodi seems to expect a pretty special format/be picky. Maybe pipewire also only supports streams Apple devices like to see. Airvia on Android also initially did not work though it worked with Apple devices (https://github.com/jazzy1133/airvia/issues/2).
For the time being, I succeeded in streaming to the Pulseaudio socket of Libreelec, like so.
Open protocols are better anyway.
On Libreelec:
systemctl stop kodi; pactl load-module module-udev-detect; pactl load-module module-native-protocol-tcp auth-ip-acl=192.168.0.0/16; systemctl start kodi #Adapt IP range
pactl list sinks #shows all sinks
pactl get-default-sink #should give the ALSA device name you need for the pulse.target later on
This could be scripted to happen on every boot.
You should see an open port now with netstat -pant | grep 4713.
On the Linux box, create ~/.config/pipewire/pipewire.conf.d/kodi-pulse.conf (adapt libreelec IP or probably use DNS?)
context.modules = [
{
name = libpipewire-module-pulse-tunnel
args = {
tunnel.mode = sink
pulse.server.address = "tcp:192.168.1.100:4713"
pulse.target = "alsa_output.0.hdmi-stereo"
audio.format = "S16LE"
audio.rate = 44100
audio.channels = 2
audio.position = [ FL FR ]
stream.props = {
node.name = "libreelec-hdmi"
node.description = "LibreELEC HDMI"
node.nick = "LibreELEC HDMI"
}
}
}
]
Display More
Restart the whole stack.
openRC based Distros:
rc-service --user pipewire start && rc-service --user pipewire-pulse start && rc-service --user wireplumber start
systemd based ones (untested; if all else fails, logout and back in):
systemctl --user restart pipewire.service && systemctl --user restart pipewire-pulse.service && systemctl --user restart wireplumber.service
My Enlightenment Pulseaudio widget now shows "LibreELEC HDMI" as a sound card and it works nicely (and pretty latency free).
Only drawback: If you watch a movie on Kodi (DVD in my case) and pause it, you will get static after resuming instead of normal audio. Only fixable by unloading the PA module loaded above and restarting Kodi it seems.
That's why it's no real permanent solution yet.
But it does work and maybe Kodi can be reconfigured to use a different way to interact with pulseaudio so both work concurrently. I did not investigate any further how Kodi actually uses the audio hardware (ALSA? Pulse?)