[RFC 4/7] media: Add Codecs property to MediaTransport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 audio/transport.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/audio/transport.c b/audio/transport.c
index 7bf7309..38e44c2 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -840,7 +840,36 @@ static DBusMessage *set_property(DBusConnection *conn, DBusMessage *msg,
 static void get_properties_a2dp(struct media_transport *transport,
 						DBusMessageIter *dict)
 {
+	struct audio_device *device = transport->device;
+	uint8_t codecs[8];
+	void *pcodecs = codecs;
+	int ncodecs = 0, seid = 1;
+	struct avdtp_remote_sep *sep;
+	struct avdtp_service_capability *cap;
+	struct avdtp_media_codec_capability *ccap;
+
 	dict_append_entry(dict, "Delay", DBUS_TYPE_UINT16, &transport->delay);
+
+	if (transport->session == NULL)
+		transport->session = avdtp_get(&device->src, &device->dst);
+
+	if (transport->session == NULL)
+		return;
+
+	sep = avdtp_get_remote_sep(transport->session, seid);
+	while (sep) {
+		cap = avdtp_get_codec(sep);
+		ccap = (struct avdtp_media_codec_capability *) cap->data;
+
+		codecs[ncodecs++] = ccap->media_codec_type;
+
+		seid++;
+		sep = avdtp_get_remote_sep(transport->session, seid);
+	}
+
+	if (ncodecs > 0)
+		dict_append_array(dict, "Codecs",
+					DBUS_TYPE_BYTE, &pcodecs, ncodecs);
 }
 
 static void get_properties_headset(struct media_transport *transport,
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux