a2dp_source.c (1114e1584c69892f7e89f0cb5f5ea3ae6661dc71) | a2dp_source.c (a95794cee1b77dd0c805e8606c008222803b81c5) |
---|---|
1 2/* 3 * Copyright (C) 2016 BlueKitchen GmbH 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 56 unchanged lines hidden (view full) --- 65 66#define AVDTP_MAX_SEP_NUM 10 67#define A2DP_SET_CONFIG_DELAY_MS 150 68 69static const char * default_a2dp_source_service_name = "BTstack A2DP Source Service"; 70static const char * default_a2dp_source_service_provider_name = "BTstack A2DP Source Service Provider"; 71 72static btstack_packet_handler_t a2dp_source_packet_handler_user; | 1 2/* 3 * Copyright (C) 2016 BlueKitchen GmbH 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 56 unchanged lines hidden (view full) --- 65 66#define AVDTP_MAX_SEP_NUM 10 67#define A2DP_SET_CONFIG_DELAY_MS 150 68 69static const char * default_a2dp_source_service_name = "BTstack A2DP Source Service"; 70static const char * default_a2dp_source_service_provider_name = "BTstack A2DP Source Service Provider"; 71 72static btstack_packet_handler_t a2dp_source_packet_handler_user; |
73static uint8_t (*a2dp_source_media_config_validator)(const avdtp_stream_endpoint_t * stream_endpoint, const uint8_t * event, uint16_t size); |
|
73 74// config process - singletons using sep_discovery_cid is used as mutex 75static uint16_t sep_discovery_cid; 76static uint16_t sep_discovery_count; 77static uint16_t sep_discovery_index; 78static avdtp_sep_t sep_discovery_seps[AVDTP_MAX_SEP_NUM]; 79static btstack_timer_source_t a2dp_source_set_config_timer; 80 --- 971 unchanged lines hidden (view full) --- 1052 return avdtp_source_reconfigure( 1053 avdtp_cid, 1054 avdtp_stream_endpoint_seid(connection->a2dp_source_local_stream_endpoint), 1055 connection->a2dp_source_local_stream_endpoint->remote_sep.seid, 1056 1 << AVDTP_MEDIA_CODEC, 1057 new_configuration 1058 ); 1059} | 74 75// config process - singletons using sep_discovery_cid is used as mutex 76static uint16_t sep_discovery_cid; 77static uint16_t sep_discovery_count; 78static uint16_t sep_discovery_index; 79static avdtp_sep_t sep_discovery_seps[AVDTP_MAX_SEP_NUM]; 80static btstack_timer_source_t a2dp_source_set_config_timer; 81 --- 971 unchanged lines hidden (view full) --- 1053 return avdtp_source_reconfigure( 1054 avdtp_cid, 1055 avdtp_stream_endpoint_seid(connection->a2dp_source_local_stream_endpoint), 1056 connection->a2dp_source_local_stream_endpoint->remote_sep.seid, 1057 1 << AVDTP_MEDIA_CODEC, 1058 new_configuration 1059 ); 1060} |
1061 1062static uint8_t a2dp_source_media_config_validator_callback(const avdtp_stream_endpoint_t * stream_endpoint, const uint8_t * event, uint16_t size){ 1063 uint8_t error = 0; 1064 if (a2dp_source_media_config_validator == NULL) { 1065 // update subevent id and call validator 1066 uint8_t avdtp_subevent_id = event[2]; 1067 uint8_t a2dp_subevent_id = a2dp_subevent_id_for_avdtp_subevent_id(avdtp_subevent_id); 1068 uint8_t * subevent_field = (uint8_t *) &event[2]; 1069 *subevent_field = a2dp_subevent_id; 1070 error = (*a2dp_source_media_config_validator)(stream_endpoint, event, size); 1071 *subevent_field = avdtp_subevent_id; 1072 } 1073 return error; 1074} 1075 1076void a2dp_sink_register_media_config_validator(uint8_t (*callback)(const avdtp_stream_endpoint_t * stream_endpoint, const uint8_t * event, uint16_t size)){ 1077 a2dp_source_media_config_validator = callback; 1078 avdtp_source_register_media_config_validator(&a2dp_source_media_config_validator_callback); 1079} 1080 |
|