Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
audio.h File Reference

Bluetooth Audio handling. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <zephyr/autoconf.h>
#include <zephyr/bluetooth/audio/lc3.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/buf.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/iso.h>
#include <zephyr/sys/atomic.h>
#include <zephyr/sys/util.h>
#include <zephyr/sys/util_macro.h>

Go to the source code of this file.

Data Structures

struct  bt_audio_codec_octets_per_codec_frame
 struct to hold minimum and maximum supported codec frame sizes More...
 
struct  bt_audio_codec_cap
 Codec capability structure. More...
 
struct  bt_audio_codec_cfg
 Codec specific configuration structure. More...
 

Macros

#define BT_AUDIO_BROADCAST_ID_SIZE   3
 Size of the broadcast ID in octets.
 
#define BT_AUDIO_BROADCAST_ID_MAX   0xFFFFFFU
 Maximum broadcast ID value.
 
#define BT_AUDIO_PD_PREF_NONE   0x000000U
 Indicates that the server have no preference for the presentation delay.
 
#define BT_AUDIO_PD_MAX   0xFFFFFFU
 Maximum presentation delay in microseconds.
 
#define BT_AUDIO_RTN_PREF_NONE   0xFFU
 Indicates that the unicast server does not have a preference for any retransmission number.
 
#define BT_AUDIO_BROADCAST_NAME_LEN_MIN   4
 The minimum size of a Broadcast Name as defined by Bluetooth Assigned Numbers.
 
#define BT_AUDIO_BROADCAST_NAME_LEN_MAX   128
 The maximum size of a Broadcast Name as defined by Bluetooth Assigned Numbers.
 
#define BT_AUDIO_LANG_SIZE   3
 Size of the stream language value, e.g.
 
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MIN   1
 Minimum supported channel counts.
 
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_MAX   8
 Maximum supported channel counts.
 
#define BT_AUDIO_CODEC_CAP_CHAN_COUNT_SUPPORT(...)    ((enum bt_audio_codec_cap_chan_count)((FOR_EACH(BIT, (|), __VA_ARGS__)) >> 1))
 Channel count support capability.
 
#define BT_AUDIO_CONTEXT_TYPE_ANY
 Any known context.
 
#define BT_AUDIO_METADATA_TYPE_IS_KNOWN(_type)
 Helper to check whether metadata type is known by the stack.
 
#define BT_AUDIO_CODEC_DATA(_type, _bytes...)    (sizeof((uint8_t)_type) + sizeof((uint8_t[]){_bytes})), (_type), _bytes
 Helper to declare elements of bt_audio_codec_cap arrays.
 
#define BT_AUDIO_CODEC_CFG(_id, _cid, _vid, _data, _meta)
 Helper to declare Codec config parsing APIs.
 
#define BT_AUDIO_CODEC_CAP(_id, _cid, _vid, _data, _meta)
 Helper to declare Codec capability parsing APIs structure.
 
#define BT_AUDIO_LOCATION_ANY
 Any known location.
 
Unicast Announcement Type
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL   0x00
 Unicast Server is connectable and is requesting a connection.
 
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED   0x01
 Unicast Server is connectable but is not requesting a connection.
 

Enumerations

enum  bt_audio_codec_cap_type {
  BT_AUDIO_CODEC_CAP_TYPE_FREQ = 0x01 , BT_AUDIO_CODEC_CAP_TYPE_DURATION = 0x02 , BT_AUDIO_CODEC_CAP_TYPE_CHAN_COUNT = 0x03 , BT_AUDIO_CODEC_CAP_TYPE_FRAME_LEN = 0x04 ,
  BT_AUDIO_CODEC_CAP_TYPE_FRAME_COUNT = 0x05
}
 Codec capability types. More...
 
enum  bt_audio_codec_cap_freq {
  BT_AUDIO_CODEC_CAP_FREQ_8KHZ = BIT(0) , BT_AUDIO_CODEC_CAP_FREQ_11KHZ = BIT(1) , BT_AUDIO_CODEC_CAP_FREQ_16KHZ = BIT(2) , BT_AUDIO_CODEC_CAP_FREQ_22KHZ = BIT(3) ,
  BT_AUDIO_CODEC_CAP_FREQ_24KHZ = BIT(4) , BT_AUDIO_CODEC_CAP_FREQ_32KHZ = BIT(5) , BT_AUDIO_CODEC_CAP_FREQ_44KHZ = BIT(6) , BT_AUDIO_CODEC_CAP_FREQ_48KHZ = BIT(7) ,
  BT_AUDIO_CODEC_CAP_FREQ_88KHZ = BIT(8) , BT_AUDIO_CODEC_CAP_FREQ_96KHZ = BIT(9) , BT_AUDIO_CODEC_CAP_FREQ_176KHZ = BIT(10) , BT_AUDIO_CODEC_CAP_FREQ_192KHZ = BIT(11) ,
  BT_AUDIO_CODEC_CAP_FREQ_384KHZ = BIT(12) , BT_AUDIO_CODEC_CAP_FREQ_ANY
}
 Supported frequencies bitfield. More...
 
enum  bt_audio_codec_cap_frame_dur {
  BT_AUDIO_CODEC_CAP_DURATION_7_5 = BIT(0) , BT_AUDIO_CODEC_CAP_DURATION_10 = BIT(1) , BT_AUDIO_CODEC_CAP_DURATION_ANY , BT_AUDIO_CODEC_CAP_DURATION_PREFER_7_5 = BIT(4) ,
  BT_AUDIO_CODEC_CAP_DURATION_PREFER_10 = BIT(5)
}
 Supported frame durations bitfield. More...
 
enum  bt_audio_codec_cap_chan_count {
  BT_AUDIO_CODEC_CAP_CHAN_COUNT_1 = BIT(0) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_2 = BIT(1) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_3 = BIT(2) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_4 = BIT(3) ,
  BT_AUDIO_CODEC_CAP_CHAN_COUNT_5 = BIT(4) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_6 = BIT(5) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_7 = BIT(6) , BT_AUDIO_CODEC_CAP_CHAN_COUNT_8 = BIT(7) ,
  BT_AUDIO_CODEC_CAP_CHAN_COUNT_ANY
}
 Supported audio capabilities channel count bitfield. More...
 
enum  bt_audio_codec_cfg_type {
  BT_AUDIO_CODEC_CFG_FREQ = 0x01 , BT_AUDIO_CODEC_CFG_DURATION = 0x02 , BT_AUDIO_CODEC_CFG_CHAN_ALLOC = 0x03 , BT_AUDIO_CODEC_CFG_FRAME_LEN = 0x04 ,
  BT_AUDIO_CODEC_CFG_FRAME_BLKS_PER_SDU = 0x05
}
 Codec configuration types. More...
 
enum  bt_audio_codec_cfg_freq {
  BT_AUDIO_CODEC_CFG_FREQ_8KHZ = 0x01 , BT_AUDIO_CODEC_CFG_FREQ_11KHZ = 0x02 , BT_AUDIO_CODEC_CFG_FREQ_16KHZ = 0x03 , BT_AUDIO_CODEC_CFG_FREQ_22KHZ = 0x04 ,
  BT_AUDIO_CODEC_CFG_FREQ_24KHZ = 0x05 , BT_AUDIO_CODEC_CFG_FREQ_32KHZ = 0x06 , BT_AUDIO_CODEC_CFG_FREQ_44KHZ = 0x07 , BT_AUDIO_CODEC_CFG_FREQ_48KHZ = 0x08 ,
  BT_AUDIO_CODEC_CFG_FREQ_88KHZ = 0x09 , BT_AUDIO_CODEC_CFG_FREQ_96KHZ = 0x0a , BT_AUDIO_CODEC_CFG_FREQ_176KHZ = 0x0b , BT_AUDIO_CODEC_CFG_FREQ_192KHZ = 0x0c ,
  BT_AUDIO_CODEC_CFG_FREQ_384KHZ = 0x0d
}
 Codec configuration sampling freqency. More...
 
