mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
dbus: move rtkit to module
Move the rtkit code to a module. Make sure we don't need to include the dbus headers in the spa dbus interface. This removes the dependency on dbus.
This commit is contained in:
parent
06ba8c9a7e
commit
9d4b0d8358
9 changed files with 185 additions and 207 deletions
|
|
@ -27,6 +27,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/support/type-map.h>
|
||||
#include <spa/support/loop.h>
|
||||
|
|
@ -1187,7 +1189,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct spa_bt_monitor *this;
|
||||
uint32_t i;
|
||||
DBusError err;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -1215,11 +1216,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
}
|
||||
init_type(&this->type, this->map);
|
||||
|
||||
dbus_error_init(&err);
|
||||
|
||||
this->dbus_connection = spa_dbus_get_connection(this->dbus, DBUS_BUS_SYSTEM, &err);
|
||||
this->dbus_connection = spa_dbus_get_connection(this->dbus, DBUS_BUS_SYSTEM);
|
||||
if (this->dbus_connection == NULL) {
|
||||
spa_log_error(this->log, "no dbus connection: %s", err.message);
|
||||
spa_log_error(this->log, "no dbus connection");
|
||||
return -EIO;
|
||||
}
|
||||
this->conn = spa_dbus_connection_get(this->dbus_connection);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <spa/support/type-map.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/support/plugin.h>
|
||||
|
|
@ -255,7 +257,7 @@ static void wakeup_main(void *userdata)
|
|||
spa_loop_utils_enable_idle(impl->utils, this->dispatch_event, true);
|
||||
}
|
||||
|
||||
static DBusConnection *
|
||||
static void *
|
||||
impl_connection_get(struct spa_dbus_connection *conn)
|
||||
{
|
||||
struct connection *this = SPA_CONTAINER_OF(conn, struct connection, this);
|
||||
|
|
@ -286,18 +288,18 @@ static const struct spa_dbus_connection impl_connection = {
|
|||
|
||||
static struct spa_dbus_connection *
|
||||
impl_get_connection(struct spa_dbus *dbus,
|
||||
DBusBusType type,
|
||||
DBusError *error)
|
||||
enum spa_dbus_type type)
|
||||
{
|
||||
struct impl *impl = SPA_CONTAINER_OF(dbus, struct impl, dbus);
|
||||
struct connection *conn;
|
||||
DBusError error;
|
||||
|
||||
dbus_error_init(error);
|
||||
dbus_error_init(&error);
|
||||
|
||||
conn = calloc(1, sizeof(struct connection));
|
||||
conn->this = impl_connection;
|
||||
conn->impl = impl;
|
||||
conn->conn = dbus_bus_get_private(type, error);
|
||||
conn->conn = dbus_bus_get_private(type, &error);
|
||||
if (conn->conn == NULL)
|
||||
goto error;
|
||||
|
||||
|
|
@ -317,6 +319,8 @@ impl_get_connection(struct spa_dbus *dbus,
|
|||
return &conn->this;
|
||||
|
||||
error:
|
||||
spa_log_error(impl->log, "Failed to connect to system bus: %s", error.message);
|
||||
dbus_error_free(&error);
|
||||
free(conn);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue