Zephyr Project API
3.3.0
A Scalable Open Source RTOS
|
Audio codec Config APIs. More...
Enumerations | |
enum | bt_audio_codec_parse_err { BT_AUDIO_CODEC_PARSE_ERR_SUCCESS = 0 , BT_AUDIO_CODEC_PARSE_ERR_TYPE_NOT_FOUND = -1 , BT_AUDIO_CODEC_PARSE_ERR_INVALID_VALUE_FOUND = -2 , BT_AUDIO_CODEC_PARSE_ERR_INVALID_PARAM = -3 } |
Codec parser error codes for Codec config parsing APIs. More... | |
Functions | |
int | bt_codec_cfg_get_freq (const struct bt_codec *codec) |
Extract the frequency from a codec configuration. More... | |
int | bt_codec_cfg_get_frame_duration_us (const struct bt_codec *codec) |
Extract frame duration from BT codec config. More... | |
int | bt_codec_cfg_get_chan_allocation_val (const struct bt_codec *codec, uint32_t *chan_allocation) |
Extract channel allocation from BT codec config. More... | |
int | bt_codec_cfg_get_octets_per_frame (const struct bt_codec *codec) |
Extract frame size in octets from BT codec config. More... | |
int | bt_codec_cfg_get_frame_blocks_per_sdu (const struct bt_codec *codec, bool fallback_to_default) |
Extract number of audio frame blockss in each SDU from BT codec config. More... | |
bool | bt_codec_get_val (const struct bt_codec *codec, uint8_t type, const struct bt_codec_data **data) |
Lookup a specific value based on type. More... | |
Audio codec Config APIs.
Functions to parse codec config data when formatted as LTV wrapped into bt_codec.
#include <include/zephyr/bluetooth/audio/audio.h>
Codec parser error codes for Codec config parsing APIs.
int bt_codec_cfg_get_chan_allocation_val | ( | const struct bt_codec * | codec, |
uint32_t * | chan_allocation | ||
) |
#include <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_CODEC_LC3_CHAN_COUNT number of channels can be present.
codec | The codec configuration to extract data from. |
chan_allocation | Pointer to the variable to store the extracted value in. |
int bt_codec_cfg_get_frame_blocks_per_sdu | ( | const struct bt_codec * | codec, |
bool | fallback_to_default | ||
) |
#include <include/zephyr/bluetooth/audio/audio.h>
Extract number of audio frame blockss 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.
codec | The codec configuration to extract data from. |
fallback_to_default | If true this function will return the default value of 1 if the type is not found. In this case the function will only fail if a NULL pointer is provided. |
fallback_to_default
is true then the value 1 is returned if frames per sdu is not found. int bt_codec_cfg_get_frame_duration_us | ( | const struct bt_codec * | codec | ) |
#include <include/zephyr/bluetooth/audio/audio.h>
Extract frame duration from BT codec config.
codec | The codec configuration to extract data from. |
int bt_codec_cfg_get_freq | ( | const struct bt_codec * | codec | ) |
#include <include/zephyr/bluetooth/audio/audio.h>
Extract the frequency from a codec configuration.
codec | The codec configuration to extract data from. |
int bt_codec_cfg_get_octets_per_frame | ( | const struct bt_codec * | codec | ) |
#include <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 specificationa 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.
codec | The codec configuration to extract data from. |
bool bt_codec_get_val | ( | const struct bt_codec * | codec, |
uint8_t | type, | ||
const struct bt_codec_data ** | data | ||
) |
#include <include/zephyr/bluetooth/audio/audio.h>
Lookup a specific value based on type.
Depending on context bt_codec will be either codec capabilities, codec configuration or meta data.
Typically types used are: bt_codec_capability_type bt_codec_config_type bt_audio_metadata_type
codec | The codec data to search in. |
type | The type id to look for |
data | Pointer to the data-pointer to update when item is found |