Diff between a17e2e7087f0a41e4edb618a1897032621e1d88e and cc0af04343e08cf5dace8d09f80735aa6fc1ab3b

Changed Files

File Additions Deletions Status
profiles/audio/transport.c +20 -0 modified
profiles/audio/transport.h +2 -0 modified

Full Patch

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 0d993a4..7e44f20 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -878,3 +878,23 @@ void media_transport_update_volume(struct media_transport *transport,
 					transport->path,
 					MEDIA_TRANSPORT_INTERFACE, "Volume");
 }
+
+uint8_t media_transport_get_device_volume(struct audio_device *dev)
+{
+	GSList *l;
+
+	if (dev == NULL)
+		return 128;
+
+	for (l = transports; l; l = l->next) {
+		struct media_transport *transport = l->data;
+		if (transport->device != dev)
+			continue;
+
+		/* Volume is A2DP only */
+		if (media_endpoint_get_sep(transport->endpoint))
+			return media_transport_get_volume(transport);
+	}
+
+	return 128;
+}
diff --git a/profiles/audio/transport.h b/profiles/audio/transport.h
index 0fe8973..78c6fa7 100644
--- a/profiles/audio/transport.h
+++ b/profiles/audio/transport.h
@@ -39,3 +39,5 @@ void media_transport_update_volume(struct media_transport *transport,
 								uint8_t volume);
 void transport_get_properties(struct media_transport *transport,
 							DBusMessageIter *iter);
+
+uint8_t media_transport_get_device_volume(struct audio_device *dev);