enum  bt_audio_codec_cfg_frame_dur { BT_AUDIO_CODEC_CFG_DURATION_7_5 = 0x00 , BT_AUDIO_CODEC_CFG_DURATION_10 = 0x01 }
 Codec configuration frame duration. More...
 
enum  bt_audio_context {
  BT_AUDIO_CONTEXT_TYPE_PROHIBITED = 0 , BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED = BIT(0) , BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL = BIT(1) , BT_AUDIO_CONTEXT_TYPE_MEDIA = BIT(2) ,
  BT_AUDIO_CONTEXT_TYPE_GAME = BIT(3) , BT_AUDIO_CONTEXT_TYPE_INSTRUCTIONAL = BIT(4) , BT_AUDIO_CONTEXT_TYPE_VOICE_ASSISTANTS = BIT(5) , BT_AUDIO_CONTEXT_TYPE_LIVE = BIT(6) ,
  BT_AUDIO_CONTEXT_TYPE_SOUND_EFFECTS = BIT(7) , BT_AUDIO_CONTEXT_TYPE_NOTIFICATIONS = BIT(8) , BT_AUDIO_CONTEXT_TYPE_RINGTONE = BIT(9) , BT_AUDIO_CONTEXT_TYPE_ALERTS = BIT(10) ,
  BT_AUDIO_CONTEXT_TYPE_EMERGENCY_ALARM = BIT(11)
}
 Audio Context Type for Generic Audio. More...
 
enum  bt_audio_parental_rating {
  BT_AUDIO_PARENTAL_RATING_NO_RATING = 0x00 , BT_AUDIO_PARENTAL_RATING_AGE_ANY = 0x01 , BT_AUDIO_PARENTAL_RATING_AGE_5_OR_ABOVE = 0x02 , BT_AUDIO_PARENTAL_RATING_AGE_6_OR_ABOVE = 0x03 ,
  BT_AUDIO_PARENTAL_RATING_AGE_7_OR_ABOVE = 0x04 , BT_AUDIO_PARENTAL_RATING_AGE_8_OR_ABOVE = 0x05 , BT_AUDIO_PARENTAL_RATING_AGE_9_OR_ABOVE = 0x06 , BT_AUDIO_PARENTAL_RATING_AGE_10_OR_ABOVE = 0x07 ,
  BT_AUDIO_PARENTAL_RATING_AGE_11_OR_ABOVE = 0x08 , BT_AUDIO_PARENTAL_RATING_AGE_12_OR_ABOVE = 0x09 , BT_AUDIO_PARENTAL_RATING_AGE_13_OR_ABOVE = 0x0A , BT_AUDIO_PARENTAL_RATING_AGE_14_OR_ABOVE = 0x0B ,
  BT_AUDIO_PARENTAL_RATING_AGE_15_OR_ABOVE = 0x0C , BT_AUDIO_PARENTAL_RATING_AGE_16_OR_ABOVE = 0x0D , BT_AUDIO_PARENTAL_RATING_AGE_17_OR_ABOVE = 0x0E , BT_AUDIO_PARENTAL_RATING_AGE_18_OR_ABOVE = 0x0F
}
 Parental rating defined by the Generic Audio assigned numbers (bluetooth.com). More...
 
enum  bt_audio_active_state { BT_AUDIO_ACTIVE_STATE_DISABLED = 0x00 , BT_AUDIO_ACTIVE_STATE_ENABLED = 0x01 }
 Audio Active State defined by the Generic Audio assigned numbers (bluetooth.com). More...
 
enum  bt_audio_assisted_listening_stream { BT_AUDIO_ASSISTED_LISTENING_STREAM_UNSPECIFIED = 0x00 }
 Assisted Listening Stream defined by the Generic Audio assigned numbers (bluetooth.com). More...
 
enum  bt_audio_metadata_type {
  BT_AUDIO_METADATA_TYPE_PREF_CONTEXT = 0x01 , BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT = 0x02 , BT_AUDIO_METADATA_TYPE_PROGRAM_INFO = 0x03 , BT_AUDIO_METADATA_TYPE_LANG = 0x04 ,
  BT_AUDIO_METADATA_TYPE_CCID_LIST = 0x05 , BT_AUDIO_METADATA_TYPE_PARENTAL_RATING = 0x06 , BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI = 0x07 , BT_AUDIO_METADATA_TYPE_AUDIO_STATE = 0x08 ,
  BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE = 0x09 , BT_AUDIO_METADATA_TYPE_ASSISTED_LISTENING_STREAM = 0x0A , BT_AUDIO_METADATA_TYPE_BROADCAST_NAME = 0x0B , BT_AUDIO_METADATA_TYPE_EXTENDED = 0xFE ,
  BT_AUDIO_METADATA_TYPE_VENDOR = 0xFF
}
 Codec metadata type IDs. More...
 
enum  bt_audio_location {
  BT_AUDIO_LOCATION_MONO_AUDIO = 0 , BT_AUDIO_LOCATION_FRONT_LEFT = BIT(0) , BT_AUDIO_LOCATION_FRONT_RIGHT = BIT(1) , BT_AUDIO_LOCATION_FRONT_CENTER = BIT(2) ,
  BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1 = BIT(3) , BT_AUDIO_LOCATION_BACK_LEFT = BIT(4) , BT_AUDIO_LOCATION_BACK_RIGHT = BIT(5) , BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER = BIT(6) ,
  BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER = BIT(7) , BT_AUDIO_LOCATION_BACK_CENTER = BIT(8) , BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2 = BIT(9) , BT_AUDIO_LOCATION_SIDE_LEFT = BIT(10) ,
  BT_AUDIO_LOCATION_SIDE_RIGHT = BIT(11) , BT_AUDIO_LOCATION_TOP_FRONT_LEFT = BIT(12) , BT_AUDIO_LOCATION_TOP_FRONT_RIGHT = BIT(13) , BT_AUDIO_LOCATION_TOP_FRONT_CENTER = BIT(14) ,
  BT_AUDIO_LOCATION_TOP_CENTER = BIT(15) , BT_AUDIO_LOCATION_TOP_BACK_LEFT = BIT(16) , BT_AUDIO_LOCATION_TOP_BACK_RIGHT = BIT(17) , BT_AUDIO_LOCATION_TOP_SIDE_LEFT = BIT(18) ,
  BT_AUDIO_LOCATION_TOP_SIDE_RIGHT = BIT(19) , BT_AUDIO_LOCATION_TOP_BACK_CENTER = BIT(20) , BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER = BIT(21) , BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT = BIT(22) ,
  BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT = BIT(23) , BT_AUDIO_LOCATION_FRONT_LEFT_WIDE = BIT(24) , BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE = BIT(25) , BT_AUDIO_LOCATION_LEFT_SURROUND = BIT(26) ,
  BT_AUDIO_LOCATION_RIGHT_SURROUND = BIT(27)
}
 Location values for BT Audio. More...
 
enum  bt_audio_dir { BT_AUDIO_DIR_SINK = 0x01 , BT_AUDIO_DIR_SOURCE = 0x02 }
 Audio direction from the perspective of the BAP Unicast Server / BAP Broadcast Sink. More...
 

Functions

int bt_audio_data_parse (const uint8_t ltv[], size_t size, bool(*func)(struct bt_data *data, void *user_data), void *user_data)
 Helper for parsing length-type-value data.
 
int bt_audio_data_get_val (const uint8_t ltv_data[], size_t size, uint8_t type, const uint8_t **data)
 Get the value of a specific data type in an length-type-value data array.
 
uint8_t bt_audio_get_chan_count (enum bt_audio_location chan_allocation)
 Function to get the number of channels from the channel allocation.
 
int bt_audio_codec_cfg_freq_to_freq_hz (enum bt_audio_codec_cfg_freq freq)
 Convert assigned numbers frequency to frequency value.
 
int bt_audio_codec_cfg_freq_hz_to_freq (uint32_t freq_hz)
 Convert frequency value to assigned numbers frequency.
 
int bt_audio_codec_cfg_get_freq (const struct bt_audio_codec_cfg *codec_cfg)
 Extract the frequency from a codec configuration.
 
int bt_audio_codec_cfg_set_freq (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_codec_cfg_freq freq)
 Set the frequency of a codec configuration.
 
int bt_audio_codec_cfg_frame_dur_to_frame_dur_us (enum bt_audio_codec_cfg_frame_dur frame_dur)
 Convert assigned numbers frame duration to duration in microseconds.
 
int bt_audio_codec_cfg_frame_dur_us_to_frame_dur (uint32_t frame_dur_us)
 Convert frame duration in microseconds to assigned numbers frame duration.
 
int bt_audio_codec_cfg_get_frame_dur (const struct bt_audio_codec_cfg *codec_cfg)
 Extract frame duration from BT codec config.
 
int bt_audio_codec_cfg_set_frame_dur (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_codec_cfg_frame_dur frame_dur)
 Set the frame duration of a codec configuration.
 
int bt_audio_codec_cfg_get_chan_allocation (const struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_location *chan_allocation, bool fallback_to_default)
 Extract channel allocation from BT codec config.
 
int bt_audio_codec_cfg_set_chan_allocation (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_location chan_allocation)
 Set the channel allocation of a codec configuration.
 
int bt_audio_codec_cfg_get_octets_per_frame (const struct bt_audio_codec_cfg *codec_cfg)
 Extract frame size in octets from BT codec config.
 
int bt_audio_codec_cfg_set_octets_per_frame (struct bt_audio_codec_cfg *codec_cfg, uint16_t octets_per_frame)
 Set the octets per codec frame of a codec configuration.
 
int bt_audio_codec_cfg_get_frame_blocks_per_sdu (const struct bt_audio_codec_cfg *codec_cfg, bool fallback_to_default)
 Extract number of audio frame blocks in each SDU from BT codec config.
 
int bt_audio_codec_cfg_set_frame_blocks_per_sdu (struct bt_audio_codec_cfg *codec_cfg, uint8_t frame_blocks)
 Set the frame blocks per SDU of a codec configuration.
 
int bt_audio_codec_cfg_get_val (const struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_codec_cfg_type type, const uint8_t **data)
 Lookup a specific codec configuration value.
 
int bt_audio_codec_cfg_set_val (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_codec_cfg_type type, const uint8_t *data, size_t data_len)
 Set or add a specific codec configuration value.
 
int bt_audio_codec_cfg_unset_val (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_codec_cfg_type type)
 Unset a specific codec configuration value.
 
int bt_audio_codec_cfg_meta_get_val (const struct bt_audio_codec_cfg *codec_cfg, uint8_t type, const uint8_t **data)
 Lookup a specific metadata value based on type.
 
int bt_audio_codec_cfg_meta_set_val (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_metadata_type type, const uint8_t *data, size_t data_len)
 Set or add a specific codec configuration metadata value.
 
int bt_audio_codec_cfg_meta_unset_val (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_metadata_type type)
 Unset a specific codec configuration metadata value.
 
int bt_audio_codec_cfg_meta_get_pref_context (const struct bt_audio_codec_cfg *codec_cfg, bool fallback_to_default)
 Extract preferred contexts.
 
int bt_audio_codec_cfg_meta_set_pref_context (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_context ctx)
 Set the preferred context of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_stream_context (const struct bt_audio_codec_cfg *codec_cfg)
 Extract stream contexts.
 
int bt_audio_codec_cfg_meta_set_stream_context (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_context ctx)
 Set the stream context of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_program_info (const struct bt_audio_codec_cfg *codec_cfg, const uint8_t **program_info)
 Extract program info.
 
int bt_audio_codec_cfg_meta_set_program_info (struct bt_audio_codec_cfg *codec_cfg, const uint8_t *program_info, size_t program_info_len)
 Set the program info of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_lang (const struct bt_audio_codec_cfg *codec_cfg, const uint8_t **lang)
 Extract language.
 
int bt_audio_codec_cfg_meta_set_lang (struct bt_audio_codec_cfg *codec_cfg, const uint8_t lang[3])
 Set the language of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_ccid_list (const struct bt_audio_codec_cfg *codec_cfg, const uint8_t **ccid_list)
 Extract CCID list.
 
int bt_audio_codec_cfg_meta_set_ccid_list (struct bt_audio_codec_cfg *codec_cfg, const uint8_t *ccid_list, size_t ccid_list_len)
 Set the CCID list of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_parental_rating (const struct bt_audio_codec_cfg *codec_cfg)
 Extract parental rating.
 
int bt_audio_codec_cfg_meta_set_parental_rating (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_parental_rating parental_rating)
 Set the parental rating of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_program_info_uri (const struct bt_audio_codec_cfg *codec_cfg, const uint8_t **program_info_uri)
 Extract program info URI.
 
int bt_audio_codec_cfg_meta_set_program_info_uri (struct bt_audio_codec_cfg *codec_cfg, const uint8_t *program_info_uri, size_t program_info_uri_len)
 Set the program info URI of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_audio_active_state (const struct bt_audio_codec_cfg *codec_cfg)
 Extract audio active state.
 
int bt_audio_codec_cfg_meta_set_audio_active_state (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_active_state state)
 Set the audio active state of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_bcast_audio_immediate_rend_flag (const struct bt_audio_codec_cfg *codec_cfg)
 Extract broadcast audio immediate rendering flag.
 
int bt_audio_codec_cfg_meta_set_bcast_audio_immediate_rend_flag (struct bt_audio_codec_cfg *codec_cfg)
 Set the broadcast audio immediate rendering flag of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_assisted_listening_stream (const struct bt_audio_codec_cfg *codec_cfg)
 Extract assisted listening stream.
 
int bt_audio_codec_cfg_meta_set_assisted_listening_stream (struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_assisted_listening_stream val)
 Set the assisted listening stream value of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_broadcast_name (const struct bt_audio_codec_cfg *codec_cfg, const uint8_t **broadcast_name)
 Extract broadcast name.
 
int bt_audio_codec_cfg_meta_set_broadcast_name (struct bt_audio_codec_cfg *codec_cfg, const uint8_t *broadcast_name, size_t broadcast_name_len)
 Set the broadcast name of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_extended (const struct bt_audio_codec_cfg *codec_cfg, const uint8_t **extended_meta)
 Extract extended metadata.
 
int bt_audio_codec_cfg_meta_set_extended (struct bt_audio_codec_cfg *codec_cfg, const uint8_t *extended_meta, size_t extended_meta_len)
 Set the extended metadata of a codec configuration metadata.
 
int bt_audio_codec_cfg_meta_get_vendor (const struct bt_audio_codec_cfg *codec_cfg, const uint8_t **vendor_meta)
 Extract vendor specific metadata.
 
int bt_audio_codec_cfg_meta_set_vendor (struct bt_audio_codec_cfg *codec_cfg, const uint8_t *vendor_meta, size_t vendor_meta_len)
 Set the vendor specific metadata of a codec configuration metadata.
 
int bt_audio_codec_cap_get_val (const struct bt_audio_codec_cap *codec_cap, enum bt_audio_codec_cap_type type, const uint8_t **data)
 Lookup a specific value based on type.
 
int bt_audio_codec_cap_set_val (struct bt_audio_codec_cap *codec_cap, enum bt_audio_codec_cap_type type, const uint8_t *data, size_t data_len)
 Set or add a specific codec capability value.
 
int bt_audio_codec_cap_unset_val (struct bt_audio_codec_cap *codec_cap, enum bt_audio_codec_cap_type type)
 Unset a specific codec capability value.
 
int bt_audio_codec_cap_get_freq (const struct bt_audio_codec_cap *codec_cap)
 Extract the frequency from a codec capability.
 
int bt_audio_codec_cap_set_freq (struct bt_audio_codec_cap *codec_cap, enum bt_audio_codec_cap_freq freq)
 Set the supported frequencies of a codec capability.
 
int bt_audio_codec_cap_get_frame_dur (const struct bt_audio_codec_cap *codec_cap)
 Extract the frequency from a codec capability.
 
int bt_audio_codec_cap_set_frame_dur (struct bt_audio_codec_cap *codec_cap, enum bt_audio_codec_cap_frame_dur frame_dur)
 Set the frame duration of a codec capability.
 
int bt_audio_codec_cap_get_supported_audio_chan_counts (const struct bt_audio_codec_cap *codec_cap, bool fallback_to_default)
 Extract the frequency from a codec capability.
 
int bt_audio_codec_cap_set_supported_audio_chan_counts (struct bt_audio_codec_cap *codec_cap, enum bt_audio_codec_cap_chan_count chan_count)
 Set the channel count of a codec capability.
 
int bt_audio_codec_cap_get_octets_per_frame (const struct bt_audio_codec_cap *codec_cap, struct bt_audio_codec_octets_per_codec_frame *codec_frame)
 Extract the supported octets per codec frame from a codec capability.
 
int bt_audio_codec_cap_set_octets_per_frame (struct bt_audio_codec_cap *codec_cap, const struct bt_audio_codec_octets_per_codec_frame *codec_frame)
 Set the octets per codec frame of a codec capability.
 
int bt_audio_codec_cap_get_max_codec_frames_per_sdu (const struct bt_audio_codec_cap *codec_cap, bool fallback_to_default)
 Extract the maximum codec frames per SDU from a codec capability.
 
int bt_audio_codec_cap_set_max_codec_frames_per_sdu (struct bt_audio_codec_cap *codec_cap, uint8_t codec_frames_per_sdu)
 Set the maximum codec frames per SDU of a codec capability.
 
int bt_audio_codec_cap_meta_get_val (const struct bt_audio_codec_cap *codec_cap, uint8_t type, const uint8_t **data)
 Lookup a specific metadata value based on type.
 
int bt_audio_codec_cap_meta_set_val (struct bt_audio_codec_cap *codec_cap, enum bt_audio_metadata_type type, const uint8_t *data, size_t data_len)
 Set or add a specific codec capability metadata value.
 
int bt_audio_codec_cap_meta_unset_val (struct bt_audio_codec_cap *codec_cap, enum bt_audio_metadata_type type)
 Unset a specific codec capability metadata value.
 
int bt_audio_codec_cap_meta_get_pref_context (const struct bt_audio_codec_cap *codec_cap)
 Extract preferred contexts.
 
int bt_audio_codec_cap_meta_set_pref_context (struct bt_audio_codec_cap *codec_cap, enum bt_audio_context ctx)
 Set the preferred context of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_stream_context (const struct bt_audio_codec_cap *codec_cap)
 Extract stream contexts.
 
int bt_audio_codec_cap_meta_set_stream_context (struct bt_audio_codec_cap *codec_cap, enum bt_audio_context ctx)
 Set the stream context of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_program_info (const struct bt_audio_codec_cap *codec_cap, const uint8_t **program_info)
 Extract program info.
 
int bt_audio_codec_cap_meta_set_program_info (struct bt_audio_codec_cap *codec_cap, const uint8_t *program_info, size_t program_info_len)
 Set the program info of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_lang (const struct bt_audio_codec_cap *codec_cap, const uint8_t **lang)
 Extract language.
 
int bt_audio_codec_cap_meta_set_lang (struct bt_audio_codec_cap *codec_cap, const uint8_t lang[3])
 Set the language of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_ccid_list (const struct bt_audio_codec_cap *codec_cap, const uint8_t **ccid_list)
 Extract CCID list.
 
int bt_audio_codec_cap_meta_set_ccid_list (struct bt_audio_codec_cap *codec_cap, const uint8_t *ccid_list, size_t ccid_list_len)
 Set the CCID list of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_parental_rating (const struct bt_audio_codec_cap *codec_cap)
 Extract parental rating.
 
