Commit 0a690f61 authored by Julian Bouzas's avatar Julian Bouzas
Browse files

core: add wp_core_create_local_object API

parent 55ff0a63
...@@ -545,6 +545,43 @@ wp_core_get_remote_state (WpCore * self, const gchar ** error) ...@@ -545,6 +545,43 @@ wp_core_get_remote_state (WpCore * self, const gchar ** error)
return (WpRemoteState) pw_remote_get_state (self->pw_remote, error); return (WpRemoteState) pw_remote_get_state (self->pw_remote, error);
} }
WpProxy *
wp_core_create_local_object (WpCore * self, const gchar *factory_name,
guint32 interface_type, guint32 interface_version,
WpProperties * properties)
{
struct pw_proxy *pw_proxy = NULL;
struct pw_factory *factory = NULL;
gpointer iface = NULL;
g_return_val_if_fail (WP_IS_CORE (self), NULL);
g_return_val_if_fail (self->pw_core, NULL);
g_return_val_if_fail (self->pw_remote, NULL);
factory = pw_core_find_factory (self->pw_core, factory_name);
if (!factory)
return NULL;
iface = pw_factory_create_object (factory,
NULL,
interface_type,
interface_version,
properties ? wp_properties_to_pw_properties (properties) : NULL,
0);
if (!iface)
return NULL;
pw_proxy = pw_remote_export (self->pw_remote,
interface_type,
properties ? wp_properties_to_pw_properties (properties) : NULL,
iface,
0);
if (!pw_proxy)
return NULL;
return wp_proxy_new_wrap (self, pw_proxy, interface_type, interface_version);
}
WpProxy * WpProxy *
wp_core_create_remote_object (WpCore *self, wp_core_create_remote_object (WpCore *self,
const gchar *factory_name, guint32 interface_type, const gchar *factory_name, guint32 interface_type,
......
...@@ -50,6 +50,9 @@ struct pw_remote * wp_core_get_pw_remote (WpCore * self); ...@@ -50,6 +50,9 @@ struct pw_remote * wp_core_get_pw_remote (WpCore * self);
gboolean wp_core_connect (WpCore * self); gboolean wp_core_connect (WpCore * self);
WpRemoteState wp_core_get_remote_state (WpCore * self, const gchar ** error); WpRemoteState wp_core_get_remote_state (WpCore * self, const gchar ** error);
WpProxy * wp_core_create_local_object (WpCore * self,
const gchar *factory_name, guint32 interface_type,
guint32 interface_version, WpProperties * properties);
WpProxy * wp_core_create_remote_object (WpCore * self, WpProxy * wp_core_create_remote_object (WpCore * self,
const gchar * factory_name, guint32 interface_type, const gchar * factory_name, guint32 interface_type,
guint32 interface_version, WpProperties * properties); guint32 interface_version, WpProperties * properties);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment