mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-23 19:20:51 +00:00
a2dp_source: a2dp_source_create_stream_endpoint returns avdtp_stream_endpoint_t
This commit is contained in:
parent
969f181e02
commit
7078e43451
@ -245,12 +245,12 @@ static int a2dp_source_and_avrcp_services_init(void){
|
||||
a2dp_source_register_packet_handler(&a2dp_source_packet_handler);
|
||||
|
||||
// Create stream endpoint.
|
||||
uint8_t status = a2dp_source_create_stream_endpoint(AVDTP_AUDIO, AVDTP_CODEC_SBC, media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities), media_sbc_codec_configuration, sizeof(media_sbc_codec_configuration), &media_tracker.local_seid);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
avdtp_stream_endpoint_t * local_stream_endpoint = a2dp_source_create_stream_endpoint(AVDTP_AUDIO, AVDTP_CODEC_SBC, media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities), media_sbc_codec_configuration, sizeof(media_sbc_codec_configuration));
|
||||
if (!local_stream_endpoint){
|
||||
printf("A2DP Source: not enough memory to create local stream endpoint\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
media_tracker.local_seid = avdtp_local_seid(local_stream_endpoint);
|
||||
|
||||
// Initialize AVRCP Target.
|
||||
avrcp_target_init();
|
||||
|
@ -444,21 +444,20 @@ void a2dp_source_init(void){
|
||||
avdtp_source_init(&a2dp_source_context);
|
||||
}
|
||||
|
||||
uint8_t a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type,
|
||||
avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type,
|
||||
uint8_t * codec_capabilities, uint16_t codec_capabilities_len,
|
||||
uint8_t * media_codec_info, uint16_t media_codec_info_len, uint8_t * local_seid){
|
||||
*local_seid = 0;
|
||||
uint8_t * media_codec_info, uint16_t media_codec_info_len){
|
||||
avdtp_stream_endpoint_t * local_stream_endpoint = avdtp_source_create_stream_endpoint(AVDTP_SOURCE, media_type);
|
||||
if (!local_stream_endpoint){
|
||||
return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
return NULL;
|
||||
}
|
||||
*local_seid = avdtp_local_seid(local_stream_endpoint);
|
||||
avdtp_source_register_media_transport_category(avdtp_stream_endpoint_seid(local_stream_endpoint));
|
||||
avdtp_source_register_media_codec_category(avdtp_stream_endpoint_seid(local_stream_endpoint), media_type, media_codec_type,
|
||||
codec_capabilities, codec_capabilities_len);
|
||||
local_stream_endpoint->remote_configuration.media_codec.media_codec_information = media_codec_info;
|
||||
local_stream_endpoint->remote_configuration.media_codec.media_codec_information_len = media_codec_info_len;
|
||||
return ERROR_CODE_SUCCESS;
|
||||
sc.local_stream_endpoint = local_stream_endpoint;
|
||||
return local_stream_endpoint;
|
||||
}
|
||||
|
||||
uint8_t a2dp_source_establish_stream(bd_addr_t remote_addr, uint8_t loc_seid, uint16_t * a2dp_cid){
|
||||
|
@ -81,9 +81,9 @@ void a2dp_source_init(void);
|
||||
*
|
||||
* @return status ERROR_CODE_SUCCESS if sucessful.
|
||||
*/
|
||||
uint8_t a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type,
|
||||
uint8_t * codec_capabilities, uint16_t codec_capabilities_len,
|
||||
uint8_t * media_codec_info, uint16_t media_codec_info_len, uint8_t * local_seid);
|
||||
avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type,
|
||||
uint8_t * codec_capabilities, uint16_t codec_capabilities_len,
|
||||
uint8_t * codec_configuration, uint16_t codec_configuration_len);
|
||||
|
||||
/**
|
||||
* @brief Register callback for the A2DP Source client. It will receive following subevents of HCI_EVENT_A2DP_META HCI event type:
|
||||
|
@ -774,9 +774,11 @@ int btstack_main(int argc, const char * argv[]){
|
||||
avdtp_source_init(&a2dp_source_context);
|
||||
avdtp_source_register_packet_handler(&packet_handler);
|
||||
|
||||
a2dp_source_create_stream_endpoint(AVDTP_AUDIO, AVDTP_CODEC_SBC, (uint8_t *) media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities), (uint8_t*) media_sbc_codec_configuration, sizeof(media_sbc_codec_configuration), &media_tracker.local_seid);
|
||||
sc.local_stream_endpoint = a2dp_source_create_stream_endpoint(AVDTP_AUDIO, AVDTP_CODEC_SBC, (uint8_t *) media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities), (uint8_t*) media_sbc_codec_configuration, sizeof(media_sbc_codec_configuration));
|
||||
media_tracker.local_seid = avdtp_local_seid(sc.local_stream_endpoint);
|
||||
media_tracker.remote_seid = 1;
|
||||
|
||||
|
||||
// Initialize SDP
|
||||
sdp_init();
|
||||
memset(sdp_avdtp_source_service_buffer, 0, sizeof(sdp_avdtp_source_service_buffer));
|
||||
|
Loading…
x
Reference in New Issue
Block a user