core-proxy: add connect_self

This commit is contained in:
Wim Taymans 2019-12-06 17:10:21 +01:00
parent ca6f1bd2f1
commit 7b0b5b77c3
2 changed files with 26 additions and 0 deletions

View file

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

View file

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