create-item: handle all kinds of Audio/Video & Stream nodes

And be careful not to handle nodes created by si-audio-endpoint,
by using a specific property for that.

Also, use Audio/{Source,Sink}/Virtual as the media class of null sinks
created by si-audio-endpoint, it sounds more appropriate.

Fixes #34
This commit is contained in:
George Kiagiadakis
2021-06-10 16:38:34 +03:00
parent 558ab50367
commit 950c358180
2 changed files with 19 additions and 7 deletions

View File

@@ -182,6 +182,8 @@ si_audio_endpoint_enable_active (WpSessionItem *si, WpTransition *transition)
g_autofree gchar *name = g_strdup_printf ("control.%s", self->name);
g_autofree gchar *desc = g_strdup_printf ("%s %s Endpoint", self->role,
(self->direction == WP_DIRECTION_OUTPUT) ? "Capture" : "Playback");
g_autofree gchar *media = g_strdup_printf ("Audio/%s/Virtual",
(self->direction == WP_DIRECTION_OUTPUT) ? "Source" : "Sink");
if (!wp_session_item_is_configured (si)) {
wp_transition_return_error (transition,
@@ -194,10 +196,11 @@ si_audio_endpoint_enable_active (WpSessionItem *si, WpTransition *transition)
self->node = wp_node_new_from_factory (core, "adapter",
wp_properties_new (
PW_KEY_NODE_NAME, name,
PW_KEY_MEDIA_CLASS, "Audio/Duplex",
PW_KEY_MEDIA_CLASS, media,
PW_KEY_FACTORY_NAME, "support.null-audio-sink",
PW_KEY_NODE_DESCRIPTION, desc,
"monitor.channel-volumes", "true",
"wireplumber.is-endpoint", "true",
NULL));
if (!self->node) {
wp_transition_return_error (transition,

View File

@@ -30,12 +30,21 @@ function addItem (node, item_type)
end)
end
nodes_om = ObjectManager { Interest { type = "node",
Constraint { "media.class", "c",
"Stream/Input/Audio", "Stream/Output/Audio", "Stream/Input/Video",
"Audio/Source", "Audio/Sink", "Video/Source",
type = "pw-global" },
} }
nodes_om = ObjectManager {
Interest {
type = "node",
Constraint { "media.class", "#", "Stream/*", type = "pw-global" },
},
Interest {
type = "node",
Constraint { "media.class", "#", "Video/*", type = "pw-global" },
},
Interest {
type = "node",
Constraint { "media.class", "#", "Audio/*", type = "pw-global" },
Constraint { "wireplumber.is-endpoint", "-", type = "pw" },
},
}
nodes_om:connect("object-added", function (om, node)
local media_class = node.properties['media.class']