summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Stoughton <nstoughton@aether.com>2014-12-09 08:38:55 -0800
committerArun Raghavan <git@arunraghavan.net>2014-12-11 09:08:47 +0530
commita344b99c987a393b7ee460cd6c4e7060bbe0f25c (patch)
tree1c63cb6734b220c6667b0f14480b2065a2afb3fa
parentc8fa688d26e2482419b1d785b0d4537d4235f267 (diff)
downloadgstreamer-plugins-bad-a344b99c987a393b7ee460cd6c4e7060bbe0f25c.tar.gz
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
-rw-r--r--configure.ac15
-rw-r--r--sys/bluez/gstavdtputil.c28
2 files changed, 37 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index bda83f826..ff75aea59 100644
--- a/configure.ac
+++ b/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
])
])
diff --git a/sys/bluez/gstavdtputil.c b/sys/bluez/gstavdtputil.c
index caf7275a7..787a06309 100644
--- a/sys/bluez/gstavdtputil.c
+++ b/sys/bluez/gstavdtputil.c
@@ -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);