diff --git a/src/examples/audio-src.c b/src/examples/audio-src.c index 03af12841..e8e3b6f9b 100644 --- a/src/examples/audio-src.c +++ b/src/examples/audio-src.c @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) pw_stream_connect(data.stream, PW_DIRECTION_OUTPUT, - argc > 1 ? argv[1] : NULL, + argc > 1 ? atoi(argv[1]) : SPA_ID_INVALID, PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS, diff --git a/src/examples/video-play.c b/src/examples/video-play.c index 0752b9fd8..69b92e361 100644 --- a/src/examples/video-play.c +++ b/src/examples/video-play.c @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) pw_stream_connect(data.stream, PW_DIRECTION_INPUT, - data.path, + data.path ? atoi(data.path) : SPA_ID_INVALID, PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | PW_STREAM_FLAG_EXCLUSIVE | diff --git a/src/examples/video-src.c b/src/examples/video-src.c index f09b4a47a..c365ac79d 100644 --- a/src/examples/video-src.c +++ b/src/examples/video-src.c @@ -257,7 +257,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo pw_stream_connect(data->stream, PW_DIRECTION_OUTPUT, - NULL, PW_STREAM_FLAG_DRIVER, + SPA_ID_INVALID, PW_STREAM_FLAG_DRIVER, params, 1); break; } diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index cd2aff85f..4a1d20283 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -528,7 +528,7 @@ gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) pw_stream_connect (pwsink->stream, PW_DIRECTION_OUTPUT, - pwsink->path, + pwsink->path ? atoi(pwsink->path) : SPA_ID_INVALID, flags, (const struct spa_pod **) possible->pdata, possible->len); diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 1124a19d4..14ccbe3fa 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -614,7 +614,7 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc) GST_DEBUG_OBJECT (basesrc, "connect capture with path %s", pwsrc->path); pw_stream_connect (pwsrc->stream, PW_DIRECTION_INPUT, - pwsrc->path, + pwsrc->path ? atoi(pwsrc->path) : SPA_ID_INVALID, PW_STREAM_FLAG_AUTOCONNECT, (const struct spa_pod **)possible->pdata, possible->len); diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 74037eca6..3a642c420 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1062,7 +1062,7 @@ static void add_controls(struct pw_stream *stream) int pw_stream_connect(struct pw_stream *stream, enum pw_direction direction, - const char *port_path, + uint32_t target_id, enum pw_stream_flags flags, const struct spa_pod **params, uint32_t n_params) @@ -1071,7 +1071,7 @@ pw_stream_connect(struct pw_stream *stream, enum pw_remote_state state; int i, res; - pw_log_debug("stream %p: connect path:%s", stream, port_path); + pw_log_debug("stream %p: connect target:%d", stream, target_id); impl->direction = direction == PW_DIRECTION_INPUT ? SPA_DIRECTION_INPUT : SPA_DIRECTION_OUTPUT; impl->flags = flags; @@ -1084,8 +1084,8 @@ pw_stream_connect(struct pw_stream *stream, stream_set_state(stream, PW_STREAM_STATE_CONNECTING, NULL); - if (port_path) - pw_properties_set(stream->properties, PW_NODE_PROP_TARGET_NODE, port_path); + if (target_id != SPA_ID_INVALID) + pw_properties_setf(stream->properties, PW_NODE_PROP_TARGET_NODE, "%d", target_id); if (flags & PW_STREAM_FLAG_AUTOCONNECT) pw_properties_set(stream->properties, PW_NODE_PROP_AUTOCONNECT, "1"); pw_properties_set(stream->properties, "node.stream", "1"); diff --git a/src/pipewire/stream.h b/src/pipewire/stream.h index d698c6cdd..6786017e6 100644 --- a/src/pipewire/stream.h +++ b/src/pipewire/stream.h @@ -268,8 +268,9 @@ int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict int pw_stream_connect(struct pw_stream *stream, /**< a \ref pw_stream */ enum pw_direction direction, /**< the stream direction */ - const char *port_path, /**< the port path to connect to or NULL - * to let the server choose a port */ + uint32_t target_id, /**< the target node to connect to or + * SPA_ID_INVALID to let the manager + * select a node. */ enum pw_stream_flags flags, /**< stream flags */ const struct spa_pod **params, /**< an array with params. The params * should ideally contain supported