mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: move dbus helpers out of bluez plugin
The file is moved into a new "include-private" directory. This is done because otherwise adjustments would have to be made to the list of installed headers, the way include tests currently work and which files are used for generating documentation.
This commit is contained in:
parent
ddf3be0a39
commit
4aa2e44796
9 changed files with 12 additions and 11 deletions
|
|
@ -16,9 +16,9 @@
|
|||
#include <spa/utils/string.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/param/audio/raw.h>
|
||||
#include <spa-private/dbus-helpers.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "dbus-helpers.h"
|
||||
|
||||
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.bluez5.hsphfpd");
|
||||
#undef SPA_LOG_TOPIC_DEFAULT
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/json.h>
|
||||
#include <spa/param/audio/raw.h>
|
||||
#include <spa-private/dbus-helpers.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
|
|
@ -33,7 +34,6 @@
|
|||
#include <libusb.h>
|
||||
#endif
|
||||
|
||||
#include "dbus-helpers.h"
|
||||
#include "modemmanager.h"
|
||||
#include "upower.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/param/audio/raw.h>
|
||||
#include <spa-private/dbus-helpers.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "dbus-helpers.h"
|
||||
|
||||
#define INITIAL_INTERVAL_NSEC (500 * SPA_NSEC_PER_MSEC)
|
||||
#define ACTION_INTERVAL_NSEC (3000 * SPA_NSEC_PER_MSEC)
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@
|
|||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/utils/json.h>
|
||||
#include <spa-private/dbus-helpers.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "codec-loader.h"
|
||||
#include "dbus-helpers.h"
|
||||
#include "player.h"
|
||||
#include "iso-io.h"
|
||||
#include "bap-codec-caps.h"
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
/* Spa Bluez5 DBus helpers */
|
||||
/* SPDX-FileCopyrightText: Copyright © 2023 PipeWire authors */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
#ifndef SPA_BLUEZ5_DBUS_HELPERS_H
|
||||
#define SPA_BLUEZ5_DBUS_HELPERS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <spa/utils/cleanup.h>
|
||||
|
||||
static inline void cancel_and_unref(DBusPendingCall **pp)
|
||||
{
|
||||
DBusPendingCall *pending_call = spa_steal_ptr(*pp);
|
||||
|
||||
if (pending_call) {
|
||||
dbus_pending_call_cancel(pending_call);
|
||||
dbus_pending_call_unref(pending_call);
|
||||
}
|
||||
}
|
||||
|
||||
static inline DBusMessage *steal_reply_and_unref(DBusPendingCall **pp)
|
||||
{
|
||||
DBusPendingCall *pending_call = spa_steal_ptr(*pp);
|
||||
|
||||
DBusMessage *reply = dbus_pending_call_steal_reply(pending_call);
|
||||
dbus_pending_call_unref(pending_call);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
SPA_DEFINE_AUTOPTR_CLEANUP(DBusMessage, DBusMessage, {
|
||||
spa_clear_ptr(*thing, dbus_message_unref);
|
||||
})
|
||||
|
||||
static inline bool reply_with_error(DBusConnection *conn,
|
||||
DBusMessage *reply_to,
|
||||
const char *error_name, const char *error_message)
|
||||
{
|
||||
spa_autoptr(DBusMessage) reply = dbus_message_new_error(reply_to, error_name, error_message);
|
||||
|
||||
return reply && dbus_connection_send(conn, reply, NULL);
|
||||
}
|
||||
|
||||
static inline DBusPendingCall *send_with_reply(DBusConnection *conn,
|
||||
DBusMessage *m,
|
||||
DBusPendingCallNotifyFunction callback, void *user_data)
|
||||
{
|
||||
DBusPendingCall *pending_call;
|
||||
|
||||
if (!dbus_connection_send_with_reply(conn, m, &pending_call, DBUS_TIMEOUT_USE_DEFAULT))
|
||||
return NULL;
|
||||
|
||||
if (!pending_call)
|
||||
return NULL;
|
||||
|
||||
if (!dbus_pending_call_set_notify(pending_call, callback, user_data, NULL)) {
|
||||
dbus_pending_call_cancel(pending_call);
|
||||
dbus_pending_call_unref(pending_call);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pending_call;
|
||||
}
|
||||
|
||||
SPA_DEFINE_AUTO_CLEANUP(DBusError, DBusError, {
|
||||
dbus_error_free(thing);
|
||||
})
|
||||
|
||||
#endif /* SPA_BLUEZ5_DBUS_HELPERS_H */
|
||||
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa-private/dbus-helpers.h>
|
||||
|
||||
#include <ModemManager.h>
|
||||
|
||||
#include "dbus-helpers.h"
|
||||
#include "modemmanager.h"
|
||||
|
||||
#define DBUS_INTERFACE_OBJECTMANAGER "org.freedesktop.DBus.ObjectManager"
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
#include <dbus/dbus.h>
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa-private/dbus-helpers.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "dbus-helpers.h"
|
||||
#include "player.h"
|
||||
|
||||
#define PLAYER_OBJECT_PATH_BASE "/media_player"
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa-private/dbus-helpers.h>
|
||||
|
||||
#include "dbus-helpers.h"
|
||||
#include "upower.h"
|
||||
|
||||
#define UPOWER_SERVICE "org.freedesktop.UPower"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue