diff mbox series

[BlueZ,v5,2/6] shared/bap: Add function to check the validity of a BIS

Message ID 20240516130400.16713-3-andrei.istodorescu@nxp.com (mailing list archive)
State Accepted
Commit db8c96059c02fefd232d49dcbeb16d6b22481100
Headers show
Series Create transports for matching BISes | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Andrei Istodorescu May 16, 2024, 1:03 p.m. UTC
Add utilitary function to check if the information from a BIS is matching
the capabilities in bt_bap. This utilitary is used when parsing the BASE
data so that we can decide if we create a new setup/stream/transport for
it, or advance to the next BIS.
---
 src/shared/bap.c | 21 +++++++++++++++++++++
 src/shared/bap.h |  7 +++++++
 2 files changed, 28 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 919ecbb6a016..c927ddc21572 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -6521,3 +6521,24 @@  void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index,
 cleanup:
 	util_iov_free(merge_data.result, 1);
 }
+
+void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index,
+		struct bt_bap_codec *codec,
+		struct iovec *l2_caps,
+		struct iovec *l3_caps,
+		struct bt_bap_pac **lpac,
+		struct iovec **caps)
+{
+	struct bt_ltv_extract merge_data = {0};
+
+	merge_data.src = l3_caps;
+	merge_data.result = new0(struct iovec, 1);
+
+	/* Create a Codec Specific Configuration with LTVs at level 2 (subgroup)
+	 * overwritten by LTVs at level 3 (BIS)
+	 */
+	util_ltv_foreach(l2_caps->iov_base,
+			l2_caps->iov_len,
+			NULL,
+			bap_sink_check_level2_ltv, &merge_data);
+}
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 62e2104850c7..c9cc4c3a4db7 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -257,3 +257,10 @@  void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index,
 		struct iovec *l3_caps,
 		struct iovec *meta);
 
+void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index,
+		struct bt_bap_codec *codec,
+		struct iovec *l2_caps,
+		struct iovec *l3_caps,
+		struct bt_bap_pac **lpac,
+		struct iovec **caps);
+