stream: add exclusive flag

With the exclusive flag we don't go through the audio-dsp.
This commit is contained in:
Wim Taymans 2018-05-08 10:47:18 +02:00
parent eb96ed45d7
commit 27c53a31bc
3 changed files with 17 additions and 2 deletions

View file

@ -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)

View file

@ -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 ||

View file

@ -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 */