15deb0bb6SMatthias Ringwald /* 25deb0bb6SMatthias Ringwald * Copyright (C) 2022 BlueKitchen GmbH 35deb0bb6SMatthias Ringwald * 45deb0bb6SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 55deb0bb6SMatthias Ringwald * modification, are permitted provided that the following conditions 65deb0bb6SMatthias Ringwald * are met: 75deb0bb6SMatthias Ringwald * 85deb0bb6SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 95deb0bb6SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 105deb0bb6SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 115deb0bb6SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 125deb0bb6SMatthias Ringwald * documentation and/or other materials provided with the distribution. 135deb0bb6SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 145deb0bb6SMatthias Ringwald * contributors may be used to endorse or promote products derived 155deb0bb6SMatthias Ringwald * from this software without specific prior written permission. 165deb0bb6SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 175deb0bb6SMatthias Ringwald * personal benefit and not for any commercial purpose or for 185deb0bb6SMatthias Ringwald * monetary gain. 195deb0bb6SMatthias Ringwald * 205deb0bb6SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 215deb0bb6SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 225deb0bb6SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 235deb0bb6SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 245deb0bb6SMatthias Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 255deb0bb6SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 265deb0bb6SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 275deb0bb6SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 285deb0bb6SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 295deb0bb6SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 305deb0bb6SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 315deb0bb6SMatthias Ringwald * SUCH DAMAGE. 325deb0bb6SMatthias Ringwald * 335deb0bb6SMatthias Ringwald * Please inquire about commercial licensing options at 345deb0bb6SMatthias Ringwald * [email protected] 355deb0bb6SMatthias Ringwald * 365deb0bb6SMatthias Ringwald */ 375deb0bb6SMatthias Ringwald 385deb0bb6SMatthias Ringwald /** 395deb0bb6SMatthias Ringwald * @title LE Audio Util 405deb0bb6SMatthias Ringwald * 415deb0bb6SMatthias Ringwald */ 425deb0bb6SMatthias Ringwald 435deb0bb6SMatthias Ringwald #ifndef LE_AUDIO_UTIL_H 445deb0bb6SMatthias Ringwald #define LE_AUDIO_UTIL_H 455deb0bb6SMatthias Ringwald 465deb0bb6SMatthias Ringwald #include <stdint.h> 475deb0bb6SMatthias Ringwald #include "le_audio.h" 48*597c9a4eSMilanka Ringwald #include "btstack_lc3.h" 495deb0bb6SMatthias Ringwald 505deb0bb6SMatthias Ringwald #if defined __cplusplus 515deb0bb6SMatthias Ringwald extern "C" { 525deb0bb6SMatthias Ringwald #endif 535deb0bb6SMatthias Ringwald 5454461c80SMatthias Ringwald uint16_t le_audio_util_virtual_memcpy_helper( 555deb0bb6SMatthias Ringwald const uint8_t * field_data, uint16_t field_len, uint16_t field_offset, 565deb0bb6SMatthias Ringwald uint8_t * buffer, uint16_t buffer_size, uint16_t buffer_offset); 575deb0bb6SMatthias Ringwald 5854461c80SMatthias Ringwald uint16_t le_audio_util_metadata_virtual_memcpy(const le_audio_metadata_t * metadata, uint8_t metadata_length, uint16_t * records_offset, uint8_t * buffer, uint16_t buffer_size, uint16_t buffer_offset); 595deb0bb6SMatthias Ringwald 6054461c80SMatthias Ringwald uint16_t le_audio_util_metadata_parse(uint8_t * buffer, uint8_t buffer_size, le_audio_metadata_t * metadata); 615deb0bb6SMatthias Ringwald 6254461c80SMatthias Ringwald uint16_t le_audio_util_metadata_serialize(le_audio_metadata_t * metadata, uint8_t * event, uint16_t event_size); 635deb0bb6SMatthias Ringwald 64fd6b825bSMatthias Ringwald uint16_t le_audio_util_metadata_serialize_using_mask(le_audio_metadata_t * metadata, uint8_t * tlv_buffer, uint16_t tlv_buffer_size); 65fd6b825bSMatthias Ringwald 66*597c9a4eSMilanka Ringwald btstack_lc3_frame_duration_t le_audio_util_get_btstack_lc3_frame_duration(le_audio_codec_frame_duration_index_t le_audio_codec_frame_duration_index); 67*597c9a4eSMilanka Ringwald 68*597c9a4eSMilanka Ringwald uint16_t le_audio_get_frame_duration_us(le_audio_codec_frame_duration_index_t le_audio_codec_frame_duration_index); 69*597c9a4eSMilanka Ringwald 705deb0bb6SMatthias Ringwald #if defined __cplusplus 715deb0bb6SMatthias Ringwald } 725deb0bb6SMatthias Ringwald #endif 735deb0bb6SMatthias Ringwald 745deb0bb6SMatthias Ringwald #endif 755deb0bb6SMatthias Ringwald 76