summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-07-12 10:04:26 +0200
committerWim Taymans <wtaymans@redhat.com>2019-07-12 10:04:26 +0200
commit3745f79fc5b7b49b65718af9561cc72449dab05a (patch)
tree457e100c219be257a67e8315a32a46d34b53634d /src
parent57d471b6f45f2e4d3f4f289b9d0b75ac619e8a29 (diff)
media-session: create a local adaper+a2dp sink/source
Run the a2dp sink and sources with the adapter in the session manager and export it to PipeWire. The idea is that the codecs should not preferably not run inside the daemon.
Diffstat (limited to 'src')
-rw-r--r--src/examples/bluez-monitor.c32
-rw-r--r--src/examples/media-session.c1
2 files changed, 22 insertions, 11 deletions
diff --git a/src/examples/bluez-monitor.c b/src/examples/bluez-monitor.c
index 64c344a9..5657e084 100644
--- a/src/examples/bluez-monitor.c
+++ b/src/examples/bluez-monitor.c
@@ -50,9 +50,8 @@ struct bluez5_node {
struct pw_properties *props;
- struct spa_handle *handle;
+ struct pw_node *adapter;
struct pw_proxy *proxy;
- struct spa_node *node;
};
struct bluez5_object {
@@ -94,6 +93,7 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
struct bluez5_node *node;
struct monitor *monitor = obj->monitor;
struct impl *impl = monitor->impl;
+ struct pw_factory *factory;
int res;
const char *str;
@@ -109,7 +109,8 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
goto exit;
}
- node->props = pw_properties_new_dict(info->props);
+ node->props = pw_properties_copy(obj->props);
+ pw_properties_update(node->props, info->props);
str = pw_properties_get(obj->props, PW_KEY_DEVICE_NICK);
if (str == NULL)
@@ -124,16 +125,26 @@ static struct bluez5_node *bluez5_create_node(struct bluez5_object *obj, uint32_
node->monitor = monitor;
node->object = obj;
node->id = id;
- node->proxy = pw_core_proxy_create_object(impl->core_proxy,
- "adapter",
- PW_TYPE_INTERFACE_Node,
- PW_VERSION_NODE_PROXY,
- &node->props->dict,
- 0);
- if (node->proxy == NULL) {
+
+ factory = pw_core_find_factory(impl->core, "adapter");
+ if (factory == NULL) {
+ pw_log_error("no adapter factory found");
+ res = -EIO;
+ goto clean_node;
+ }
+ node->adapter = pw_factory_create_object(factory,
+ NULL,
+ PW_TYPE_INTERFACE_Node,
+ PW_VERSION_NODE_PROXY,
+ node->props,
+ 0);
+ if (node->adapter == NULL) {
res = -errno;
goto clean_node;
}
+ node->proxy = pw_remote_export(impl->remote,
+ PW_TYPE_INTERFACE_Node,
+ node->props, node->adapter, 0);
spa_list_append(&obj->node_list, &node->link);
@@ -154,7 +165,6 @@ static void bluez5_remove_node(struct bluez5_object *obj, struct bluez5_node *no
pw_log_debug("remove node %u", node->id);
spa_list_remove(&node->link);
pw_proxy_destroy(node->proxy);
- free(node->handle);
free(node);
}
diff --git a/src/examples/media-session.c b/src/examples/media-session.c
index d81b877a..02084178 100644
--- a/src/examples/media-session.c
+++ b/src/examples/media-session.c
@@ -1267,6 +1267,7 @@ int main(int argc, char *argv[])
pw_core_add_spa_lib(impl.core, "api.v4l2.*", "v4l2/libspa-v4l2");
pw_module_load(impl.core, "libpipewire-module-client-device", NULL, NULL, NULL, NULL);
+ pw_module_load(impl.core, "libpipewire-module-adapter", NULL, NULL, NULL, NULL);
clock_gettime(CLOCK_MONOTONIC, &impl.now);