mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
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:
parent
e2f0ab5710
commit
3c2ab98a2a
4 changed files with 38 additions and 31 deletions
|
|
@ -89,7 +89,7 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
|||
struct pw_properties *new;
|
||||
const char *str, *path, *node_name, *media_class;
|
||||
char position[8], *prefix;
|
||||
bool is_monitor, is_device, is_duplex;
|
||||
bool is_monitor, is_device, is_duplex, is_virtual;
|
||||
|
||||
direction = pw_impl_port_get_direction(port);
|
||||
|
||||
|
|
@ -112,14 +112,19 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
|||
is_device = false;
|
||||
|
||||
is_duplex = media_class != NULL && strstr(media_class, "Duplex") != NULL;
|
||||
is_virtual = media_class != NULL && strstr(media_class, "Virtual") != NULL;
|
||||
|
||||
new = pw_properties_new(NULL, NULL);
|
||||
|
||||
if (is_monitor && !is_duplex)
|
||||
prefix = "monitor";
|
||||
else if (is_device || is_duplex)
|
||||
if (is_duplex)
|
||||
prefix = direction == PW_DIRECTION_INPUT ?
|
||||
"playback" : "capture";
|
||||
else if (is_virtual)
|
||||
prefix = direction == PW_DIRECTION_INPUT ?
|
||||
"input" : "capture";
|
||||
else if (is_device)
|
||||
prefix = direction == PW_DIRECTION_INPUT ?
|
||||
"playback" : is_monitor ? "monitor" : "capture";
|
||||
else
|
||||
prefix = direction == PW_DIRECTION_INPUT ?
|
||||
"input" : "output";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue