xref: /btstack/src/btstack_audio.c (revision 2fca4dad957cd7b88f4657ed51e89c12615dda72)
123a1bbc3SMatthias Ringwald /*
223a1bbc3SMatthias Ringwald  * Copyright (C) 2017 BlueKitchen GmbH
323a1bbc3SMatthias Ringwald  *
423a1bbc3SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
523a1bbc3SMatthias Ringwald  * modification, are permitted provided that the following conditions
623a1bbc3SMatthias Ringwald  * are met:
723a1bbc3SMatthias Ringwald  *
823a1bbc3SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
923a1bbc3SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
1023a1bbc3SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
1123a1bbc3SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
1223a1bbc3SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
1323a1bbc3SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
1423a1bbc3SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
1523a1bbc3SMatthias Ringwald  *    from this software without specific prior written permission.
1623a1bbc3SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
1723a1bbc3SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
1823a1bbc3SMatthias Ringwald  *    monetary gain.
1923a1bbc3SMatthias Ringwald  *
2023a1bbc3SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
2123a1bbc3SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2223a1bbc3SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*2fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24*2fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2523a1bbc3SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2623a1bbc3SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2723a1bbc3SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2823a1bbc3SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2923a1bbc3SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
3023a1bbc3SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3123a1bbc3SMatthias Ringwald  * SUCH DAMAGE.
3223a1bbc3SMatthias Ringwald  *
3323a1bbc3SMatthias Ringwald  * Please inquire about commercial licensing options at
3423a1bbc3SMatthias Ringwald  * [email protected]
3523a1bbc3SMatthias Ringwald  *
3623a1bbc3SMatthias Ringwald  */
3723a1bbc3SMatthias Ringwald 
38e501bae0SMatthias Ringwald #define BTSTACK_FILE__ "btstack_audio.c"
39bb2a7656SMatthias Ringwald 
4023a1bbc3SMatthias Ringwald #include "btstack_audio.h"
4123a1bbc3SMatthias Ringwald 
4223a1bbc3SMatthias Ringwald /*
4323a1bbc3SMatthias Ringwald  *  btstack_audio.c
4423a1bbc3SMatthias Ringwald  *
4523a1bbc3SMatthias Ringwald  */
4623a1bbc3SMatthias Ringwald 
47e39d945bSDirk Helbig static const btstack_audio_sink_t * btstack_audio_sink_instance;
48e39d945bSDirk Helbig 
49e39d945bSDirk Helbig static const btstack_audio_source_t * btstack_audio_source_instance;
5023a1bbc3SMatthias Ringwald 
5123a1bbc3SMatthias Ringwald /**
52e39d945bSDirk Helbig  * @brief Get BTstack Audio Sink Instance
536b65794dSMilanka Ringwald  * @return btstack_audio_sink implementation
5423a1bbc3SMatthias Ringwald  */
btstack_audio_sink_get_instance(void)55e39d945bSDirk Helbig const btstack_audio_sink_t * btstack_audio_sink_get_instance(void){
56e39d945bSDirk Helbig 	return btstack_audio_sink_instance;
5723a1bbc3SMatthias Ringwald }
5823a1bbc3SMatthias Ringwald 
5923a1bbc3SMatthias Ringwald /**
60e39d945bSDirk Helbig  * @brief Get BTstack Audio Source Instance
616b65794dSMilanka Ringwald  * @return btstack_audio_source implementation
6223a1bbc3SMatthias Ringwald  */
btstack_audio_source_get_instance(void)63e39d945bSDirk Helbig const btstack_audio_source_t * btstack_audio_source_get_instance(void){
64e39d945bSDirk Helbig 	return btstack_audio_source_instance;
6523a1bbc3SMatthias Ringwald }
66e39d945bSDirk Helbig 
67e39d945bSDirk Helbig /**
68e39d945bSDirk Helbig  * @brief Get BTstack Audio Sink Instance
69e39d945bSDirk Helbig  * @param btstack_audio_sink implementation
70e39d945bSDirk Helbig  */
btstack_audio_sink_set_instance(const btstack_audio_sink_t * audio_sink_impl)71e39d945bSDirk Helbig void btstack_audio_sink_set_instance(const btstack_audio_sink_t * audio_sink_impl){
72e39d945bSDirk Helbig 	btstack_audio_sink_instance = audio_sink_impl;
73e39d945bSDirk Helbig }
74e39d945bSDirk Helbig 
75e39d945bSDirk Helbig /**
76e39d945bSDirk Helbig  * @brief Get BTstack Audio Source Instance
77e39d945bSDirk Helbig  * @param btstack_audio_source implementation
78e39d945bSDirk Helbig  */
btstack_audio_source_set_instance(const btstack_audio_source_t * audio_source_impl)79e39d945bSDirk Helbig void btstack_audio_source_set_instance(const btstack_audio_source_t * audio_source_impl){
80e39d945bSDirk Helbig 	btstack_audio_source_instance = audio_source_impl;
81e39d945bSDirk Helbig }
82e39d945bSDirk Helbig 
83