diff --git a/src/pipewire/core-proxy.c b/src/pipewire/core-proxy.c index 3841be814..29a869c7a 100644 --- a/src/pipewire/core-proxy.c +++ b/src/pipewire/core-proxy.c @@ -409,6 +409,24 @@ error_free: return NULL; } +SPA_EXPORT +struct pw_core_proxy * +pw_core_connect_self(struct pw_core *core, struct pw_properties *properties, + size_t user_data_size) +{ + const struct pw_core_info *info; + + if (properties == NULL) + properties = pw_properties_new(NULL, NULL); + if (properties == NULL) + return NULL; + + info = pw_core_get_info(core); + pw_properties_set(properties, PW_KEY_REMOTE_NAME, info->name); + + return pw_core_connect(core, properties, user_data_size); +} + SPA_EXPORT int pw_core_proxy_steal_fd(struct pw_core_proxy *proxy) { diff --git a/src/pipewire/core-proxy.h b/src/pipewire/core-proxy.h index 2083237ca..9094727b6 100644 --- a/src/pipewire/core-proxy.h +++ b/src/pipewire/core-proxy.h @@ -55,6 +55,14 @@ pw_core_connect_fd(struct pw_core *core, /**< a \ref pw_core */ * the properties is taken.*/ size_t user_data_size /**< extra user data size */); +/** Connect to a given PipeWire instance \memberof pw_core_proxy + * \return a pw_core_proxy on success or NULL with errno set on error */ +struct pw_core_proxy * +pw_core_connect_self(struct pw_core *core, /**< a \ref pw_core to connect to */ + struct pw_properties *properties, /**< optional properties, ownership of + * the properties is taken.*/ + size_t user_data_size /**< extra user data size */); + /** Steal the fd of the core_proxy connection or < 0 on error. The core_proxy * will be disconnected after this call. */ int pw_core_proxy_steal_fd(struct pw_core_proxy *core_proxy);