1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef STREAM_LC3_H 8 #define STREAM_LC3_H 9 10 #include <stdint.h> 11 12 #include <zephyr/bluetooth/audio/audio.h> 13 #include <zephyr/net_buf.h> 14 #include <zephyr/sys_clock.h> 15 16 /* Since the lc3.h header file is not available when CONFIG_LIBLC3=n, we need to guard the include 17 * and use of it 18 */ 19 #if defined(CONFIG_LIBLC3) 20 /* Header file for the liblc3 */ 21 #include <lc3.h> 22 23 struct stream_lc3_tx { 24 uint32_t freq_hz; 25 uint32_t frame_duration_us; 26 uint16_t octets_per_frame; 27 uint8_t frame_blocks_per_sdu; 28 uint8_t chan_cnt; 29 enum bt_audio_location chan_allocation; 30 lc3_encoder_t encoder; 31 lc3_encoder_mem_48k_t encoder_mem; 32 }; 33 #endif /* CONFIG_LIBLC3 */ 34 35 /* Opaque definition to avoid including stream_tx.h */ 36 struct tx_stream; 37 38 /* 39 * @brief Initialize LC3 encoder for a stream 40 * 41 * This will initialize the encoder for the provided TX stream 42 */ 43 int stream_lc3_init(struct tx_stream *stream); 44 45 /** 46 * Add LC3 encoded data to the provided buffer from the provided stream 47 * 48 * @param stream The TX stream to add data from 49 * @param buf The buffer to store the encoded audio data in 50 */ 51 void stream_lc3_add_data(struct tx_stream *stream, struct net_buf *buf); 52 53 #endif /* STREAM_LC3_H */ 54