avdp: use enum type for block lenght and subbands in avdtp_configuration_sbc_t

This commit is contained in:
Milanka Ringwald 2024-12-11 11:52:13 +01:00 committed by Matthias Ringwald
parent 858500b1d8
commit 48070a6f9a
2 changed files with 11 additions and 14 deletions

View File

@ -1561,12 +1561,13 @@ uint8_t avdtp_stream_endpoint_seid(avdtp_stream_endpoint_t * stream_endpoint){
if (!stream_endpoint) return 0;
return stream_endpoint->sep.seid;
}
uint8_t avdtp_choose_sbc_subbands(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_subbands_bitmap){
avdtp_sbc_subbands_t avdtp_choose_sbc_subbands(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_subbands_bitmap){
if (!stream_endpoint) return 0;
uint8_t * media_codec = stream_endpoint->sep.capabilities.media_codec.media_codec_information;
uint8_t subbands_bitmap = ((media_codec[1] >> 2) & 0x03) & remote_subbands_bitmap;
uint8_t subbands = AVDTP_SBC_SUBBANDS_8;
avdtp_sbc_subbands_t subbands = AVDTP_SBC_SUBBANDS_8;
if (subbands_bitmap & AVDTP_SBC_SUBBANDS_8){
subbands = AVDTP_SBC_SUBBANDS_8;
} else if (subbands_bitmap & AVDTP_SBC_SUBBANDS_4){
@ -1575,12 +1576,12 @@ uint8_t avdtp_choose_sbc_subbands(avdtp_stream_endpoint_t * stream_endpoint, uin
return subbands;
}
uint8_t avdtp_choose_sbc_block_length(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_block_length_bitmap){
avdtp_sbc_block_length_t avdtp_choose_sbc_block_length(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_block_length_bitmap){
if (!stream_endpoint) return 0;
uint8_t * media_codec = stream_endpoint->sep.capabilities.media_codec.media_codec_information;
uint8_t block_length_bitmap = (media_codec[1] >> 4) & remote_block_length_bitmap;
uint8_t block_length = AVDTP_SBC_BLOCK_LENGTH_16;
avdtp_sbc_block_length_t block_length = AVDTP_SBC_BLOCK_LENGTH_16;
if (block_length_bitmap & AVDTP_SBC_BLOCK_LENGTH_16){
block_length = AVDTP_SBC_BLOCK_LENGTH_16;
} else if (block_length_bitmap & AVDTP_SBC_BLOCK_LENGTH_12){

View File

@ -323,8 +323,8 @@ typedef enum {
typedef struct {
uint16_t sampling_frequency;
avdtp_channel_mode_t channel_mode;
uint8_t block_length;
uint8_t subbands;
avdtp_sbc_block_length_t block_length;
avdtp_sbc_subbands_t subbands;
avdtp_sbc_allocation_method_t allocation_method;
uint8_t min_bitpool_value;
uint8_t max_bitpool_value;
@ -366,8 +366,6 @@ typedef struct {
uint16_t maximum_sul;
} avdtp_configuration_atrac_t;
typedef struct {
uint8_t version;
uint8_t padding;
@ -453,7 +451,6 @@ typedef struct {
avdtp_capabilities_t configuration;
} avdtp_sep_t;
typedef enum {
AVDTP_SIGNALING_CONNECTION_IDLE = 0,
AVDTP_SIGNALING_W2_SEND_SDP_QUERY_FOR_REMOTE_SINK,
@ -601,7 +598,6 @@ typedef struct {
} avdtp_connection_t;
typedef struct avdtp_stream_endpoint {
btstack_linked_item_t item;
@ -724,8 +720,8 @@ uint16_t avdtp_get_highest_sampling_frequency(uint8_t sampling_frequency_bitmap)
avdtp_channel_mode_t avdtp_choose_sbc_channel_mode(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_channel_mode_bitmap);
avdtp_sbc_allocation_method_t avdtp_choose_sbc_allocation_method(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_allocation_method_bitmap);
uint16_t avdtp_choose_sbc_sampling_frequency(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_sampling_frequency_bitmap);
uint8_t avdtp_choose_sbc_subbands(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_subbands_bitmap);
uint8_t avdtp_choose_sbc_block_length(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_block_length_bitmap);
avdtp_sbc_subbands_t avdtp_choose_sbc_subbands(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_subbands_bitmap);
avdtp_sbc_block_length_t avdtp_choose_sbc_block_length(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_block_length_bitmap);
uint8_t avdtp_choose_sbc_max_bitpool_value(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_max_bitpool_value);
uint8_t avdtp_choose_sbc_min_bitpool_value(avdtp_stream_endpoint_t * stream_endpoint, uint8_t remote_min_bitpool_value);