a2dp-codecs: also define functions for big endian

This commit is contained in:
Wim Taymans 2018-01-23 16:23:39 +01:00
parent afae27b4cc
commit 1804e47a91

View file

@ -172,36 +172,6 @@ typedef struct {
uint8_t max_bitpool;
} __attribute__ ((packed)) a2dp_sbc_t;
static inline int a2dp_sbc_get_channels(a2dp_sbc_t *config)
{
switch (config->channel_mode) {
case SBC_CHANNEL_MODE_MONO:
return 1;
case SBC_CHANNEL_MODE_DUAL_CHANNEL:
case SBC_CHANNEL_MODE_STEREO:
case SBC_CHANNEL_MODE_JOINT_STEREO:
return 2;
default:
return -1;
}
}
static inline int a2dp_sbc_get_frequency(a2dp_sbc_t *config)
{
switch (config->frequency) {
case SBC_SAMPLING_FREQ_16000:
return 16000;
case SBC_SAMPLING_FREQ_32000:
return 32000;
case SBC_SAMPLING_FREQ_44100:
return 44100;
case SBC_SAMPLING_FREQ_48000:
return 48000;
default:
return -1;
}
}
typedef struct {
uint8_t channel_mode:4;
uint8_t crc:1;
@ -284,6 +254,36 @@ typedef struct {
#error "Unknown byte order"
#endif
static inline int a2dp_sbc_get_channels(a2dp_sbc_t *config)
{
switch (config->channel_mode) {
case SBC_CHANNEL_MODE_MONO:
return 1;
case SBC_CHANNEL_MODE_DUAL_CHANNEL:
case SBC_CHANNEL_MODE_STEREO:
case SBC_CHANNEL_MODE_JOINT_STEREO:
return 2;
default:
return -1;
}
}
static inline int a2dp_sbc_get_frequency(a2dp_sbc_t *config)
{
switch (config->frequency) {
case SBC_SAMPLING_FREQ_16000:
return 16000;
case SBC_SAMPLING_FREQ_32000:
return 32000;
case SBC_SAMPLING_FREQ_44100:
return 44100;
case SBC_SAMPLING_FREQ_48000:
return 48000;
default:
return -1;
}
}
const a2dp_sbc_t bluez_a2dp_sbc;
#if ENABLE_MP3
const a2dp_mpeg_t bluez_a2dp_mpeg;