avdtp_source: add avdtp_get_source_stream_endpoint_for_media_codec_other

This commit is contained in:
Matthias Ringwald 2021-02-23 18:38:48 +01:00
parent e73f3fda19
commit 84cef9b82a
2 changed files with 18 additions and 0 deletions

View File

@ -147,12 +147,29 @@ avdtp_stream_endpoint_t * avdtp_get_source_stream_endpoint_for_media_codec(avdtp
while (btstack_linked_list_iterator_has_next(&it)){
avdtp_stream_endpoint_t * stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it);
if (stream_endpoint->sep.type != AVDTP_SOURCE) continue;
if (stream_endpoint->sep.media_type != AVDTP_AUDIO) continue;
if (stream_endpoint->sep.capabilities.media_codec.media_codec_type != codec_type) continue;
return stream_endpoint;
}
return NULL;
}
avdtp_stream_endpoint_t * avdtp_get_source_stream_endpoint_for_media_codec_other(uint32_t vendor_id, uint16_t codec_id){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, avdtp_get_stream_endpoints());
while (btstack_linked_list_iterator_has_next(&it)){
avdtp_stream_endpoint_t * stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it);
if (stream_endpoint->sep.type != AVDTP_SOURCE) continue;
if (stream_endpoint->sep.media_type != AVDTP_AUDIO) continue;
if (stream_endpoint->sep.capabilities.media_codec.media_codec_type != AVDTP_CODEC_NON_A2DP) continue;
if (stream_endpoint->sep.capabilities.media_codec.media_codec_information_len < 6) continue;
if (little_endian_read_32(stream_endpoint->sep.capabilities.media_codec.media_codec_information, 0) != vendor_id) continue;
if (little_endian_read_32(stream_endpoint->sep.capabilities.media_codec.media_codec_information, 4) != codec_id) continue;
return stream_endpoint;
}
return NULL;
}
avdtp_connection_t * avdtp_get_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid){
btstack_linked_list_iterator_t it;

View File

@ -602,6 +602,7 @@ btstack_linked_list_t * avdtp_get_stream_endpoints(void);
avdtp_stream_endpoint_t * avdtp_get_stream_endpoint_for_seid(uint16_t seid);
avdtp_stream_endpoint_t * avdtp_get_source_stream_endpoint_for_media_codec(avdtp_media_codec_type_t codec_type);
avdtp_stream_endpoint_t * avdtp_get_source_stream_endpoint_for_media_codec_other(uint32_t vendor_id, uint16_t codec_id);
btstack_packet_handler_t avdtp_packet_handler_for_stream_endpoint(const avdtp_stream_endpoint_t *stream_endpoint);
void avdtp_emit_sink_and_source(uint8_t * packet, uint16_t size);