1 /* 2 * Copyright (C) 2016 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24 * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 /** 39 * Audio/Video Distribution Transport Protocol (A2DP) 40 * 41 * Code shared by A2DP Sink and A2DP Sourece, mainly automatic stream endpoitn configuration 42 */ 43 44 #ifndef A2DP_H 45 #define A2DP_H 46 47 #include <stdint.h> 48 #include "btstack_defines.h" 49 #include "classic/avdtp.h" 50 51 #if defined __cplusplus 52 extern "C" { 53 #endif 54 55 // common 56 void a2dp_init(void); 57 58 void a2dp_deinit(void); 59 60 void a2dp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t service_class_uuid, 61 uint16_t supported_features, const char * service_name, const char * service_provider_name); 62 63 uint8_t a2dp_subevent_id_for_avdtp_subevent_id(uint8_t subevent); 64 65 // source 66 void a2dp_register_source_packet_handler(btstack_packet_handler_t callback); 67 68 void a2dp_replace_subevent_id_and_emit_source(uint8_t * packet, uint16_t size, uint8_t subevent_id); 69 70 // sink 71 void a2dp_register_sink_packet_handler(btstack_packet_handler_t callback); 72 73 void a2dp_replace_subevent_id_and_emit_sink(uint8_t *packet, uint16_t size, uint8_t subevent_id); 74 75 // config process 76 void a2dp_config_process_ready_for_sep_discovery(avdtp_role_t role, avdtp_connection_t *connection); 77 78 void a2dp_config_process_avdtp_event_handler(avdtp_role_t role, uint8_t *packet, uint16_t size); 79 80 uint8_t a2dp_config_process_config_init(avdtp_role_t role, avdtp_connection_t *connection, uint8_t local_seid, uint8_t remote_seid, 81 avdtp_media_codec_type_t codec_type); 82 void a2dp_config_process_set_config(avdtp_role_t role, avdtp_connection_t *connection); 83 84 uint8_t a2dp_config_process_set_sbc(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 85 const avdtp_configuration_sbc_t * configuration); 86 uint8_t a2dp_config_process_set_mpeg_audio(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 87 const avdtp_configuration_mpeg_audio_t * configuration); 88 uint8_t a2dp_config_process_set_mpeg_aac(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 89 const avdtp_configuration_mpeg_aac_t * configuration); 90 uint8_t a2dp_config_process_set_atrac(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 91 const avdtp_configuration_atrac_t * configuration); 92 uint8_t a2dp_config_process_set_other(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 93 const uint8_t * media_codec_information, uint8_t media_codec_information_len); 94 95 #if defined __cplusplus 96 } 97 #endif 98 99 #endif // A2DP_H 100