int bt_audio_codec_cap_meta_set_parental_rating (struct bt_audio_codec_cap *codec_cap, enum bt_audio_parental_rating parental_rating)
 Set the parental rating of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_program_info_uri (const struct bt_audio_codec_cap *codec_cap, const uint8_t **program_info_uri)
 Extract program info URI.
 
int bt_audio_codec_cap_meta_set_program_info_uri (struct bt_audio_codec_cap *codec_cap, const uint8_t *program_info_uri, size_t program_info_uri_len)
 Set the program info URI of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_audio_active_state (const struct bt_audio_codec_cap *codec_cap)
 Extract audio active state.
 
int bt_audio_codec_cap_meta_set_audio_active_state (struct bt_audio_codec_cap *codec_cap, enum bt_audio_active_state state)
 Set the audio active state of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_bcast_audio_immediate_rend_flag (const struct bt_audio_codec_cap *codec_cap)
 Extract broadcast audio immediate rendering flag.
 
int bt_audio_codec_cap_meta_set_bcast_audio_immediate_rend_flag (struct bt_audio_codec_cap *codec_cap)
 Set the broadcast audio immediate rendering flag of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_assisted_listening_stream (const struct bt_audio_codec_cap *codec_cap)
 Extract assisted listening stream.
 
int bt_audio_codec_cap_meta_set_assisted_listening_stream (struct bt_audio_codec_cap *codec_cap, enum bt_audio_assisted_listening_stream val)
 Set the assisted listening stream value of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_broadcast_name (const struct bt_audio_codec_cap *codec_cap, const uint8_t **broadcast_name)
 Extract broadcast name.
 
int bt_audio_codec_cap_meta_set_broadcast_name (struct bt_audio_codec_cap *codec_cap, const uint8_t *broadcast_name, size_t broadcast_name_len)
 Set the broadcast name of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_extended (const struct bt_audio_codec_cap *codec_cap, const uint8_t **extended_meta)
 Extract extended metadata.
 
int bt_audio_codec_cap_meta_set_extended (struct bt_audio_codec_cap *codec_cap, const uint8_t *extended_meta, size_t extended_meta_len)
 Set the extended metadata of a codec capability metadata.
 
int bt_audio_codec_cap_meta_get_vendor (const struct bt_audio_codec_cap *codec_cap, const uint8_t **vendor_meta)
 Extract vendor specific metadata.
 
int bt_audio_codec_cap_meta_set_vendor (struct bt_audio_codec_cap *codec_cap, const uint8_t *vendor_meta, size_t vendor_meta_len)
 Set the vendor specific metadata of a codec capability metadata.
 
static char * bt_audio_context_bit_to_str (enum bt_audio_context context)
 Returns a string representation of a specific bt_audio_context bit.
 
static char * bt_audio_parental_rating_to_str (enum bt_audio_parental_rating parental_rating)
 Returns a string representation of a bt_audio_parental_rating value.
 
static char * bt_audio_active_state_to_str (enum bt_audio_active_state state)
 Returns a string representation of a bt_audio_active_state value.
 
static char * bt_audio_codec_cap_freq_bit_to_str (enum bt_audio_codec_cap_freq freq)
 Returns a string representation of a specific bt_audio_codec_cap_freq bit.
 
static char * bt_audio_codec_cap_frame_dur_bit_to_str (enum bt_audio_codec_cap_frame_dur frame_dur)
 Returns a string representation of a specific bt_audio_codec_cap_frame_dur bit.
 
static char * bt_audio_codec_cap_chan_count_bit_to_str (enum bt_audio_codec_cap_chan_count chan_count)
 Returns a string representation of a specific bt_audio_codec_cap_chan_count bit.
 
static char * bt_audio_location_bit_to_str (enum bt_audio_location location)
 Returns a string representation of a specific bt_audio_location bit.
 

Detailed Description

Bluetooth Audio handling.