diff options
Diffstat (limited to 'spa')
-rw-r--r-- | spa/plugins/bluez5/backend-hsp-native.c | 11 | ||||
-rw-r--r-- | spa/plugins/bluez5/backend-ofono.c | 13 | ||||
-rw-r--r-- | spa/plugins/bluez5/bluez5-dbus.c | 4 | ||||
-rw-r--r-- | spa/plugins/bluez5/defs.h | 12 |
4 files changed, 15 insertions, 25 deletions
diff --git a/spa/plugins/bluez5/backend-hsp-native.c b/spa/plugins/bluez5/backend-hsp-native.c index d5604d25..6e34ac70 100644 --- a/spa/plugins/bluez5/backend-hsp-native.c +++ b/spa/plugins/bluez5/backend-hsp-native.c @@ -44,7 +44,6 @@ struct spa_bt_backend { struct spa_log *log; struct spa_loop *main_loop; struct spa_dbus *dbus; - struct spa_dbus_connection *dbus_connection; DBusConnection *conn; }; @@ -643,6 +642,7 @@ void backend_hsp_native_free(struct spa_bt_backend *backend) } struct spa_bt_backend *backend_hsp_native_new(struct spa_bt_monitor *monitor, + void *dbus_connection, const struct spa_support *support, uint32_t n_support) { @@ -656,14 +656,7 @@ struct spa_bt_backend *backend_hsp_native_new(struct spa_bt_monitor *monitor, backend->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); backend->dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus); backend->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop); - - backend->dbus_connection = spa_dbus_get_connection(backend->dbus, SPA_DBUS_TYPE_SYSTEM); - if (backend->dbus_connection == NULL) { - spa_log_error(backend->log, "no dbus connection"); - free(backend); - return NULL; - } - backend->conn = spa_dbus_connection_get(backend->dbus_connection); + backend->conn = dbus_connection; return backend; }
\ No newline at end of file diff --git a/spa/plugins/bluez5/backend-ofono.c b/spa/plugins/bluez5/backend-ofono.c index 412e46ce..c1864ea4 100644 --- a/spa/plugins/bluez5/backend-ofono.c +++ b/spa/plugins/bluez5/backend-ofono.c @@ -45,7 +45,6 @@ struct spa_bt_backend { struct spa_log *log; struct spa_loop *main_loop; struct spa_dbus *dbus; - struct spa_dbus_connection *dbus_connection; DBusConnection *conn; unsigned int filters_added:1; @@ -337,7 +336,7 @@ static DBusHandlerResult ofono_new_audio_connection(DBusConnection *conn, DBusMe fail: if (r) { - dbus_connection_send(spa_dbus_connection_get(backend->dbus_connection), r, NULL); + dbus_connection_send(backend->conn, r, NULL); dbus_message_unref(r); } @@ -602,6 +601,7 @@ void backend_ofono_free(struct spa_bt_backend *backend) } struct spa_bt_backend *backend_ofono_new(struct spa_bt_monitor *monitor, + void *dbus_connection, const struct spa_support *support, uint32_t n_support) { @@ -618,14 +618,7 @@ struct spa_bt_backend *backend_ofono_new(struct spa_bt_monitor *monitor, backend->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); backend->dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus); backend->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop); - - backend->dbus_connection = spa_dbus_get_connection(backend->dbus, SPA_DBUS_TYPE_SYSTEM); - if (backend->dbus_connection == NULL) { - spa_log_error(backend->log, "no dbus connection"); - free(backend); - return NULL; - } - backend->conn = spa_dbus_connection_get(backend->dbus_connection); + backend->conn = dbus_connection; if (!dbus_connection_register_object_path(backend->conn, OFONO_AUDIO_CLIENT, diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index e0c5b98e..92d2b164 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -1742,8 +1742,8 @@ impl_init(const struct spa_handle_factory *factory, spa_list_init(&this->device_list); spa_list_init(&this->transport_list); - this->backend_hsp_native = backend_hsp_native_new(this, support, n_support); - this->backend_ofono = backend_ofono_new(this, support, n_support); + this->backend_hsp_native = backend_hsp_native_new(this, this->conn, support, n_support); + this->backend_ofono = backend_ofono_new(this, this->conn, support, n_support); return 0; } diff --git a/spa/plugins/bluez5/defs.h b/spa/plugins/bluez5/defs.h index d1c4a7d2..b3a1c2d1 100644 --- a/spa/plugins/bluez5/defs.h +++ b/spa/plugins/bluez5/defs.h @@ -299,14 +299,16 @@ static inline enum spa_bt_transport_state spa_bt_transport_state_from_string(con #ifdef HAVE_BLUEZ_5_BACKEND_NATIVE struct spa_bt_backend *backend_hsp_native_new(struct spa_bt_monitor *monitor, + void *dbus_connection, const struct spa_support *support, - uint32_t n_support); + uint32_t n_support); void backend_hsp_native_free(struct spa_bt_backend *backend); void backend_hsp_native_register_profiles(struct spa_bt_backend *backend); #else static inline struct spa_bt_backend *backend_hsp_native_new(struct spa_bt_monitor *monitor, + void *dbus_connection, const struct spa_support *support, - uint32_t n_support) { + uint32_t n_support) { return NULL; } static inline void backend_hsp_native_free(struct spa_bt_backend *backend) {} @@ -315,14 +317,16 @@ static inline void backend_hsp_native_register_profiles(struct spa_bt_backend *b #ifdef HAVE_BLUEZ_5_BACKEND_OFONO struct spa_bt_backend *backend_ofono_new(struct spa_bt_monitor *monitor, + void *dbus_connection, const struct spa_support *support, - uint32_t n_support); + uint32_t n_support); void backend_ofono_free(struct spa_bt_backend *backend); void backend_ofono_add_filters(struct spa_bt_backend *backend); #else static inline struct spa_bt_backend *backend_ofono_new(struct spa_bt_monitor *monitor, + void *dbus_connection, const struct spa_support *support, - uint32_t n_support) { + uint32_t n_support) { return NULL; } static inline void backend_ofono_free(struct spa_bt_backend *backend) {} |