libvlc: Set media player role to "Music"
Reason for the change
PipeWire/WirePlumber stream restore function often uses the streams media.role
property to restore stream volume and output device when a new stream is stated. By default libvlc doesn't have a value set for the relevant property, resulting in media.role = "Movie"
being the default. This is annoying (to me) as I'd like to use a different device (speakers) for music playback than for video playback (my headphones).
Test plan
I inspected the audio stream generated by Elisa with this patch applied. I first get the stream ID using wpctl status
and then inspecting the correct stream using wpctl inspect xxx
. It now (correctly) reports media.role = "Music"
instead of media.role = "Movie"
like before.
Stream restore is also working correctly with this patch applied:
- Play a video using e.g. mpv. Note which output device and playback volume are used for it. Quit mpv.
- Start Elisa and play a song and pause it after a bit.
- Either while still playing or when paused, change the volume and/or stream output device to something else.
- Pause the stream.
- Start playing a video (again) using e.g. mpv. Without the patch applied it should be using the same device/volume that Elisa is set to. With it applied it should be using whatever was used previously.
- Switch mpv to another audio device and/or change the playback volume.
- Start playing a new track in Elisa, either by clicking "Next track" or clicking one (even the same, already paused file works) in the playlist.
- Elisa starts a new stream. With the patch applied the stream should go to the device set in step 3 with the same volume it had before. Without the patch the stream uses the same properties as mpv in step 6.