mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
bluetooth: Add support for transport created by external profile
With BlueZ 5 it is possible to have profile registered by a third party process which does not share the same bus id as bluetoothd so it is necessary to store the sender of the transport to be able to talk to it. Note that this is backward compatible.
This commit is contained in:
parent
d4368aa608
commit
31d905aaae
2 changed files with 10 additions and 5 deletions
|
|
@ -153,6 +153,7 @@ static void transport_free(pa_bluetooth_transport *t) {
|
|||
for (i = 0; i < PA_BLUETOOTH_TRANSPORT_HOOK_MAX; i++)
|
||||
pa_hook_done(&t->hooks[i]);
|
||||
|
||||
pa_xfree(t->owner);
|
||||
pa_xfree(t->path);
|
||||
pa_xfree(t->config);
|
||||
pa_xfree(t);
|
||||
|
|
@ -1042,7 +1043,7 @@ int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, const char *access
|
|||
|
||||
dbus_error_init(&err);
|
||||
|
||||
pa_assert_se(m = dbus_message_new_method_call("org.bluez", t->path, "org.bluez.MediaTransport", "Acquire"));
|
||||
pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport", "Acquire"));
|
||||
pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID));
|
||||
r = dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(t->y->connection), m, -1, &err);
|
||||
|
||||
|
|
@ -1078,7 +1079,7 @@ void pa_bluetooth_transport_release(pa_bluetooth_transport *t, const char *acces
|
|||
|
||||
dbus_error_init(&err);
|
||||
|
||||
pa_assert_se(m = dbus_message_new_method_call("org.bluez", t->path, "org.bluez.MediaTransport", "Release"));
|
||||
pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport", "Release"));
|
||||
pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID));
|
||||
dbus_connection_send_with_reply_and_block(pa_dbus_connection_get(t->y->connection), m, -1, &err);
|
||||
|
||||
|
|
@ -1105,12 +1106,13 @@ static int setup_dbus(pa_bluetooth_discovery *y) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static pa_bluetooth_transport *transport_new(pa_bluetooth_discovery *y, const char *path, enum profile p, const uint8_t *config, int size) {
|
||||
static pa_bluetooth_transport *transport_new(pa_bluetooth_discovery *y, const char *owner, const char *path, enum profile p, const uint8_t *config, int size) {
|
||||
pa_bluetooth_transport *t;
|
||||
unsigned i;
|
||||
|
||||
t = pa_xnew0(pa_bluetooth_transport, 1);
|
||||
t->y = y;
|
||||
t->owner = pa_xstrdup(owner);
|
||||
t->path = pa_xstrdup(path);
|
||||
t->profile = p;
|
||||
t->config_size = size;
|
||||
|
|
@ -1130,7 +1132,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
|
|||
pa_bluetooth_discovery *y = userdata;
|
||||
pa_bluetooth_device *d;
|
||||
pa_bluetooth_transport *t;
|
||||
const char *path, *dev_path = NULL, *uuid = NULL;
|
||||
const char *sender, *path, *dev_path = NULL, *uuid = NULL;
|
||||
uint8_t *config = NULL;
|
||||
int size = 0;
|
||||
pa_bool_t nrec = FALSE;
|
||||
|
|
@ -1199,7 +1201,9 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
|
|||
else
|
||||
p = PROFILE_A2DP_SOURCE;
|
||||
|
||||
t = transport_new(y, path, p, config, size);
|
||||
sender = dbus_message_get_sender(m);
|
||||
|
||||
t = transport_new(y, sender, path, p, config, size);
|
||||
if (nrec)
|
||||
t->nrec = nrec;
|
||||
pa_hashmap_put(d->transports, t->path, t);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ typedef enum pa_bluetooth_transport_hook {
|
|||
|
||||
struct pa_bluetooth_transport {
|
||||
pa_bluetooth_discovery *y;
|
||||
char *owner;
|
||||
char *path;
|
||||
enum profile profile;
|
||||
uint8_t codec;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue