summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-12-05 11:10:16 +0100
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-12-10 14:44:28 +0200
commitf7b45bd851b6b73ee24e1953f5a8e43cdd13af34 (patch)
treed9c1f93c69d4139fa50711f55928833fc4f239ee /profiles
parentd3f7aff137095a3314c00ed388b8af081df02e52 (diff)
downloadbluez-f7b45bd851b6b73ee24e1953f5a8e43cdd13af34.tar.gz
avdtp: Convert avdtp_get to accept audio_device
Use addresses taken from btd_dev reference in audio_device to get session source and destination.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/avdtp.c7
-rw-r--r--profiles/audio/avdtp.h2
-rw-r--r--profiles/audio/sink.c2
-rw-r--r--profiles/audio/source.c2
-rw-r--r--profiles/audio/transport.c3
5 files changed, 10 insertions, 6 deletions
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 3007053d0..ea5611006 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2361,9 +2361,14 @@ static struct avdtp *avdtp_get_internal(const bdaddr_t *src, const bdaddr_t *dst
return session;
}
-struct avdtp *avdtp_get(bdaddr_t *src, bdaddr_t *dst)
+struct avdtp *avdtp_get(struct audio_device *device)
{
struct avdtp *session;
+ const bdaddr_t *src;
+ const bdaddr_t *dst;
+
+ src = adapter_get_address(device_get_adapter(device->btd_dev));
+ dst = device_get_address(device->btd_dev);
session = avdtp_get_internal(src, dst);
diff --git a/profiles/audio/avdtp.h b/profiles/audio/avdtp.h
index cdf39bfc7..9117e8912 100644
--- a/profiles/audio/avdtp.h
+++ b/profiles/audio/avdtp.h
@@ -213,7 +213,7 @@ struct avdtp_sep_ind {
typedef void (*avdtp_discover_cb_t) (struct avdtp *session, GSList *seps,
struct avdtp_error *err, void *user_data);
-struct avdtp *avdtp_get(bdaddr_t *src, bdaddr_t *dst);
+struct avdtp *avdtp_get(struct audio_device *device);
void avdtp_unref(struct avdtp *session);
struct avdtp *avdtp_ref(struct avdtp *session);
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 4be3bacd9..62ec60104 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -348,7 +348,7 @@ int sink_connect(struct audio_device *dev, audio_device_cb cb, void *data)
struct pending_request *pending;
if (!sink->session)
- sink->session = avdtp_get(&dev->src, &dev->dst);
+ sink->session = avdtp_get(dev);
if (!sink->session) {
DBG("Unable to get a session");
diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index 6713cc496..85aeb4ff6 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -348,7 +348,7 @@ int source_connect(struct audio_device *dev, audio_device_cb cb, void *data)
struct pending_request *pending;
if (!source->session)
- source->session = avdtp_get(&dev->src, &dev->dst);
+ source->session = avdtp_get(dev);
if (!source->session) {
DBG("Unable to get a session");
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index abb22b41f..3935adee4 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -327,11 +327,10 @@ static guint resume_a2dp(struct media_transport *transport,
{
struct a2dp_transport *a2dp = transport->data;
struct media_endpoint *endpoint = transport->endpoint;
- struct audio_device *device = transport->device;
struct a2dp_sep *sep = media_endpoint_get_sep(endpoint);
if (a2dp->session == NULL) {
- a2dp->session = avdtp_get(&device->src, &device->dst);
+ a2dp->session = avdtp_get(transport->device);
if (a2dp->session == NULL)
return 0;
}