mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +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,12 +1655,21 @@ esac
|
||||||
dnl *** bluez ***
|
dnl *** bluez ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_BLUEZ, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_BLUEZ, true)
|
||||||
AG_GST_CHECK_FEATURE(BLUEZ, [Bluez], bluez, [
|
AG_GST_CHECK_FEATURE(BLUEZ, [Bluez], bluez, [
|
||||||
PKG_CHECK_MODULES([BLUEZ], [bluez < 5.0], [
|
PKG_CHECK_MODULES([BLUEZ4], [bluez < 5.0], [
|
||||||
dnl FIXME: we should be able to replace this with the GLib DBus stuff
|
HAVE_BLUEZ=yes
|
||||||
PKG_CHECK_MODULES([DBUS], [dbus-1], [HAVE_BLUEZ=yes], [HAVE_BLUEZ=no])
|
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
|
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])
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl *** OS X videosrc ***
|
dnl *** OS X videosrc ***
|
||||||
|
|
|
@ -49,7 +49,9 @@ gst_avdtp_connection_acquire (GstAvdtpConnection * conn)
|
||||||
{
|
{
|
||||||
DBusMessage *msg, *reply;
|
DBusMessage *msg, *reply;
|
||||||
DBusError err;
|
DBusError err;
|
||||||
|
#ifdef HAVE_BLUEZ4
|
||||||
const char *access_type = "rw";
|
const char *access_type = "rw";
|
||||||
|
#endif
|
||||||
int fd;
|
int fd;
|
||||||
uint16_t imtu, omtu;
|
uint16_t imtu, omtu;
|
||||||
|
|
||||||
|
@ -63,11 +65,16 @@ gst_avdtp_connection_acquire (GstAvdtpConnection * conn)
|
||||||
if (conn->data.conn == NULL)
|
if (conn->data.conn == NULL)
|
||||||
conn->data.conn = dbus_bus_get (DBUS_BUS_SYSTEM, &err);
|
conn->data.conn = dbus_bus_get (DBUS_BUS_SYSTEM, &err);
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUEZ4
|
||||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||||
"org.bluez.MediaTransport", "Acquire");
|
"org.bluez.MediaTransport", "Acquire");
|
||||||
|
|
||||||
dbus_message_append_args (msg, DBUS_TYPE_STRING, &access_type,
|
dbus_message_append_args (msg, DBUS_TYPE_STRING, &access_type,
|
||||||
DBUS_TYPE_INVALID);
|
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,
|
reply = dbus_connection_send_with_reply_and_block (conn->data.conn,
|
||||||
msg, -1, &err);
|
msg, -1, &err);
|
||||||
|
@ -106,6 +113,7 @@ static void
|
||||||
gst_avdtp_connection_transport_release (GstAvdtpConnection * conn)
|
gst_avdtp_connection_transport_release (GstAvdtpConnection * conn)
|
||||||
{
|
{
|
||||||
DBusMessage *msg;
|
DBusMessage *msg;
|
||||||
|
#ifdef HAVE_BLUEZ4
|
||||||
const char *access_type = "rw";
|
const char *access_type = "rw";
|
||||||
|
|
||||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
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_message_append_args (msg, DBUS_TYPE_STRING, &access_type,
|
||||||
DBUS_TYPE_INVALID);
|
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_connection_send (conn->data.conn, msg, NULL);
|
||||||
|
|
||||||
dbus_message_unref (msg);
|
dbus_message_unref (msg);
|
||||||
|
@ -258,17 +269,28 @@ gst_avdtp_connection_get_properties (GstAvdtpConnection * conn)
|
||||||
DBusMessage *msg, *reply;
|
DBusMessage *msg, *reply;
|
||||||
DBusMessageIter arg_i, ele_i;
|
DBusMessageIter arg_i, ele_i;
|
||||||
DBusError err;
|
DBusError err;
|
||||||
|
#ifndef HAVE_BLUEZ4
|
||||||
|
const char *interface;
|
||||||
|
#endif
|
||||||
|
|
||||||
dbus_error_init (&err);
|
dbus_error_init (&err);
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUEZ4
|
||||||
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||||
"org.bluez.MediaTransport", "GetProperties");
|
"org.bluez.MediaTransport", "GetProperties");
|
||||||
|
#else
|
||||||
|
msg = dbus_message_new_method_call ("org.bluez", conn->transport,
|
||||||
|
"org.freedesktop.DBus.Properties", "GetAll");
|
||||||
|
#endif
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
GST_ERROR ("D-Bus Memory allocation failed");
|
GST_ERROR ("D-Bus Memory allocation failed");
|
||||||
return FALSE;
|
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,
|
reply = dbus_connection_send_with_reply_and_block (conn->data.conn,
|
||||||
msg, -1, &err);
|
msg, -1, &err);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue