Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Codec config parsing APIs

Audio codec Config APIs. More...

Functions

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_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.
 

Detailed Description

Audio codec Config APIs.

Functions to parse codec config data when formatted as LTV wrapped into Codec config parsing APIs.

Function Documentation

◆ bt_audio_codec_cfg_frame_dur_to_frame_dur_us()

int bt_audio_codec_cfg_frame_dur_to_frame_dur_us ( enum bt_audio_codec_cfg_frame_dur  frame_dur)

#include <zephyr/bluetooth/audio/audio.h>

Convert assigned numbers frame duration to duration in microseconds.

Parameters
frame_durThe assigned numbers frame duration to convert.
Return values
-EINVALif arguments are invalid.
Theconverted frame duration value in microseconds.

◆ bt_audio_codec_cfg_frame_dur_us_to_frame_dur()

int bt_audio_codec_cfg_frame_dur_us_to_frame_dur ( uint32_t  frame_dur_us)

#include <zephyr/bluetooth/audio/audio.h>

Convert frame duration in microseconds to assigned numbers frame duration.

Parameters
frame_dur_usThe frame duration in microseconds to convert.
Return values
-EINVALif arguments are invalid.
Theassigned numbers frame duration (bt_audio_codec_cfg_frame_dur).

◆ bt_audio_codec_cfg_freq_hz_to_freq()

int bt_audio_codec_cfg_freq_hz_to_freq ( uint32_t  freq_hz)

#include <zephyr/bluetooth/audio/audio.h>

Convert frequency value to assigned numbers frequency.

Parameters
freq_hzThe frequency value to convert.
Return values
-EINVALif arguments are invalid.
Theassigned numbers frequency (bt_audio_codec_cfg_freq).

◆ bt_audio_codec_cfg_freq_to_freq_hz()

int bt_audio_codec_cfg_freq_to_freq_hz ( enum bt_audio_codec_cfg_freq  freq)

#include <zephyr/bluetooth/audio/audio.h>

Convert assigned numbers frequency to frequency value.

Parameters
freqThe assigned numbers frequency to convert.
Return values
-EINVALif arguments are invalid.
Theconverted frequency value in Hz.

◆ bt_audio_codec_cfg_get_chan_allocation()

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 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract channel allocation from BT codec config.

The value returned is a bit field representing one or more audio locations as specified by bt_audio_location Shall match one or more of the bits set in BT_PAC_SNK_LOC/BT_PAC_SRC_LOC.

Up to the configured BT_AUDIO_CODEC_CAP_TYPE_CHAN_COUNT number of channels can be present.

Parameters
codec_cfgThe codec configuration to extract data from.
chan_allocationPointer to the variable to store the extracted value in.
fallback_to_defaultIf true this function will provide the default value of BT_AUDIO_LOCATION_MONO_AUDIO if the type is not found when codec_cfg.id is BT_HCI_CODING_FORMAT_LC3.
Return values
0if value is found and stored in the pointer provided
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size or value

◆ bt_audio_codec_cfg_get_frame_blocks_per_sdu()

int bt_audio_codec_cfg_get_frame_blocks_per_sdu ( const struct bt_audio_codec_cfg codec_cfg,
bool  fallback_to_default 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract number of audio frame blocks in each SDU from BT codec config.

The overall SDU size will be octets_per_frame * frame_blocks_per_sdu * number-of-channels.

If this value is not present a default value of 1 shall be used.

A frame block is one or more frames that represents data for the same period of time but for different channels. If the stream have two audio channels and this value is two there will be four frames in the SDU.

Parameters
codec_cfgThe codec configuration to extract data from.
fallback_to_defaultIf true this function will return the default value of 1 if the type is not found when codec_cfg.id is BT_HCI_CODING_FORMAT_LC3.
Return values
Thecount of codec frame blocks in each SDU.
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size or value

◆ bt_audio_codec_cfg_get_frame_dur()

int bt_audio_codec_cfg_get_frame_dur ( const struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Extract frame duration from BT codec config.

Parameters
codec_cfgThe codec configuration to extract data from.
Return values
Abt_audio_codec_cfg_frame_dur value
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size or value

◆ bt_audio_codec_cfg_get_freq()

int bt_audio_codec_cfg_get_freq ( const struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Extract the frequency from a codec configuration.

Parameters
codec_cfgThe codec configuration to extract data from.
Return values
Abt_audio_codec_cfg_freq value
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size or value

◆ bt_audio_codec_cfg_get_octets_per_frame()

int bt_audio_codec_cfg_get_octets_per_frame ( const struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Extract frame size in octets from BT codec config.

The overall SDU size will be octets_per_frame * blocks_per_sdu.

The Bluetooth specifications are not clear about this value - it does not state that the codec shall use this SDU size only. A codec like LC3 supports variable bit-rate (per SDU) hence it might be allowed for an encoder to reduce the frame size below this value. Hence it is recommended to use the received SDU size and divide by blocks_per_sdu rather than relying on this octets_per_sdu value to be fixed.

Parameters
codec_cfgThe codec configuration to extract data from.
Return values
Framelength in octets
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size or value

◆ bt_audio_codec_cfg_get_val()

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 
)

#include <zephyr/bluetooth/audio/audio.h>

Lookup a specific codec configuration value.

Parameters
[in]codec_cfgThe codec data to search in.
[in]typeThe type id to look for
[out]dataPointer to the data-pointer to update when item is found
Return values
Lengthof found data (may be 0)
-EINVALif arguments are invalid
-ENODATAif not found

◆ bt_audio_codec_cfg_meta_get_audio_active_state()

int bt_audio_codec_cfg_meta_get_audio_active_state ( const struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Extract audio active state.

See BT_AUDIO_METADATA_TYPE_AUDIO_STATE for more information about this value.

Parameters
codec_cfgThe codec data to search in.
Return values
Thepreferred context type if positive or 0
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size

◆ bt_audio_codec_cfg_meta_get_bcast_audio_immediate_rend_flag()

int bt_audio_codec_cfg_meta_get_bcast_audio_immediate_rend_flag ( const struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Extract broadcast audio immediate rendering flag.

See BT_AUDIO_METADATA_TYPE_BROADCAST_IMMEDIATE for more information about this value.

Parameters
codec_cfgThe codec data to search in.
Return values
0if the flag was found
-EINVALif arguments are invalid
-ENODATAif not the flag was not found

◆ bt_audio_codec_cfg_meta_get_ccid_list()

int bt_audio_codec_cfg_meta_get_ccid_list ( const struct bt_audio_codec_cfg codec_cfg,
const uint8_t **  ccid_list 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract CCID list.

See BT_AUDIO_METADATA_TYPE_CCID_LIST for more information about this value.

Parameters
[in]codec_cfgThe codec data to search in.
[out]ccid_listPointer to the array containing 8-bit CCIDs.
Return values
Thelength of the ccid_list (may be 0)
-EINVALif arguments are invalid
-ENODATAif not found

◆ bt_audio_codec_cfg_meta_get_extended()

int bt_audio_codec_cfg_meta_get_extended ( const struct bt_audio_codec_cfg codec_cfg,
const uint8_t **  extended_meta 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract extended metadata.

See BT_AUDIO_METADATA_TYPE_EXTENDED for more information about this value.

Parameters
[in]codec_cfgThe codec data to search in.
[out]extended_metaPointer to the extended metadata.
Return values
Thelength of the ccid_list (may be 0)
-EINVALif arguments are invalid
-ENODATAif not found

◆ bt_audio_codec_cfg_meta_get_lang()

int bt_audio_codec_cfg_meta_get_lang ( const struct bt_audio_codec_cfg codec_cfg,
const uint8_t **  lang 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract language.

See BT_AUDIO_METADATA_TYPE_LANG for more information about this value.

Parameters
[in]codec_cfgThe codec data to search in.
[out]langPointer to the language bytes (of length BT_AUDIO_LANG_SIZE)
Return values
Thelanguage if positive or 0
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size

◆ bt_audio_codec_cfg_meta_get_parental_rating()

int bt_audio_codec_cfg_meta_get_parental_rating ( const struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Extract parental rating.

See BT_AUDIO_METADATA_TYPE_PARENTAL_RATING for more information about this value.

Parameters
codec_cfgThe codec data to search in.
Return values
Theparental rating if positive or 0
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size

◆ bt_audio_codec_cfg_meta_get_pref_context()

int bt_audio_codec_cfg_meta_get_pref_context ( const struct bt_audio_codec_cfg codec_cfg,
bool  fallback_to_default 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract preferred contexts.

See BT_AUDIO_METADATA_TYPE_PREF_CONTEXT for more information about this value.

Parameters
codec_cfgThe codec data to search in.
fallback_to_defaultIf true this function will provide the default value of BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED if the type is not found when codec_cfg.id is BT_HCI_CODING_FORMAT_LC3.
Return values
Thepreferred context type if positive or 0
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size

◆ bt_audio_codec_cfg_meta_get_program_info()

int bt_audio_codec_cfg_meta_get_program_info ( const struct bt_audio_codec_cfg codec_cfg,
const uint8_t **  program_info 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract program info.

See BT_AUDIO_METADATA_TYPE_PROGRAM_INFO for more information about this value.

Parameters
[in]codec_cfgThe codec data to search in.
[out]program_infoPointer to the UTF-8 formatted program info.
Return values
Thelength of the program_info (may be 0)
-EINVALif arguments are invalid
-ENODATAif not found

◆ bt_audio_codec_cfg_meta_get_program_info_uri()

int bt_audio_codec_cfg_meta_get_program_info_uri ( const struct bt_audio_codec_cfg codec_cfg,
const uint8_t **  program_info_uri 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract program info URI.

See BT_AUDIO_METADATA_TYPE_PROGRAM_INFO_URI for more information about this value.

Parameters
[in]codec_cfgThe codec data to search in.
[out]program_info_uriPointer to the UTF-8 formatted program info URI.
Return values
Thelength of the ccid_list (may be 0)
-EINVALif arguments are invalid
-ENODATAif not found

◆ bt_audio_codec_cfg_meta_get_stream_context()

int bt_audio_codec_cfg_meta_get_stream_context ( const struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Extract stream contexts.

See BT_AUDIO_METADATA_TYPE_STREAM_CONTEXT for more information about this value.

Parameters
codec_cfgThe codec data to search in.
Return values
Thestream context type if positive or 0
-EINVALif arguments are invalid
-ENODATAif not found
-EBADMSGif found value has invalid size

◆ bt_audio_codec_cfg_meta_get_val()

int bt_audio_codec_cfg_meta_get_val ( const struct bt_audio_codec_cfg codec_cfg,
uint8_t  type,
const uint8_t **  data 
)

#include <zephyr/bluetooth/audio/audio.h>

Lookup a specific metadata value based on type.

Parameters
[in]codec_cfgThe codec data to search in.
[in]typeThe type id to look for
[out]dataPointer to the data-pointer to update when item is found
Return values
Lengthof found data (may be 0)
-EINVALif arguments are invalid
-ENODATAif not found

◆ bt_audio_codec_cfg_meta_get_vendor()

int bt_audio_codec_cfg_meta_get_vendor ( const struct bt_audio_codec_cfg codec_cfg,
const uint8_t **  vendor_meta 
)

#include <zephyr/bluetooth/audio/audio.h>

Extract vendor specific metadata.

See BT_AUDIO_METADATA_TYPE_VENDOR for more information about this value.

Parameters
[in]codec_cfgThe codec data to search in.
[out]vendor_metaPointer to the vendor specific metadata.
Return values
Thelength of the ccid_list (may be 0)
-EINVALif arguments are invalid
-ENODATAif not found

◆ bt_audio_codec_cfg_meta_set_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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the audio active state of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
stateThe audio active state to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_bcast_audio_immediate_rend_flag()

int bt_audio_codec_cfg_meta_set_bcast_audio_immediate_rend_flag ( struct bt_audio_codec_cfg codec_cfg)

#include <zephyr/bluetooth/audio/audio.h>

Set the broadcast audio immediate rendering flag of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the CCID list of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
ccid_listThe program info to set.
ccid_list_lenThe length of ccid_list.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_extended()

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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the extended metadata of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
extended_metaThe extended metadata to set.
extended_meta_lenThe length of extended_meta.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_lang()

int bt_audio_codec_cfg_meta_set_lang ( struct bt_audio_codec_cfg codec_cfg,
const uint8_t  lang[3] 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the language of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
langThe 24-bit language to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the parental rating of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
parental_ratingThe parental rating to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_pref_context()

int bt_audio_codec_cfg_meta_set_pref_context ( struct bt_audio_codec_cfg codec_cfg,
enum bt_audio_context  ctx 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the preferred context of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
ctxThe preferred context to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the program info of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
program_infoThe program info to set.
program_info_lenThe length of program_info.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the program info URI of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
program_info_uriThe program info URI to set.
program_info_uri_lenThe length of program_info_uri.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_stream_context()

int bt_audio_codec_cfg_meta_set_stream_context ( struct bt_audio_codec_cfg codec_cfg,
enum bt_audio_context  ctx 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the stream context of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
ctxThe stream context to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_val()

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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set or add a specific codec configuration metadata value.

Parameters
codec_cfgThe codec configuration to set the value in.
typeThe type id to set.
dataPointer to the data-pointer to set.
data_lenLength of data.
Return values
Themeta_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_set_vendor()

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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the vendor specific metadata of a codec configuration metadata.

Parameters
codec_cfgThe codec configuration to set data for.
vendor_metaThe vendor specific metadata to set.
vendor_meta_lenThe length of vendor_meta.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_meta_unset_val()

int bt_audio_codec_cfg_meta_unset_val ( struct bt_audio_codec_cfg codec_cfg,
enum bt_audio_metadata_type  type 
)

#include <zephyr/bluetooth/audio/audio.h>

Unset a specific codec configuration metadata value.

The type and the value will be removed from the codec configuration metadata.

Parameters
codec_cfgThe codec data to set the value in.
typeThe type id to unset.
Return values
Themeta_len of codec_cfg on success
-EINVALif arguments are invalid

◆ bt_audio_codec_cfg_set_chan_allocation()

int bt_audio_codec_cfg_set_chan_allocation ( struct bt_audio_codec_cfg codec_cfg,
enum bt_audio_location  chan_allocation 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the channel allocation of a codec configuration.

Parameters
codec_cfgThe codec configuration to set data for.
chan_allocationThe channel allocation to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_set_frame_blocks_per_sdu()

int bt_audio_codec_cfg_set_frame_blocks_per_sdu ( struct bt_audio_codec_cfg codec_cfg,
uint8_t  frame_blocks 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the frame blocks per SDU of a codec configuration.

Parameters
codec_cfgThe codec configuration to set data for.
frame_blocksThe frame blocks per SDU to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_set_frame_dur()

int bt_audio_codec_cfg_set_frame_dur ( struct bt_audio_codec_cfg codec_cfg,
enum bt_audio_codec_cfg_frame_dur  frame_dur 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the frame duration of a codec configuration.

Parameters
codec_cfgThe codec configuration to set data for.
frame_durThe assigned numbers frame duration to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_set_freq()

int bt_audio_codec_cfg_set_freq ( struct bt_audio_codec_cfg codec_cfg,
enum bt_audio_codec_cfg_freq  freq 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the frequency of a codec configuration.

Parameters
codec_cfgThe codec configuration to set data for.
freqThe assigned numbers frequency to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_set_octets_per_frame()

int bt_audio_codec_cfg_set_octets_per_frame ( struct bt_audio_codec_cfg codec_cfg,
uint16_t  octets_per_frame 
)

#include <zephyr/bluetooth/audio/audio.h>

Set the octets per codec frame of a codec configuration.

Parameters
codec_cfgThe codec configuration to set data for.
octets_per_frameThe octets per codec frame to set.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_set_val()

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 
)

#include <zephyr/bluetooth/audio/audio.h>

Set or add a specific codec configuration value.

Parameters
codec_cfgThe codec data to set the value in.
typeThe type id to set
dataPointer to the data-pointer to set
data_lenLength of data
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid
-ENOMEMif the new value could not set or added due to memory

◆ bt_audio_codec_cfg_unset_val()

int bt_audio_codec_cfg_unset_val ( struct bt_audio_codec_cfg codec_cfg,
enum bt_audio_codec_cfg_type  type 
)

#include <zephyr/bluetooth/audio/audio.h>

Unset a specific codec configuration value.

The type and the value will be removed from the codec configuration.

Parameters
codec_cfgThe codec data to set the value in.
typeThe type id to unset.
Return values
Thedata_len of codec_cfg on success
-EINVALif arguments are invalid