mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
bluez: support compile-time distinction between bluez4 and bluez5
Signed-off-by: Nick Stoughton <nstoughton@aether.com> https://bugzilla.gnome.org/show_bug.cgi?id=738626
This commit is contained in:
parent
c8fa688d26
commit
a344b99c98
2 changed files with 37 additions and 6 deletions
15
configure.ac
15
configure.ac
|
@ -1655,11 +1655,20 @@ esac
|
|||
dnl *** bluez ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_BLUEZ, true)
|
||||
AG_GST_CHECK_FEATURE(BLUEZ, [Bluez], bluez, [
|
||||
PKG_CHECK_MODULES([BLUEZ], [bluez < 5.0], [
|
||||
PKG_CHECK_MODULES([BLUEZ4], [bluez < 5.0], [
|
||||
HAVE_BLUEZ=yes
|
||||
AC_DEFINE(HAVE_BLUEZ4,[1],[Old bluez detected])
|
||||
], [
|
||||
PKG_CHECK_MODULES([BLUEZ5], [bluez >= 5.0], [
|
||||
HAVE_BLUEZ=yes
|
||||
AC_DEFINE(HAVE_BLUEZ5,[1],[Current bluez detected])
|
||||
], [
|
||||
HAVE_BLUEZ=no
|
||||
])
|
||||
])
|
||||
AS_IF([ test x$HAVE_BLUEZ = xyes ],[
|
||||
dnl FIXME: we should be able to replace this with the GLib DBus stuff
|
||||
PKG_CHECK_MODULES([DBUS], [dbus-1], [HAVE_BLUEZ=yes], [HAVE_BLUEZ=no])
|
||||
], [
|
||||
HAVE_BLUEZ=no
|
||||
])
|
||||
])
|
||||
|
||||
|
|
|
@ -49,7 +49,9 @@ gst_avdtp_connection_acquire (GstAvdtpConnection * conn)
|
|||
{
|
||||
DBusMessage *msg, *reply;
|
||||
DBusError err;
|
||||
#ifdef HAVE_BLUEZ4
|
||||
const char *access_type = "rw";
|
||||
#endif
|
||||
int fd;
|
||||
uint16_t imtu, omtu;
|
||||
|
||||
|
@ -63,11 +65,16 @@ gst_avdtp_connection_acquire (GstAvdtpConnection * conn)
|
|||
if (conn->data.conn == NULL)
|
||||
conn->data.conn = dbus_bus_get (DBUS_BUS_SYSTEM, &err);
|
||||
|
||||
#ifdef HAVE_BLUEZ4
|
||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||
"org.bluez.MediaTransport", "Acquire");
|
||||
|
||||
dbus_message_append_args (msg, DBUS_TYPE_STRING, &access_type,
|
||||
DBUS_TYPE_INVALID);
|
||||
#else
|
||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||
"org.bluez.MediaTransport1", "Acquire");
|
||||
#endif
|
||||
|
||||
reply = dbus_connection_send_with_reply_and_block (conn->data.conn,
|
||||
msg, -1, &err);
|
||||
|
@ -106,6 +113,7 @@ static void
|
|||
gst_avdtp_connection_transport_release (GstAvdtpConnection * conn)
|
||||
{
|
||||
DBusMessage *msg;
|
||||
#ifdef HAVE_BLUEZ4
|
||||
const char *access_type = "rw";
|
||||
|
||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||
|
@ -113,7 +121,10 @@ gst_avdtp_connection_transport_release (GstAvdtpConnection * conn)
|
|||
|
||||
dbus_message_append_args (msg, DBUS_TYPE_STRING, &access_type,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
#else
|
||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||
"org.bluez.MediaTransport1", "Release");
|
||||
#endif
|
||||
dbus_connection_send (conn->data.conn, msg, NULL);
|
||||
|
||||
dbus_message_unref (msg);
|
||||
|
@ -258,17 +269,28 @@ gst_avdtp_connection_get_properties (GstAvdtpConnection * conn)
|
|||
DBusMessage *msg, *reply;
|
||||
DBusMessageIter arg_i, ele_i;
|
||||
DBusError err;
|
||||
#ifndef HAVE_BLUEZ4
|
||||
const char *interface;
|
||||
#endif
|
||||
|
||||
dbus_error_init (&err);
|
||||
|
||||
#ifdef HAVE_BLUEZ4
|
||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||
"org.bluez.MediaTransport", "GetProperties");
|
||||
|
||||
#else
|
||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||
"org.freedesktop.DBus.Properties", "GetAll");
|
||||
#endif
|
||||
if (!msg) {
|
||||
GST_ERROR ("D-Bus Memory allocation failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef HAVE_BLUEZ4
|
||||
interface = "org.bluez.MediaTransport1";
|
||||
dbus_message_append_args (msg, DBUS_TYPE_STRING, &interface,
|
||||
DBUS_TYPE_INVALID);
|
||||
#endif
|
||||
reply = dbus_connection_send_with_reply_and_block (conn->data.conn,
|
||||
msg, -1, &err);
|
||||
|
||||
|
|
Loading…
Reference in a new issue