summaryrefslogtreecommitdiffstats
path: root/audio/avdtp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-12-03 22:41:29 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-12-03 22:41:29 +0000
commit2934e194f3ffe754e18477113c870a7b98f88454 (patch)
tree8af6231fad9f933710e04d0f5ca7434ccf236d70 /audio/avdtp.c
parentae100c4c1395e1b306d2e91b5fed85f7b8d6dfbf (diff)
Handle new ipc messages properly and adapt the plugins.
Diffstat (limited to 'audio/avdtp.c')
-rw-r--r--audio/avdtp.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index f68561e9..3acd4128 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -1825,16 +1825,20 @@ static gboolean avdtp_discover_resp(struct avdtp *session,
resp->seps[i].media_type, resp->seps[i].inuse);
/* Skip SEP's which are in use */
+/*
if (resp->seps[i].inuse)
continue;
+*/
sep = find_remote_sep(session->seps, resp->seps[i].seid);
if (!sep) {
sep = g_new0(struct avdtp_remote_sep, 1);
session->seps = g_slist_append(session->seps, sep);
}
+/*
else if (sep && sep->stream)
continue;
+*/
sep->seid = resp->seps[i].seid;
sep->type = resp->seps[i].type;
@@ -2275,6 +2279,21 @@ gboolean avdtp_stream_has_capability(struct avdtp_stream *stream,
return FALSE;
}
+gboolean avdtp_stream_has_capabilities(struct avdtp_stream *stream,
+ GSList *caps)
+{
+ GSList *l;
+
+ for (l = caps; l; l = g_slist_next(l)) {
+ struct avdtp_service_capability *cap = l->data;
+
+ if (!avdtp_stream_has_capability(stream, cap))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
gboolean avdtp_stream_get_transport(struct avdtp_stream *stream, int *sock,
uint16_t *imtu, uint16_t *omtu,
GSList **caps)
@@ -2331,6 +2350,9 @@ struct avdtp_service_capability *avdtp_service_cap_new(uint8_t category,
{
struct avdtp_service_capability *cap;
+ if (category < AVDTP_MEDIA_TRANSPORT || category > AVDTP_MEDIA_CODEC)
+ return NULL;
+
cap = g_malloc(sizeof(struct avdtp_service_capability) + length);
cap->category = category;
cap->length = length;
@@ -2457,6 +2479,18 @@ int avdtp_get_configuration(struct avdtp *session, struct avdtp_stream *stream)
return send_request(session, FALSE, stream, &req, sizeof(req));
}
+static void copy_capabilities(gpointer data, gpointer user_data)
+{
+ struct avdtp_service_capability *src_cap = data;
+ struct avdtp_service_capability *dst_cap;
+ GSList **l = user_data;
+
+ dst_cap = avdtp_service_cap_new(src_cap->category, src_cap->data,
+ src_cap->length);
+
+ *l = g_slist_append(*l, dst_cap);
+}
+
int avdtp_set_configuration(struct avdtp *session,
struct avdtp_remote_sep *rsep,
struct avdtp_local_sep *lsep,
@@ -2484,7 +2518,8 @@ int avdtp_set_configuration(struct avdtp *session,
new_stream->session = session;
new_stream->lsep = lsep;
new_stream->rseid = rsep->seid;
- new_stream->caps = caps;
+
+ g_slist_foreach(caps, copy_capabilities, &new_stream->caps);
/* Calculate total size of request */
for (l = caps, caps_len = 0; l != NULL; l = g_slist_next(l)) {