Add support for virtual source

A virtual source is usually implemented with a null-sink, it looks
like a source to pulseaudio clients but just forwards what it gets
as input.

Make sure the port names make sense.

You can use the null sink now as:

pactl load-module module-null-sink sink_name=source object.linger=1
     media.class=Audio/Source/Virtual channel_map=FL,FR,RL,RR

     This creates a node with "input" and "capture" ports and looks
     like a virtual source for pulseaudio clients.

pactl load-module module-null-sink sink_name=source object.linger=1
     media.class=Audio/Sink channel_map=FL,FR,RL,RR

     This creates a node with "playback" and "monitor" ports and looks
     like a virtual sink for pulseaudio clients.

pactl load-module module-null-sink sink_name=source object.linger=1
     media.class=Audio/Duplex channel_map=FL,FR,RL,RR

     This creates a node with "playback" and "capture" ports and looks
     like a virtual source and sink for pulseaudio clients.
This commit is contained in:
Wim Taymans 2020-12-02 15:40:23 +01:00
parent e2f0ab5710
commit 3c2ab98a2a
4 changed files with 38 additions and 31 deletions

View file

@ -287,7 +287,9 @@ handle_node(struct impl *impl, struct sm_object *object)
else
return 0;
if (strcmp(media_class, "Sink") == 0 || strcmp(media_class, "Duplex") == 0)
if (strcmp(media_class, "Sink") == 0 ||
strcmp(media_class, "Duplex") == 0 ||
strcmp(media_class, "Source/Virtual") == 0)
direction = PW_DIRECTION_INPUT;
else if (strcmp(media_class, "Source") == 0)
direction = PW_DIRECTION_OUTPUT;