Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed Oct 14, 2024
1 parent 0db6ac1 commit 81ca9f4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/a2dp-opus.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ static const struct a2dp_bit_mapping a2dp_opus_channels[] = {
};

static const struct a2dp_bit_mapping a2dp_opus_rates[] = {
{ OPUS_SAMPLING_FREQ_16000, { 16000 } },
{ OPUS_SAMPLING_FREQ_24000, { 24000 } },
{ OPUS_SAMPLING_FREQ_48000, { 48000 } },
{ 0 }
};
Expand Down Expand Up @@ -481,7 +483,9 @@ struct a2dp_sep a2dp_opus_source = {
.capabilities.opus = {
.info = A2DP_VENDOR_INFO_INIT(OPUS_VENDOR_ID, OPUS_CODEC_ID),
.sampling_freq =
OPUS_SAMPLING_FREQ_48000,
OPUS_SAMPLING_FREQ_48000 |
OPUS_SAMPLING_FREQ_24000 |
OPUS_SAMPLING_FREQ_16000,
.frame_duration =
OPUS_FRAME_DURATION_100 |
OPUS_FRAME_DURATION_200,
Expand Down Expand Up @@ -511,7 +515,9 @@ struct a2dp_sep a2dp_opus_sink = {
.capabilities.opus = {
.info = A2DP_VENDOR_INFO_INIT(OPUS_VENDOR_ID, OPUS_CODEC_ID),
.sampling_freq =
OPUS_SAMPLING_FREQ_48000,
OPUS_SAMPLING_FREQ_48000 |
OPUS_SAMPLING_FREQ_24000 |
OPUS_SAMPLING_FREQ_16000,
.frame_duration =
OPUS_FRAME_DURATION_100 |
OPUS_FRAME_DURATION_200,
Expand Down
3 changes: 3 additions & 0 deletions src/bluez.c
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,9 @@ bool bluez_a2dp_set_configuration(

pthread_mutex_unlock(&bluez_mutex);

hexdump("A2DP requested configuration blob",
configuration, remote_sep_cfg->caps_size);

if ((rep = g_dbus_connection_send_message_with_reply_sync(config.dbus, msg,
G_DBUS_SEND_MESSAGE_FLAGS_NONE, -1, NULL, NULL, error)) == NULL ||
g_dbus_message_to_gerror(rep, error))
Expand Down
10 changes: 5 additions & 5 deletions src/shared/a2dp-codecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,9 @@ typedef struct a2dp_lhdc_v5 {
#define OPUS_VENDOR_ID BT_COMPID_GOOGLE
#define OPUS_CODEC_ID 0x0001

#define OPUS_SAMPLING_FREQ_48000 (1 << 0)
#define OPUS_SAMPLING_FREQ_48000 (1 << 2)
#define OPUS_SAMPLING_FREQ_24000 (1 << 1)
#define OPUS_SAMPLING_FREQ_16000 (1 << 0)

#define OPUS_FRAME_DURATION_100 (1 << 0)
#define OPUS_FRAME_DURATION_200 (1 << 1)
Expand All @@ -706,15 +708,13 @@ typedef struct a2dp_lhdc_v5 {
typedef struct a2dp_opus {
a2dp_vendor_info_t info;
#if __BYTE_ORDER == __BIG_ENDIAN
uint8_t sampling_freq:1;
uint8_t rfa:2;
uint8_t sampling_freq:3;
uint8_t frame_duration:2;
uint8_t channel_mode:3;
#else
uint8_t channel_mode:3;
uint8_t frame_duration:2;
uint8_t rfa:2;
uint8_t sampling_freq:1;
uint8_t sampling_freq:3;
#endif
} __attribute__ ((packed)) a2dp_opus_t;

Expand Down

0 comments on commit 81ca9f4

Please sign in to comment.