summaryrefslogtreecommitdiff
path: root/src/examples/export-source.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/export-source.c')
-rw-r--r--src/examples/export-source.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/examples/export-source.c b/src/examples/export-source.c
index 1716da49..ff0e8c21 100644
--- a/src/examples/export-source.c
+++ b/src/examples/export-source.c
@@ -53,10 +53,8 @@ struct data {
struct pw_main_loop *loop;
- struct pw_impl_core *core;
-
- struct pw_remote *remote;
- struct spa_hook remote_listener;
+ struct pw_core *core;
+ struct spa_hook core_listener;
uint64_t info_all;
struct spa_port_info info;
@@ -481,33 +479,26 @@ static void make_node(struct data *data)
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,
&impl_node, data);
- pw_remote_export(data->remote, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
+
+ pw_core_export_object(data->core,
+ SPA_TYPE_INTERFACE_Node,
+ &props->dict,
+ &data->impl_node.iface, 0);
}
-static void on_state_changed(void *_data, enum pw_remote_state old,
- enum pw_remote_state state, const char *error)
+static void on_error(void *object, uint32_t id, int seq, int res, const char *message)
{
- struct data *data = _data;
+ struct data *data = object;
- switch (state) {
- case PW_REMOTE_STATE_ERROR:
- printf("remote error: %s\n", error);
+ printf("error: %s\n", message);
+ if (id == 0) {
pw_main_loop_quit(data->loop);
- break;
-
- case PW_REMOTE_STATE_CONNECTED:
- make_node(data);
- break;
-
- default:
- printf("remote state: \"%s\"\n", pw_remote_state_as_string(state));
- break;
}
}
-static const struct pw_remote_events remote_events = {
- PW_VERSION_REMOTE_EVENTS,
- .state_changed = on_state_changed,
+static const struct pw_core_events core_events = {
+ PW_VERSION_CORE_EVENTS,
+ .error = on_error,
};
int main(int argc, char *argv[])
@@ -517,8 +508,7 @@ int main(int argc, char *argv[])
pw_init(&argc, &argv);
data.loop = pw_main_loop_new(NULL);
- data.core = pw_impl_core_new(pw_main_loop_get_loop(data.loop), NULL, 0);
- data.remote = pw_remote_new(data.core, NULL, 0);
+ data.core = pw_core_connect(pw_main_loop_get_loop(data.loop), NULL, 0);
data.path = argc > 1 ? argv[1] : NULL;
data.info_all = SPA_PORT_CHANGE_MASK_FLAGS |
@@ -540,13 +530,13 @@ int main(int argc, char *argv[])
spa_list_init(&data.empty);
spa_hook_list_init(&data.hooks);
- pw_remote_add_listener(data.remote, &data.remote_listener, &remote_events, &data);
+ pw_core_add_listener(data.core, &data.core_listener, &core_events, &data);
- pw_remote_connect(data.remote);
+ make_node(&data);
pw_main_loop_run(data.loop);
- pw_impl_core_destroy(data.core);
+ pw_core_disconnect(data.core);
pw_main_loop_destroy(data.loop);
return 0;