diff --git a/src/modules/module-client-node/client-stream.c b/src/modules/module-client-node/client-stream.c index 4619e3b87..0e7722e53 100644 --- a/src/modules/module-client-node/client-stream.c +++ b/src/modules/module-client-node/client-stream.c @@ -754,10 +754,18 @@ static void client_node_initialized(void *data) uint8_t buffer[4096]; struct spa_pod_builder b; int res; + const struct pw_properties *props; + const char *str; + bool exclusive; pw_log_debug("client-stream %p: initialized", &impl->this); impl->cnode = pw_node_get_implementation(impl->client_node->node); + props = pw_node_get_properties(impl->client_node->node); + if (props != NULL && (str = pw_properties_get(props, PW_NODE_PROP_EXCLUSIVE)) != NULL) + exclusive = pw_properties_parse_bool(str); + else + exclusive = false; spa_graph_node_remove(&impl->client_node->node->rt.root); spa_graph_node_add(impl->this.node->rt.node.graph, &impl->client_node->node->rt.root); @@ -811,7 +819,9 @@ static void client_node_initialized(void *data) spa_type_map_get_type(t->map, media_type), spa_type_map_get_type(t->map, media_subtype)); - if (media_type == impl->type.media_type.audio && + + if (!exclusive && + media_type == impl->type.media_type.audio && media_subtype == impl->type.media_subtype.raw) { if ((impl->adapter = pw_load_spa_interface("audioconvert/libspa-audioconvert", "splitter", SPA_TYPE__Node, NULL, 0, NULL)) == NULL) diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 68da51480..ae95150e5 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1151,6 +1151,8 @@ pw_stream_connect(struct pw_stream *stream, pw_properties_set(stream->properties, "node.stream", "1"); if (flags & PW_STREAM_FLAG_DRIVER) pw_properties_set(stream->properties, "node.driver", "1"); + if (flags & PW_STREAM_FLAG_EXCLUSIVE) + pw_properties_set(stream->properties, PW_NODE_PROP_EXCLUSIVE, "1"); state = pw_remote_get_state(stream->remote, NULL); if (state == PW_REMOTE_STATE_UNCONNECTED || diff --git a/src/pipewire/stream.h b/src/pipewire/stream.h index 6a16638e0..18371274c 100644 --- a/src/pipewire/stream.h +++ b/src/pipewire/stream.h @@ -207,8 +207,11 @@ enum pw_stream_flags { PW_STREAM_FLAG_INACTIVE = (1 << 2), /**< start the stream inactive */ PW_STREAM_FLAG_MAP_BUFFERS = (1 << 3), /**< mmap the buffers */ PW_STREAM_FLAG_DRIVER = (1 << 4), /**< be a driver */ - PW_STREAM_FLAG_RT_PROCESS = (1 << 5), /**< call process from the realtime thread */ + PW_STREAM_FLAG_RT_PROCESS = (1 << 5), /**< call process from the realtime + * thread */ PW_STREAM_FLAG_NO_CONVERT = (1 << 6), /**< don't convert format */ + PW_STREAM_FLAG_EXCLUSIVE = (1 << 7), /**< require exclusive access to the + * device */ }; /** A time structure \memberof pw_stream */