2015-11-13 10:59:39

by Andrzej Kaczmarek

[permalink] [raw]
Subject: [PATCH 1/3] tools/avinfo: Add partial support for Sony LDAC

Contents of Vendor Specific Value in codec information is unknown at
the moment so only raw value is printed.
---
profiles/audio/a2dp-codecs.h | 8 ++++++++
tools/avinfo.c | 12 ++++++++++++
2 files changed, 20 insertions(+)

diff --git a/profiles/audio/a2dp-codecs.h b/profiles/audio/a2dp-codecs.h
index 4d2584d..e9da0bf 100644
--- a/profiles/audio/a2dp-codecs.h
+++ b/profiles/audio/a2dp-codecs.h
@@ -141,6 +141,9 @@
#define APTX_SAMPLING_FREQ_44100 0x02
#define APTX_SAMPLING_FREQ_48000 0x01

+#define LDAC_VENDOR_ID 0x0000012d
+#define LDAC_CODEC_ID 0x00aa
+
typedef struct {
uint32_t vendor_id;
uint16_t codec_id;
@@ -186,6 +189,11 @@ typedef struct {
uint8_t frequency:4;
} __attribute__ ((packed)) a2dp_aptx_t;

+typedef struct {
+ a2dp_vendor_codec_t info;
+ uint8_t unknown[2];
+} __attribute__ ((packed)) a2dp_ldac_t;
+
#elif __BYTE_ORDER == __BIG_ENDIAN

typedef struct {
diff --git a/tools/avinfo.c b/tools/avinfo.c
index 3f406ca..cc756f1 100644
--- a/tools/avinfo.c
+++ b/tools/avinfo.c
@@ -181,6 +181,16 @@ static void print_aptx(a2dp_aptx_t *aptx)
printf("\n");
}

+static void print_ldac(a2dp_ldac_t *ldac)
+{
+ printf("\t\tVendor Specific Value (LDAC)");
+
+ printf("\n\t\t\tUnknown: %02x %02x", ldac->unknown[0],
+ ldac->unknown[1]);
+
+ printf("\n");
+}
+
static void print_vendor(a2dp_vendor_codec_t *vendor)
{
uint32_t vendor_id = btohl(vendor->vendor_id);
@@ -194,6 +204,8 @@ static void print_vendor(a2dp_vendor_codec_t *vendor)

if (vendor_id == APTX_VENDOR_ID && codec_id == APTX_CODEC_ID)
print_aptx((void *) vendor);
+ else if (vendor_id == LDAC_VENDOR_ID && codec_id == LDAC_CODEC_ID)
+ print_ldac((void *) vendor);
}

static void print_mpeg24(a2dp_aac_t *aac)
--
2.6.2



2015-11-16 08:06:37

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/3] tools/avinfo: Add partial support for Sony LDAC

Hi Andrzej,

On Fri, Nov 13, 2015, Andrzej Kaczmarek wrote:
> Contents of Vendor Specific Value in codec information is unknown at
> the moment so only raw value is printed.
> ---
> profiles/audio/a2dp-codecs.h | 8 ++++++++
> tools/avinfo.c | 12 ++++++++++++
> 2 files changed, 20 insertions(+)

All three patches in this set have been applied. Thanks.

Johan

2015-11-13 10:59:41

by Andrzej Kaczmarek

[permalink] [raw]
Subject: [PATCH 3/3] tools/hcidump: Print LDAC vendor codec name

---
tools/parser/avdtp.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/parser/avdtp.c b/tools/parser/avdtp.c
index f05f329..4f53553 100644
--- a/tools/parser/avdtp.c
+++ b/tools/parser/avdtp.c
@@ -154,6 +154,8 @@ static char *vndcodec2str(uint32_t vendor, uint16_t vndcodec)
{
if (vendor == 0x0000004f && vndcodec == 0x0001)
return "aptX";
+ else if (vendor == 0x0000012d && vndcodec == 0x00aa)
+ return "LDAC";
return "Unknown";
}

--
2.6.2


2015-11-13 10:59:40

by Andrzej Kaczmarek

[permalink] [raw]
Subject: [PATCH 2/3] tools/avinfo: Print content protection

---
tools/avinfo.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/tools/avinfo.c b/tools/avinfo.c
index cc756f1..31c4e10 100644
--- a/tools/avinfo.c
+++ b/tools/avinfo.c
@@ -74,6 +74,10 @@
#define AVDTP_MEDIA_TYPE_VIDEO 0x01
#define AVDTP_MEDIA_TYPE_MULTIMEDIA 0x02

+/* Content Protection types definitions */
+#define AVDTP_CONTENT_PROTECTION_TYPE_DTCP 0x0001
+#define AVDTP_CONTENT_PROTECTION_TYPE_SCMS_T 0x0002
+
struct avdtp_service_capability {
uint8_t category;
uint8_t length;
@@ -158,6 +162,11 @@ struct getcap_resp {
uint8_t caps[0];
} __attribute__ ((packed));

+struct avdtp_content_protection_capability {
+ uint16_t content_protection_type;
+ uint8_t data[0];
+} __attribute__ ((packed));
+
static void print_aptx(a2dp_aptx_t *aptx)
{
printf("\t\tVendor Specific Value (aptX)");
@@ -405,6 +414,25 @@ static void print_media_codec(struct avdtp_media_codec_capability *cap)
}
}

+static void print_content_protection(
+ struct avdtp_content_protection_capability *cap)
+{
+ printf("\tContent Protection: ");
+
+ switch (btohs(cap->content_protection_type)) {
+ case AVDTP_CONTENT_PROTECTION_TYPE_DTCP:
+ printf("DTCP");
+ break;
+ case AVDTP_CONTENT_PROTECTION_TYPE_SCMS_T:
+ printf("SCMS-T");
+ break;
+ default:
+ printf("Unknown");
+ }
+
+ printf("\n");
+}
+
static void print_caps(void *data, int size)
{
int processed;
@@ -423,13 +451,15 @@ static void print_caps(void *data, int size)
case AVDTP_MEDIA_TRANSPORT:
case AVDTP_REPORTING:
case AVDTP_RECOVERY:
- case AVDTP_CONTENT_PROTECTION:
case AVDTP_MULTIPLEXING:
/* FIXME: Add proper functions */
break;
case AVDTP_MEDIA_CODEC:
print_media_codec((void *) cap->data);
break;
+ case AVDTP_CONTENT_PROTECTION:
+ print_content_protection((void *) cap->data);
+ break;
}

processed += 2 + cap->length;
--
2.6.2