diff --git a/profiles/audio/a2dp-codecs.h b/profiles/audio/a2dp-codecs.h
index 0bdd291..16088dc 100644
--- a/profiles/audio/a2dp-codecs.h
+++ b/profiles/audio/a2dp-codecs.h
#define APTX_LL_VENDOR_ID 0x0000000a
#define APTX_LL_CODEC_ID 0x0002
-#define APTX_LL_CHANNEL_MODE_MONO 0x01
-#define APTX_LL_CHANNEL_MODE_STEREO 0x02
-
-#define APTX_LL_SAMPLING_FREQ_16000 0x08
-#define APTX_LL_SAMPLING_FREQ_32000 0x04
-#define APTX_LL_SAMPLING_FREQ_44100 0x02
-#define APTX_LL_SAMPLING_FREQ_48000 0x01
-
/* Default parameters for aptX Low Latency encoder */
/* Target codec buffer level = 180 */
#define APTX_HD_VENDOR_ID 0x000000D7
#define APTX_HD_CODEC_ID 0x0024
-#define APTX_HD_CHANNEL_MODE_MONO 0x1
-#define APTX_HD_CHANNEL_MODE_STEREO 0x2
-
-#define APTX_HD_SAMPLING_FREQ_16000 0x8
-#define APTX_HD_SAMPLING_FREQ_32000 0x4
-#define APTX_HD_SAMPLING_FREQ_44100 0x2
-#define APTX_HD_SAMPLING_FREQ_48000 0x1
-
#define LDAC_VENDOR_ID 0x0000012d
#define LDAC_CODEC_ID 0x00aa
} __attribute__ ((packed)) a2dp_faststream_t;
typedef struct {
- a2dp_vendor_codec_t info;
- uint8_t channel_mode:4;
- uint8_t frequency:4;
+ a2dp_aptx_t aptx;
uint8_t bidirect_link:1;
uint8_t has_new_caps:1;
uint8_t reserved:6;
a2dp_aptx_ll_new_caps_t new_caps[0];
} __attribute__ ((packed)) a2dp_aptx_ll_t;
-typedef struct {
- a2dp_vendor_codec_t info;
- uint8_t channel_mode:4;
- uint8_t frequency:4;
- uint8_t reserved0;
- uint8_t reserved1;
- uint8_t reserved2;
- uint8_t reserved3;
-} __attribute__ ((packed)) a2dp_aptx_hd_t;
-
#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \
__BYTE_ORDER == __BIG_ENDIAN
} __attribute__ ((packed)) a2dp_faststream_t;
typedef struct {
- a2dp_vendor_codec_t info;
- uint8_t frequency:4;
- uint8_t channel_mode:4;
+ a2dp_aptx_t aptx;
uint8_t reserved:6;
uint8_t has_new_caps:1;
uint8_t bidirect_link:1;
a2dp_aptx_ll_new_caps_t new_caps[0];
} __attribute__ ((packed)) a2dp_aptx_ll_t;
+#else
+#error "Unknown byte order"
+#endif
+
typedef struct {
- a2dp_vendor_codec_t info;
- uint8_t frequency:4;
- uint8_t channel_mode:4;
+ a2dp_aptx_t aptx;
uint8_t reserved0;
uint8_t reserved1;
uint8_t reserved2;
uint8_t reserved3;
} __attribute__ ((packed)) a2dp_aptx_hd_t;
-
-#else
-#error "Unknown byte order"
-#endif
diff --git a/tools/avinfo.c b/tools/avinfo.c
index 02fc1f2..ea7a93e 100644
--- a/tools/avinfo.c
+++ b/tools/avinfo.c
uint8_t data[0];
} __attribute__ ((packed));
-static void print_aptx(a2dp_aptx_t *aptx, uint8_t size)
+static void print_aptx_common(a2dp_aptx_t *aptx)
{
- printf("\t\tVendor Specific Value (aptX)");
-
- if (size < sizeof(*aptx)) {
- printf(" (broken)\n");
- return;
- }
-
printf("\n\t\t\tFrequencies: ");
if (aptx->frequency & APTX_SAMPLING_FREQ_16000)
printf("16kHz ");
printf("Mono ");
if (aptx->channel_mode & APTX_CHANNEL_MODE_STEREO)
printf("Stereo ");
+}
+
+static void print_aptx(a2dp_aptx_t *aptx, uint8_t size)
+{
+ printf("\t\tVendor Specific Value (aptX)");
+
+ if (size < sizeof(*aptx)) {
+ printf(" (broken)\n");
+ return;
+ }
+
+ print_aptx_common(aptx);
printf("\n");
}
return;
}
- printf("\n\t\t\tFrequencies: ");
- if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_16000)
- printf("16kHz ");
- if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_32000)
- printf("32kHz ");
- if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_44100)
- printf("44.1kHz ");
- if (aptx_ll->frequency & APTX_LL_SAMPLING_FREQ_48000)
- printf("48kHz ");
-
- printf("\n\t\t\tChannel modes: ");
- if (aptx_ll->channel_mode & APTX_LL_CHANNEL_MODE_MONO)
- printf("Mono ");
- if (aptx_ll->channel_mode & APTX_LL_CHANNEL_MODE_STEREO)
- printf("Stereo ");
+ print_aptx_common(&aptx_ll->aptx);
printf("\n\t\tBidirectional link: %s",
aptx_ll->bidirect_link ? "Yes" : "No");
return;
}
- printf("\n\t\t\tFrequencies: ");
- if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_16000)
- printf("16kHz ");
- if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_32000)
- printf("32kHz ");
- if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_44100)
- printf("44.1kHz ");
- if (aptx_hd->frequency & APTX_HD_SAMPLING_FREQ_48000)
- printf("48kHz ");
-
- printf("\n\t\t\tChannel modes: ");
- if (aptx_hd->channel_mode & APTX_HD_CHANNEL_MODE_MONO)
- printf("Mono ");
- if (aptx_hd->channel_mode & APTX_HD_CHANNEL_MODE_STEREO)
- printf("Stereo ");
+ print_aptx_common(&aptx_hd->aptx);
printf("\n");
}