public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "João Paulo Rechi Vita" <jprvita@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: "João Paulo Rechi Vita" <jprvita@gmail.com>
Subject: [PATCH 3/6] Create a2dp_sink_get().
Date: Thu,  4 Jun 2009 16:09:53 -0300	[thread overview]
Message-ID: <1244142596-8076-3-git-send-email-jprvita@gmail.com> (raw)
In-Reply-To: <1244142596-8076-2-git-send-email-jprvita@gmail.com>

---
 audio/a2dp.c |   33 +++++++++++++++++++++++++++++++++
 audio/a2dp.h |    2 ++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/audio/a2dp.c b/audio/a2dp.c
index 67e2576..605dfed 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -1601,6 +1601,39 @@ gboolean a2dp_sink_cancel(struct audio_device *dev, unsigned int id)
 	return TRUE;
 }
 
+struct a2dp_sep *a2dp_sink_get(struct avdtp *session,
+				struct avdtp_remote_sep *rsep)
+{
+	GSList *l;
+	struct a2dp_server *server;
+	struct avdtp_service_capability *cap;
+	struct avdtp_media_codec_capability *codec_cap = NULL;
+	bdaddr_t src;
+
+	avdtp_get_peers(session, &src, NULL);
+	server = find_server(servers, &src);
+	if (!server)
+		return NULL;
+
+	cap = avdtp_get_codec(rsep);
+	codec_cap = (void *) cap->data;
+
+	for (l = server->sinks; l != NULL; l = l->next) {
+		struct a2dp_sep *sep = l->data;
+
+		if (sep->locked)
+			continue;
+
+		if (sep->codec != codec_cap->media_codec_type)
+			continue;
+
+		if (!sep->stream || avdtp_has_stream(session, sep->stream))
+			return sep;
+	}
+
+	return NULL;
+}
+
 gboolean a2dp_sep_lock(struct a2dp_sep *sep, struct avdtp *session)
 {
 	if (sep->locked)
diff --git a/audio/a2dp.h b/audio/a2dp.h
index f72480c..f0a61e3 100644
--- a/audio/a2dp.h
+++ b/audio/a2dp.h
@@ -143,6 +143,8 @@ unsigned int a2dp_source_suspend(struct avdtp *session, struct a2dp_sep *sep,
 				a2dp_stream_cb_t cb, void *user_data);
 gboolean a2dp_source_cancel(struct audio_device *dev, unsigned int id);
 
+struct a2dp_sep *a2dp_sink_get(struct avdtp *session,
+				struct avdtp_remote_sep *sep);
 gboolean a2dp_sink_cancel(struct audio_device *dev, unsigned int id);
 
 gboolean a2dp_sep_lock(struct a2dp_sep *sep, struct avdtp *session);
-- 
1.6.0.4


  reply	other threads:[~2009-06-04 19:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 19:09 [PATCH 1/6] Create A2DP Sink SDP record João Paulo Rechi Vita
2009-06-04 19:09 ` [PATCH 2/6] Create a2dp_sink_cancel() João Paulo Rechi Vita
2009-06-04 19:09   ` João Paulo Rechi Vita [this message]
2009-06-04 19:09     ` [PATCH 4/6] Create a2dp_sink_config() João Paulo Rechi Vita
2009-06-04 19:09       ` [PATCH 5/6] Create a2dp_sink_resume() João Paulo Rechi Vita
2009-06-04 19:09         ` [PATCH 6/6] Create a2dp_sink_suspend() João Paulo Rechi Vita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244142596-8076-3-git-send-email-jprvita@gmail.com \
    --to=jprvita@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox