2004-11-07 05:36:02

by Brad Midgley

[permalink] [raw]
Subject: [Bluez-devel] AVDTP socket?

Hi

Is AVDTP complete enough to pass data around? When I try to create a socket

socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_AVDTP)

perror gave me "Protocol not supported." Is this the right way to get an
AVDTP socket?

I'm using debian-testing w/libbluetooth 2.10-1, kernel 2.6.9 (unpatched)

--
Brad


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel


2004-11-23 06:22:13

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > And we need to add a clear license statement to the source files. I
> > like to put the SBC library under LGPL and the programs under GPL. Is
> > this fine with you?
>
> Absolutely, that's what I wanted to do anyways.

I added the license statement to all files now.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-23 00:53:09

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

Am Mon, 22 Nov 2004 14:28:22 +0100 schrieb Marcel Holtmann:

> And we need to add a clear license statement to the source files. I
> like to put the SBC library under LGPL and the programs under GPL. Is
> this fine with you?

Absolutely, that's what I wanted to do anyways.

--
Henryk Pl?tz
Gr??e aus Berlin
~~~~~~~ Un-CDs, nein danke! http://www.heise.de/ct/cd-register/ ~~~~~~~
~ Help Microsoft fight software piracy: Give Linux to a friend today! ~


Attachments:
(No filename) (460.00 B)
(No filename) (189.00 B)
Download all attachments

2004-11-22 13:28:22

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > With the latest code you still overwrite the stack at some point,
> > because the pcm_sample[][] array is only 2x128 and you return 2x256
> > samples from sbc_synthesize_audio() function.
>
> Ahh, thanks. I broke it when I moved the superfluous (I thought)
> assignment of current_sample=0 out of the channel for loop. Should work
> now again.
>
> > I also started to write a simple SBC play program using the libao. It
> > works actually quite good linking your sbc.o file, but unfortunately
> > with 2 channel files the left channel is silent.
>
> If that was a result of the abovementioned bug it should work now again.

yes. Everything works now like it should.

> > We should start a new thread and discuss a SBC library.
>
> Sure. I should have the bitstream packer working sometime soon and will
> then post again.

I re-arranged some stuff in the CVS again and the sbc directory is now
also using autoconf/automake. However the sbc.h is now sbc_internal.h
and the new sbc.h is the header file of the new SBC library. The sbcdec
program is using libao to play the SBC file on your soundcard. However
the libao library can also write the data to a file in AU or WAV format,
but this is not implemented at the moment.

Can't wait to write the sbcenc program. Keep on with the good work.

And we need to add a clear license statement to the source files. I like
to put the SBC library under LGPL and the programs under GPL. Is this
fine with you?

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-22 04:32:13

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

Am Mon, 22 Nov 2004 04:18:35 +0100 schrieb Marcel Holtmann:

> I tested again all example files before you moved the bits array
> calculation into an own function. All of them sounded good.

So did I, this time. :-)

> With the latest code you still overwrite the stack at some point,
> because the pcm_sample[][] array is only 2x128 and you return 2x256
> samples from sbc_synthesize_audio() function.

Ahh, thanks. I broke it when I moved the superfluous (I thought)
assignment of current_sample=0 out of the channel for loop. Should work
now again.

> I also started to write a simple SBC play program using the libao. It
> works actually quite good linking your sbc.o file, but unfortunately
> with 2 channel files the left channel is silent.

If that was a result of the abovementioned bug it should work now again.

> We should start a new thread and discuss a SBC library.

Sure. I should have the bitstream packer working sometime soon and will
then post again.

--
Henryk Pl?tz
Gr??e aus Berlin
~~~~~~~ Un-CDs, nein danke! http://www.heise.de/ct/cd-register/ ~~~~~~~
~ Help Microsoft fight software piracy: Give Linux to a friend today! ~


Attachments:
(No filename) (1.13 kB)
(No filename) (189.00 B)
Download all attachments

2004-11-22 04:22:38

by Brad Midgley

[permalink] [raw]
Subject: [Bluez-devel] sbc reindent

Henryk,

I didn't reindent your sbc stuff because I've been seeing you update
there recently.

FYI, I just ran /usr/src/linux/scripts/Lindent on the other files, but
I'll let you do your stuff so we don't have conflicts.

Brad


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-22 03:18:35

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > > I have problems synthesizing the PCM audio samples but can parse all
> > > of the example SBC streams just fine.
> >
> > Ok, catched it. I reimplemented the SBC analyzer and synthesizer in
> > Octave which is easier to play around with and found that my C
> > synthesizer was working fine - on wrong subband samples. The bitstream
> > unpacker had a bug which made it shift the incoming bits once to often.
> >
> > So sbc-test from the CVS is now able to decode 4 and 8 subband mono SBC
> > files (there's something wrong with stereo, I'll look into that
> > shortly).
>
> I was only able to decode 01, 03, 07 and 09. All other mono test files
> are failing. However good work, because these four sound perfect.

I tested again all example files before you moved the bits array
calculation into an own function. All of them sounded good.

With the latest code you still overwrite the stack at some point,
because the pcm_sample[][] array is only 2x128 and you return 2x256
samples from sbc_synthesize_audio() function.

I also started to write a simple SBC play program using the libao. It
works actually quite good linking your sbc.o file, but unfortunately
with 2 channel files the left channel is silent.

We should start a new thread and discuss a SBC library.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-21 17:44:10

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > I have problems synthesizing the PCM audio samples but can parse all
> > of the example SBC streams just fine.
>
> Ok, catched it. I reimplemented the SBC analyzer and synthesizer in
> Octave which is easier to play around with and found that my C
> synthesizer was working fine - on wrong subband samples. The bitstream
> unpacker had a bug which made it shift the incoming bits once to often.
>
> So sbc-test from the CVS is now able to decode 4 and 8 subband mono SBC
> files (there's something wrong with stereo, I'll look into that
> shortly).

I was only able to decode 01, 03, 07 and 09. All other mono test files
are failing. However good work, because these four sound perfect.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-21 05:46:55

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

Am Thu, 18 Nov 2004 14:27:26 +0100 schrieb Henryk Pl?tz:

> I have problems synthesizing the PCM audio samples but can parse all
> of the example SBC streams just fine.

Ok, catched it. I reimplemented the SBC analyzer and synthesizer in
Octave which is easier to play around with and found that my C
synthesizer was working fine - on wrong subband samples. The bitstream
unpacker had a bug which made it shift the incoming bits once to often.

So sbc-test from the CVS is now able to decode 4 and 8 subband mono SBC
files (there's something wrong with stereo, I'll look into that
shortly).

I also moved all my static const tables to a separate header file and
replaced my cos() calls with precomputed tables. The decoder is still
about 5 times slower than the reference one, though.

--
Henryk Pl?tz
Gr??e aus Berlin
~~~~~~~ Un-CDs, nein danke! http://www.heise.de/ct/cd-register/ ~~~~~~~
~ Help Microsoft fight software piracy: Give Linux to a friend today! ~


Attachments:
(No filename) (974.00 B)
(No filename) (189.00 B)
Download all attachments

2004-11-20 05:04:25

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > btw what is the format of sbc_test_01.sbc etc. Do we have a specific
> > list of the settings in these files. I like to put it for reference on
> > the web.
>
> Yupp, that's in A2DP_TS_C1.1v10.pdf on pages 34 and following.

I've added a tool called sbcinfo to the CVS that goes through a SBC file
and decodes this information. I also updated a2play and rcplay to make
use of the SBC frame length.

However I was unable to get my Aiptek headphone to play some music with
the original SBC media header.

And btw the AVDTP parser in the hcidump CVS repository should now be
able to display the correct decoded information on the signal channel.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-20 00:50:30

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Sat, 20 Nov 2004 01:43:16 +0100, Marcel Holtmann <[email protected]> w=
rote:

> btw what is the format of sbc_test_01.sbc etc. Do we have a specific
> list of the settings in these files. I like to put it for reference on
> the web.

Yupp, that's in A2DP_TS_C1.1v10.pdf on pages 34 and following.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-20 00:43:16

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > What we need is an easy way to calculate the frame size from the frame
> > header without decoding the frame data itself.
>
> I just re-discovered that in the A2DP spec. It's on page 70, section 12.9.

btw what is the format of sbc_test_01.sbc etc. Do we have a specific
list of the settings in these files. I like to put it for reference on
the web.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-20 00:09:37

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> Shouldn't this work to send the header in a separate write() and have a
> struct for it?

no, because the L2CAP is a SOCK_SEQPACKET. You must send the packet at
once. Otherwise you will get bad fragmentation.

> I thought everything ended up being little-endian on the wire, but
>
> buf[2] = seq_num >> 8;
> buf[3] = seq_num & 0xff;
>
> looks big endian to me (00 then 01 for 0x0001). When my code writes to
> sequence_number, it comes out little endian (01 then 00 for 0x0001).

Look at the RTP RFC they mentioned in the specification. I didn't
checked it. Simply used the stuff I've seen in my trace.

And btw the endianess may differ between parts of the Bluetooth protocol
stack. This is the problem when you adapt other protocols.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-20 00:04:11

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Fri, 19 Nov 2004 23:04:06 +0100, Marcel Holtmann <[email protected]> w=
rote:
> What we need is an easy way to calculate the frame size from the frame
> header without decoding the frame data itself.=20

I just re-discovered that in the A2DP spec. It's on page 70, section 12.9.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 23:58:54

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Fri, 19 Nov 2004 22:33:44 +0100, Marcel Holtmann <[email protected]> w=
rote:

> Do you also use the Aiptek or the BlueTake one. The Aiptek is very old
> and maybe the decoder in my headphone has a bug.

I only have the BlueTake one.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 23:23:09

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel,

Shouldn't this work to send the header in a separate write() and have a
struct for it?

I thought everything ended up being little-endian on the wire, but

buf[2] = seq_num >> 8;
buf[3] = seq_num & 0xff;

looks big endian to me (00 then 01 for 0x0001). When my code writes to
sequence_number, it comes out little endian (01 then 00 for 0x0001).

Brad

while(!terminate) {
- memset(buf, 0, 12);
- buf[0] = 0x80;
- buf[2] = seq_num >> 8;
- buf[3] = seq_num & 0xff;
- buf[12] = 0xff;
- buf[13] = 0xff;
- size = read(fd, buf + 14, mtu - 14);
+ memset(&packet_header, 0, sizeof(packet_header));
+ packet_header.cc = 8;
+ packet_header.sequence_number = htobs(seq_num);
+ packet_header.csrc[0] = htobl(0xffff0000);
+
+ // dump_packet(&packet_header, sizeof(packet_header)); exit(0);
+
+ size = read(fd, buf, mtu - sizeof(packet_header));
seq_num++;
if(size <= 0) {
terminate = 1;
} else {
- // framing, fragmenting, a2dp headers: avdtp p.45 and a2dp spec p.23
- write(streamfd, buf, size + 14);
+ // avdtp p.45
+ write(streamfd, &packet_header, sizeof(packet_header));
+ // what about framing, fragmenting, a2dp headers (a2dp spec p.23)
+ write(streamfd, buf, size);
}
}
close(fd);



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 22:04:06

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> I added rcplay.c to cvs and made you a developer on bluetooth-alsa so
> you can tweak things if you see fit.

thanks. I will do that.

> The bluetake sometimes works and sometimes doesn't when using a2play.
> The same stream will work a couple of times and then it produces loud
> white noise. There is probably something still not quite right.
>
> I disabled this section in a2dp.c
>
> memset(buf, 0, 12);
> buf[0] = 0x80;
> buf[2] = seq_num >> 8;
> buf[3] = seq_num & 0xff;
> buf[12] = 0x0ff;
> buf[13] = 0x0ff;
> memcpy(buf + 14, &sbc_info, sizeof(sbc_info));
> size = read(fd, buf + 14 + sizeof(sbc_info), mtu - sizeof(sbc_info) -
> 14);
> write(streamfd, buf, size + 14 + sizeof(sbc_info));
> seq_num++;
>
> but it didn't help or hurt. I couldn't see why sbc_info was being
> written to the stream since I thought it was just a file header. Does
> your headset work with a2play as it is in cvs now?

Yes, perfect. I tried it with an MP3 that I convert to a wave file and
used the sbc_encoder.exe to create the SBC file. It also works fine with
the rcplay tool.

I think that GCT (the company that build the chips and wrote the
software for both headphone types) added their own SBC media packet
format. I read the A2DP specification again and as far as I understand
it, we must read the SBC frame header from the first frame. Set the
AVDTP configuration according to that header and then send the SBC frame
with the SBC media packet header (with or without fragmenting). And then
proceed with the other SBC frames in that file.

I found nothing about 0xff 0xff and even playing with content protection
and multiplexing bits and bytes, nothing resulted in these two bytes.

What we need is an easy way to calculate the frame size from the frame
header without decoding the frame data itself. And also scanning for the
sync byte is not really an option. If we get this working, we need to
check if these headphones also support real A2DP media packets.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 21:51:20

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel,

I added rcplay.c to cvs and made you a developer on bluetooth-alsa so
you can tweak things if you see fit.

The bluetake sometimes works and sometimes doesn't when using a2play.
The same stream will work a couple of times and then it produces loud
white noise. There is probably something still not quite right.

I disabled this section in a2dp.c

memset(buf, 0, 12);
buf[0] = 0x80;
buf[2] = seq_num >> 8;
buf[3] = seq_num & 0xff;
buf[12] = 0x0ff;
buf[13] = 0x0ff;
memcpy(buf + 14, &sbc_info, sizeof(sbc_info));
size = read(fd, buf + 14 + sizeof(sbc_info), mtu - sizeof(sbc_info) -
14);
write(streamfd, buf, size + 14 + sizeof(sbc_info));
seq_num++;

but it didn't help or hurt. I couldn't see why sbc_info was being
written to the stream since I thought it was just a file header. Does
your headset work with a2play as it is in cvs now?

Brad

Marcel Holtmann wrote:
> Hi Brad,
>
>
>>actually like with the attached patch. Most of the example *.sbc files
>>are working. Some of them are not working and this is maybe because the
>>frame header information don't matches the SBC configuration. Or maybe
>>hcidump is decoding this wrong.
>
>
> and I figured out what the extra RFCOMM channel 1 on my Aiptek headphone
> does. You can simply stream the SBC files over it. The attached program
> will do this for you, but actually it only works on streams with two
> channels. I don't know what to change to support all test SBC files.
>
> Regards
>
> Marcel
>
>
>
> ------------------------------------------------------------------------
>
> /*
> *
> * Stream SBC files over RFCOMM
> *
> * Copyright (C) 2004 Marcel Holtmann <[email protected]>
> *
> *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License version 2 as
> * published by the Free Software Foundation;
> *
> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
> * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
> * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
> * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> *
> * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
> * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
> * SOFTWARE IS DISCLAIMED.
> *
> */
>
> #include <stdio.h>
> #include <errno.h>
> #include <fcntl.h>
> #include <sys/socket.h>
>
> #include <bluetooth/bluetooth.h>
> #include <bluetooth/rfcomm.h>
>
> static int rfcomm_connect(bdaddr_t *src, bdaddr_t *dst, uint8_t channel)
> {
> struct sockaddr_rc addr;
> int sk;
>
> sk = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
> if (sk < 0)
> return -1;
>
> memset(&addr, 0, sizeof(addr));
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, src);
> if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
>
> memset(&addr, 0, sizeof(addr));
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, dst);
> addr.rc_channel = channel;
> if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
> close(sk);
> return -1;
> }
>
> return sk;
> }
>
> static int stream_sbc(fd, sk)
> {
> unsigned char buf[330];
> int err, len;
>
> while (1) {
> len = read(fd, buf, sizeof(buf));
> if (len <= 0)
> break;
>
> err = write(sk, buf, len);
> if (err < 0)
> break;
> }
>
> return 0;
> }
>
> int main(int argc, char *argv[])
> {
> bdaddr_t bdaddr;
> int fd, sk;
>
> if (argc < 3) {
> fprintf(stderr, "Usage: rcplay <bdaddr> <filename>\n");
> exit(1);
> }
>
> str2ba(argv[1], &bdaddr);
>
> fd = open(argv[2], O_RDONLY);
> if (fd < 0) {
> perror("Can't open file");
> exit(1);
> }
>
> sk = rfcomm_connect(BDADDR_ANY, &bdaddr, 1);
> if (sk < 0) {
> perror("Can't open connection");
> close(fd);
> exit(1);
> }
>
> stream_sbc(fd, sk);
>
> close(sk);
> close(fd);
>
> return 0;
> }


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 21:40:06

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Henryk,

I put you in as a developer. Your code appears in the btsco cvs module
in the subdirectory "sbc" for now. The makefiles aren't linked together
at all and I'm not sure I'd make that effort. I get the feeling your
stuff ultimately belongs in the alsa lib, but if it needs to be used
outside alsa then that's not a perfect fit.

Thanks!

Brad

Henryk Pl?tz wrote:
> Moin,
>
> On Thu, 18 Nov 2004 08:26:02 -0700, Brad Midgley <[email protected]> wrote:
>
>
>>Can I put what you've given us in a module in our bluetooth-alsa
>>sourceforge cvs and make you a developer?
>
>
> Sure. My sourceforge username is henryk.
>
>
>>I think the structs you have should probably be marked as __attribute__
>>((packed)) so they don't get realigned by gcc. I'm not sure if there's a
>>portable alternative.
>
>
> Ok, will do that.
>


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 21:33:44

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > and I figured out what the extra RFCOMM channel 1 on my Aiptek headphone
> > does. You can simply stream the SBC files over it. The attached program
> > will do this for you, but actually it only works on streams with two
> > channels. I don't know what to change to support all test SBC files.
>
> Excellent!
>
> I know I did try this as the first thing when I discovered that
> channel (using rfcomm bind ..., rfcomm connect ... and cat foo.sbc >
> /dev/rfcomm0) but obviously didn't try hard enough. Your rcplay does
> work with mono files for me just fine.

I think the problem with the other approach (I also tried it) was that
the underlaying frame size is different if you connect through a TTY. I
stuck it at 330 bytes which is a DH5 minus protocol overhead.

The test files 01, 03, 05 don't work for me.

> From a rough test (I didn't compare the sound output to the reference
> decoder, just listened at it) I'd say my headphones play back the
> first 10 SBC test streams well, with the notable exception of number
> 7. So it seems that being a mono file doesn't prevent playback this
> way generically.

Do you also use the Aiptek or the BlueTake one. The Aiptek is very old
and maybe the decoder in my headphone has a bug.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 21:23:54

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > number of subbands etc. The SBC defines a lot, but not all of them can
> > be supported when we want to integrate it into ALSA. For the sink all
> > are mandatory, but for the source only some of them.
>
> Hmm, since we're dealing with a software and have quite some
> computational power the encoder will probably support any possible
> configuration. I'd just take the values from Table 4.7 on page 22 of
> the A2DP spec as a set of reasonable default values where the only
> choice left is middle vs. high quality.

from my current knowledge of ALSA we can set the frequency and the
number of channels. So supporting all 4 frequencies and mono (1 channel)
and joint stereo (2 channels) from the interface point of view is a
reasonable way? Should we really do joint stereo instead of stereo?

Any thoughts about this are welcome.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 21:20:58

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Fri, 19 Nov 2004 21:45:43 +0100, Marcel Holtmann <[email protected]> w=
rote:

> and I figured out what the extra RFCOMM channel 1 on my Aiptek headphone
> does. You can simply stream the SBC files over it. The attached program
> will do this for you, but actually it only works on streams with two
> channels. I don't know what to change to support all test SBC files.

Excellent!

I know I did try this as the first thing when I discovered that
channel (using rfcomm bind ..., rfcomm connect ... and cat foo.sbc >
/dev/rfcomm0) but obviously didn't try hard enough. Your rcplay does
work with mono files for me just fine.

>From a rough test (I didn't compare the sound output to the reference
decoder, just listened at it) I'd say my headphones play back the
first 10 SBC test streams well, with the notable exception of number
7. So it seems that being a mono file doesn't prevent playback this
way generically.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 21:06:45

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Fri, 19 Nov 2004 19:56:40 +0100, Marcel Holtmann <[email protected]> w=
rote:

> number of subbands etc. The SBC defines a lot, but not all of them can
> be supported when we want to integrate it into ALSA. For the sink all
> are mandatory, but for the source only some of them.

Hmm, since we're dealing with a software and have quite some
computational power the encoder will probably support any possible
configuration. I'd just take the values from Table 4.7 on page 22 of
the A2DP spec as a set of reasonable default values where the only
choice left is middle vs. high quality.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 20:45:43

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> actually like with the attached patch. Most of the example *.sbc files
> are working. Some of them are not working and this is maybe because the
> frame header information don't matches the SBC configuration. Or maybe
> hcidump is decoding this wrong.

and I figured out what the extra RFCOMM channel 1 on my Aiptek headphone
does. You can simply stream the SBC files over it. The attached program
will do this for you, but actually it only works on streams with two
channels. I don't know what to change to support all test SBC files.

Regards

Marcel


Attachments:
rcplay.c (2.48 kB)

2004-11-19 18:56:40

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> > What format do you think is the easiest to encode/decode?
>
> In what respect to?

number of subbands etc. The SBC defines a lot, but not all of them can
be supported when we want to integrate it into ALSA. For the sink all
are mandatory, but for the source only some of them.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 18:44:43

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

> If that looks like the right direction, I need to work on delineating
> the sbc frames inside the sbc file so i can put on the media packet
> headers and the media payload headers. Is it straightforward?

Well, from what I understand the SBC frames can greatly vary in length
and one can't know the length before unpacking the bitstream (or at
least calculating the 'bits' array). That's why my code works like it
does: the sbc_unpack_frame() returns the length of the frame that it
just unpacked so the calling code can know how many bytes to skip.

There should be a correlation between the bitpool value used and the
length of the frame, but I didn't look into this. Even then one would
have to parse the frame header to know what parameters have actually
been used and calculate the length based on that.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 18:38:44

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Fri, 19 Nov 2004 00:59:28 +0100, Marcel Holtmann <[email protected]> w=
rote:

> I just tested it and the result so far is very great. Keep on working on
> it.

Thanks. I'm getting more and more confident in that my bitstream
decoding is correct, but I can't seem to get the synthesis done. I got
me some books on compression from the library and read the chapters
about subband coding, but they basically said what I knew (or figured)
anyways.

> What format do you think is the easiest to encode/decode?

In what respect to?=20

> And btw your file creation should be this command:
> fh =3D open("bla_.au", O_WRONLY|O_CREAT|O_TRUNC, 0644);

Ahh, thanks. I had wondered why it kept doing funny things, but didn't
investigate further.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 18:32:54

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Thu, 18 Nov 2004 08:26:02 -0700, Brad Midgley <[email protected]> wr=
ote:

> Can I put what you've given us in a module in our bluetooth-alsa
> sourceforge cvs and make you a developer?

Sure. My sourceforge username is henryk.

> I think the structs you have should probably be marked as __attribute__
> ((packed)) so they don't get realigned by gcc. I'm not sure if there's a
> portable alternative.

Ok, will do that.

--=20
Henryk Pl=F6tz
Gr=FC=DFe aus Berlin


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 17:39:19

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> > I still have to break the stream into chunks and put the payload header
> > on them (a2dp p.24).
>
> but the boundary don't cares. I see that in the trace. You can break the
> SBC file where you want and add the media header.

actually like with the attached patch. Most of the example *.sbc files
are working. Some of them are not working and this is maybe because the
frame header information don't matches the SBC configuration. Or maybe
hcidump is decoding this wrong.

Regards

Marcel


Attachments:
patch (2.34 kB)

2004-11-19 16:53:19

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> > So what I think is that you can simply put the header and the other two
> > bytes into a L2CAP packet and then add as much data from the SBC file as
> > the MTU allows.
> >
> > If the SBC frame header is always repeated I don't understand why we
> > need to set a specific SBC configuration with AVDTP.
>
> I still have to break the stream into chunks and put the payload header
> on them (a2dp p.24).

but the boundary don't cares. I see that in the trace. You can break the
SBC file where you want and add the media header.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 16:35:15

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

> So what I think is that you can simply put the header and the other two
> bytes into a L2CAP packet and then add as much data from the SBC file as
> the MTU allows.
>
> If the SBC frame header is always repeated I don't understand why we
> need to set a specific SBC configuration with AVDTP.

I still have to break the stream into chunks and put the payload header
on them (a2dp p.24).

I'm almost there but now I need to figure out how to find sbc frame
boundaries in the file. Henryk? :)

Brad


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 11:41:24

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> I cleaned up the bitfields for the avdtp packets and committed it...
>
> Do you think this looks right for covering the header on avdtp page 45?
>
> // remember htobs() for converting from host to bluetooth byte ordering
> // when putting data in this struct
> typedef struct {
> uint8_t v:2;
> uint8_t p:1;
> uint8_t x:1;
> uint8_t cc:4;
> uint8_t m:1;
> uint8_t pt:7;
> uint16_t sequence_number;
> uint32_t timestamp;
> uint32_t ssrc;
> uint32_t csrc[0];
> } __attribute__ ((packed)) media_packet_header;
>
> If that looks like the right direction, I need to work on delineating
> the sbc frames inside the sbc file so i can put on the media packet
> headers and the media payload headers. Is it straightforward?

this looks ok to me. From the trace of my Aiptek set I saw that these
header is filled with the following values:

0x80 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

So they only use the sequence number and nothing more. The next two
bytes are always 0xff 0xff and then the payload differs. After that I
see the 0x9c sync byte from the SBC file.

So what I think is that you can simply put the header and the other two
bytes into a L2CAP packet and then add as much data from the SBC file as
the MTU allows.

If the SBC frame header is always repeated I don't understand why we
need to set a specific SBC configuration with AVDTP.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-19 09:03:29

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

I cleaned up the bitfields for the avdtp packets and committed it...

Do you think this looks right for covering the header on avdtp page 45?

// remember htobs() for converting from host to bluetooth byte ordering
// when putting data in this struct
typedef struct {
uint8_t v:2;
uint8_t p:1;
uint8_t x:1;
uint8_t cc:4;
uint8_t m:1;
uint8_t pt:7;
uint16_t sequence_number;
uint32_t timestamp;
uint32_t ssrc;
uint32_t csrc[0];
} __attribute__ ((packed)) media_packet_header;

If that looks like the right direction, I need to work on delineating
the sbc frames inside the sbc file so i can put on the media packet
headers and the media payload headers. Is it straightforward?

Brad

Marcel Holtmann wrote:
> Hi Henryk,
>
>
>>I'm currently working (more or less; more less than more) on SBC and
>>trying to do a decoder first because I figure that would be easier
>>(because I know what the result is supposed to look like). I have
>>problems synthesizing the PCM audio samples but can parse all of the
>>example SBC streams just fine.
>>
>>I'll attach what I have now. The sbc-test.c currently dumps subband
>>samples on stdout for testing, so just redirect that to /dev/null. The decoded
>>frame headers are written to stderr.
>
>
> I just tested it and the result so far is very great. Keep on working on
> it. What format do you think is the easiest to encode/decode?
>
> And btw your file creation should be this command:
>
> fh = open("bla_.au", O_WRONLY|O_CREAT|O_TRUNC, 0644);
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-18 23:59:28

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Henryk,

> I'm currently working (more or less; more less than more) on SBC and
> trying to do a decoder first because I figure that would be easier
> (because I know what the result is supposed to look like). I have
> problems synthesizing the PCM audio samples but can parse all of the
> example SBC streams just fine.
>
> I'll attach what I have now. The sbc-test.c currently dumps subband
> samples on stdout for testing, so just redirect that to /dev/null. The decoded
> frame headers are written to stderr.

I just tested it and the result so far is very great. Keep on working on
it. What format do you think is the easiest to encode/decode?

And btw your file creation should be this command:

fh = open("bla_.au", O_WRONLY|O_CREAT|O_TRUNC, 0644);

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-18 19:11:41

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> Can I put what you've given us in a module in our bluetooth-alsa
> sourceforge cvs and make you a developer?

please do this for now. Later on I think we have to move some stuff back
into the BlueZ CVS.

And guys, please change your coding style ;)

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-18 15:26:02

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Henryk,

> I'm currently working (more or less; more less than more) on SBC

Great! Marcel and I don't have a lot of confidence in taking on sbc.

Can I put what you've given us in a module in our bluetooth-alsa
sourceforge cvs and make you a developer?

I think the structs you have should probably be marked as __attribute__
((packed)) so they don't get realigned by gcc. I'm not sure if there's a
portable alternative.

Brad


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-18 13:27:26

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Moin,

On Wed, 17 Nov 2004 08:47:30 -0700, Brad Midgley <[email protected]> wrote:

> You noticed I have code to open and send a stream. When I send the
> reference sbc streams byte-for-byte, I can hear a signal mixed with a
> lot of noise. But then I don't know what the sbc parameters were for any
> of the reference streams. Maybe it would just work if I knew that.

I'm currently working (more or less; more less than more) on SBC and
trying to do a decoder first because I figure that would be easier
(because I know what the result is supposed to look like). I have
problems synthesizing the PCM audio samples but can parse all of the
example SBC streams just fine.

I'll attach what I have now. The sbc-test.c currently dumps subband
samples on stdout for testing, so just redirect that to /dev/null. The decoded
frame headers are written to stderr.

--
Henryk Pl?tz
Gr??e aus Berlin


Attachments:
(No filename) (896.00 B)
sbc-20041118.tar.bz2 (6.90 kB)
Download all attachments

2004-11-17 20:01:56

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> > struct sbc_frame_header {
> > uint8_t syncword:8; /* Sync word */
> > uint8_t subbands:1; /* Subbands */
> > uint8_t allocation_method:1; /* Allocation method */
> > uint8_t channel_mode:2; /* Channel mode */
> > uint8_t blocks:2; /* Blocks */
> > uint8_t sampling_frequency:2; /* Sampling frequency */
> > uint8_t bitpool:8; /* Bitpool */
> > uint8_t crc_check:8; /* CRC check */
> > } __attribute__ ((packed));
>
> I tried reading this from the header but I get nonsensical results like
> "3" for frequency. Only one bit is supposed to be specified in fields
> like frequency, so the headset (rightly) rejects the set_config.

I think you have to convert it first. I don't know why the SBC example
files have this header. From my sniffs of the AVDTP media channel I
haven't seen this header data anywhere. So it is somekind of SBC file
format. Try this conversion:

static char *sf2str(uint8_t sf)
{
switch (sf) {
case 0:
return "16 kHz";
case 1:
return "32 kHz";
case 2:
return "44.1 kHz";
case 3:
return "48 kHz";
}
}

static char *cm2str(uint8_t cm)
{
switch (cm) {
case 0:
return "Mono";
case 1:
return "Dual channel";
case 2:
return "Stereo";
case 3:
return "Joint stereo";
}
}

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-17 19:52:18

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel,

> struct sbc_frame_header {
> uint8_t syncword:8; /* Sync word */
> uint8_t subbands:1; /* Subbands */
> uint8_t allocation_method:1; /* Allocation method */
> uint8_t channel_mode:2; /* Channel mode */
> uint8_t blocks:2; /* Blocks */
> uint8_t sampling_frequency:2; /* Sampling frequency */
> uint8_t bitpool:8; /* Bitpool */
> uint8_t crc_check:8; /* CRC check */
> } __attribute__ ((packed));

I tried reading this from the header but I get nonsensical results like
"3" for frequency. Only one bit is supposed to be specified in fields
like frequency, so the headset (rightly) rejects the set_config.

i committed it to cvs

brad


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-11-17 15:52:33

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> You noticed I have code to open and send a stream. When I send the
> reference sbc streams byte-for-byte, I can hear a signal mixed with a
> lot of noise. But then I don't know what the sbc parameters were for any
> of the reference streams. Maybe it would just work if I knew that.
>
> The reference decoder does not report the sbc parameters and I'm only
> assuming that they have broken up the data and wrapped it in media
> packet headers and sbc headers for a conservative mtu. The reference
> encoder/decoder is undocumented and I didn't figure out how to set
> parameters in the encoder. I don't want to spend any more time trying to
> figure out the reference stuff.

the reference encoder/decoder has some command line options. You will
find them in "A2DP Test v10.pdf". The file format of the *.sbc is also
somewhere described. However I couldn't find it right now, but every
file contains a number of frames and all of them with a SBC header:

struct sbc_frame_header {
uint8_t syncword:8; /* Sync word */
uint8_t subbands:1; /* Subbands */
uint8_t allocation_method:1; /* Allocation method */
uint8_t channel_mode:2; /* Channel mode */
uint8_t blocks:2; /* Blocks */
uint8_t sampling_frequency:2; /* Sampling frequency */
uint8_t bitpool:8; /* Bitpool */
uint8_t crc_check:8; /* CRC check */
} __attribute__ ((packed));


Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-17 15:47:30

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

You noticed I have code to open and send a stream. When I send the
reference sbc streams byte-for-byte, I can hear a signal mixed with a
lot of noise. But then I don't know what the sbc parameters were for any
of the reference streams. Maybe it would just work if I knew that.

The reference decoder does not report the sbc parameters and I'm only
assuming that they have broken up the data and wrapped it in media
packet headers and sbc headers for a conservative mtu. The reference
encoder/decoder is undocumented and I didn't figure out how to set
parameters in the encoder. I don't want to spend any more time trying to
figure out the reference stuff.

I guess the next step for me is to put together some kind of basic
encoder and try to send over something simple like a square wave.

Brad


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-15 08:24:54

by Sebastien

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Brad Midgley wrote:
> Does anyone have a cached copy of assigned-numbers.htm? It's extremely
> frustrating to have all these pointers to a web page
> (http://www.bluetooth.org/assigned-numbers.htm) that won't resolve.

you can acces to assigned numbers with this web page
http://www.bluetooth.org/assigned-numbers/
(I think that is what you are looking for)

Regards
Sebastien



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-14 15:29:32

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> Argh... I'm stuck again. the avdtp_set_configuration command goes out
> but reading the response just blocks. I'm not sure what is wrong... I send:
>
> 00 -> header = request
> 03 -> AVDTP_SET_CONFIGURATION
> 04 -> acp_seid = 1
> 04 -> int_seid = 1 (how should I choose the int_seid?)
> 01 -> service category = media transport
> 00 -> length of service capabilities = 0
> 07 -> capability type = media codec
> 06 -> bytes remaining? not sure if this is right.
> 00 -> media type = audio media type
> 00 -> media codec type = SBC
> 22 -> 44.1khz stereo
> 15 -> 16-byte blocks, 8 subbands, "loudness" allocation
> 02 -> min bitpool
> fa -> max bitpool

I think you really need to fill in the transaction number in the header
byte. So it should be 0x00, 0x10, 0x20, 0x30 etc.

The bytes remaining value is right.

>>From sniffing the connection between the sender and receiver of my
Aiptek devices I see that they use 0x22 0x46 for the SBC setting. And
this is 44.1kHz, stereo, blocklen 64, 8 subbands, SNR if I decoded it
correct.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-14 07:54:13

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

Argh... I'm stuck again. the avdtp_set_configuration command goes out
but reading the response just blocks. I'm not sure what is wrong... I send:

00 -> header = request
03 -> AVDTP_SET_CONFIGURATION
04 -> acp_seid = 1
04 -> int_seid = 1 (how should I choose the int_seid?)
01 -> service category = media transport
00 -> length of service capabilities = 0
07 -> capability type = media codec
06 -> bytes remaining? not sure if this is right.
00 -> media type = audio media type
00 -> media codec type = SBC
22 -> 44.1khz stereo
15 -> 16-byte blocks, 8 subbands, "loudness" allocation
02 -> min bitpool
fa -> max bitpool

a2play.c in cvs contains the code I'm trying...

Brad

Marcel Holtmann wrote:
> Hi Brad,
>
>
>>>>The accept looks like this byte-for-byte:
>>>>
>>>>02 -> response accept
>>>>02 -> AVDT_GET_CAPABILITIES
>>>>01 -> category = media transport
>>>>00 -> length of service capabilities = 0
>>>>07 -> 7 'elements' follow
>>>>06 -> elements[0]
>>>>00 ->
>>>>00 ->
>>>>ff ->
>>>>ff ->
>>>>02 ->
>>>>fa -> elements[6]
>>
>>>this should be the codec specific part. Look at A2DP for more details.
>>
>>It doesn't totally seem to match up. The last 4 bytes seem to be the
>>capabilities of SBC (p.20 of a2dp)
>>
>>ff -> supports all sampling frequencies, channel modes
>>ff -> supports all block lengths, subbands, allocation methods
>>02 -> minimum bitpool val
>>fa -> max bitpool val
>>
>>I can't find where the first 06, 00, 00 fit. Also, does the seid=1 in
>>the avdtp_discover accept correspond to only supporting SBC? I wasn't
>>expecting to know the supported codecs until after the first
>>avdt_get_capabilities.
>
>
> I looked it up and the GET_CAPABILITIES response you get back contains
> two block. The first is the "media transport" with 0 bytes of additional
> information and the second is the "media codec" part with 6 bytes of
> codec specific information.
>
> 0x01 = media transport
> 0x07 = media codec
>
> The first 0x00 represents the "media type" and the second the "media
> codec type". And this means "audio" and "SBC". And the rest is SBC
> specific as you already recognized.
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-13 13:06:38

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> >>The accept looks like this byte-for-byte:
> >>
> >>02 -> response accept
> >>02 -> AVDT_GET_CAPABILITIES
> >>01 -> category = media transport
> >>00 -> length of service capabilities = 0
> >>07 -> 7 'elements' follow
> >>06 -> elements[0]
> >>00 ->
> >>00 ->
> >>ff ->
> >>ff ->
> >>02 ->
> >>fa -> elements[6]
>
> > this should be the codec specific part. Look at A2DP for more details.
>
> It doesn't totally seem to match up. The last 4 bytes seem to be the
> capabilities of SBC (p.20 of a2dp)
>
> ff -> supports all sampling frequencies, channel modes
> ff -> supports all block lengths, subbands, allocation methods
> 02 -> minimum bitpool val
> fa -> max bitpool val
>
> I can't find where the first 06, 00, 00 fit. Also, does the seid=1 in
> the avdtp_discover accept correspond to only supporting SBC? I wasn't
> expecting to know the supported codecs until after the first
> avdt_get_capabilities.

I looked it up and the GET_CAPABILITIES response you get back contains
two block. The first is the "media transport" with 0 bytes of additional
information and the second is the "media codec" part with 6 bytes of
codec specific information.

0x01 = media transport
0x07 = media codec

The first 0x00 represents the "media type" and the second the "media
codec type". And this means "audio" and "SBC". And the rest is SBC
specific as you already recognized.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-13 03:13:05

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

>>The accept looks like this byte-for-byte:
>>
>>02 -> response accept
>>02 -> AVDT_GET_CAPABILITIES
>>01 -> category = media transport
>>00 -> length of service capabilities = 0
>>07 -> 7 'elements' follow
>>06 -> elements[0]
>>00 ->
>>00 ->
>>ff ->
>>ff ->
>>02 ->
>>fa -> elements[6]

> this should be the codec specific part. Look at A2DP for more details.

It doesn't totally seem to match up. The last 4 bytes seem to be the
capabilities of SBC (p.20 of a2dp)

ff -> supports all sampling frequencies, channel modes
ff -> supports all block lengths, subbands, allocation methods
02 -> minimum bitpool val
fa -> max bitpool val

I can't find where the first 06, 00, 00 fit. Also, does the seid=1 in
the avdtp_discover accept correspond to only supporting SBC? I wasn't
expecting to know the supported codecs until after the first
avdt_get_capabilities.

Does anyone have a cached copy of assigned-numbers.htm? It's extremely
frustrating to have all these pointers to a web page
(http://www.bluetooth.org/assigned-numbers.htm) that won't resolve.

Brad


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-13 00:38:57

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> My a2play.c (committed to cvs btw) opens the l2cap socket and exchanges
> a couple of messages with the bt420n before I have reached something I
> don't know how to interpret:
>
> send avdtp_discover
> receive avdtp_discover accept, seid=1
> send avdt_get_capabilities for seid=1
> receive avdt_get_capabilities accept
>
> The accept looks like this byte-for-byte:
>
> 02 -> response accept
> 02 -> AVDT_GET_CAPABILITIES
> 01 -> category = media transport
> 00 -> length of service capabilities = 0
> 07 -> 7 'elements' follow
> 06 -> elements[0]
> 00 ->
> 00 ->
> ff ->
> ff ->
> 02 ->
> fa -> elements[6]
>
> The avdt spec drops off sharply around page 86 when talking about what
> comes after the service capabilities length. Any ideas of what to make
> of the elements?

this should be the codec specific part. Look at A2DP for more details.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-12 23:13:55

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

>>>bug as far as I know. However you don't need this, because it is always
>>>PSM 25 and my sender device simply only looks if a A2DP sink is present
>>>or not.

My a2play.c (committed to cvs btw) opens the l2cap socket and exchanges
a couple of messages with the bt420n before I have reached something I
don't know how to interpret:

send avdtp_discover
receive avdtp_discover accept, seid=1
send avdt_get_capabilities for seid=1
receive avdt_get_capabilities accept

The accept looks like this byte-for-byte:

02 -> response accept
02 -> AVDT_GET_CAPABILITIES
01 -> category = media transport
00 -> length of service capabilities = 0
07 -> 7 'elements' follow
06 -> elements[0]
00 ->
00 ->
ff ->
ff ->
02 ->
fa -> elements[6]

The avdt spec drops off sharply around page 86 when talking about what
comes after the service capabilities length. Any ideas of what to make
of the elements?

Brad

btw, I did have code in there to be totally sure I had drained off all
the avdtp_discovery accept packets. Currently the code assumes it will
only get one seid. The code gets ugly when I try to make it more
generic. A nonblocking read would help but I haven't figured out how to
get that.


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. http://www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-10 18:57:35

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Bard,

> > bug as far as I know. However you don't need this, because it is always
> > PSM 25 and my sender device simply only looks if a A2DP sink is present
> > or not.
>
> have you coded up something basic already? could I have a look at it as
> a starting point? (this is all very new)

I haven't written any code yet. I only used sdptool, l2test and hcidump.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-10 18:01:55

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel,

> bug as far as I know. However you don't need this, because it is always
> PSM 25 and my sender device simply only looks if a A2DP sink is present
> or not.

have you coded up something basic already? could I have a look at it as
a starting point? (this is all very new)

thanks
Brad


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-10 08:47:10

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> > I think you should start with a simple test implementation in user space
> > that fulfils your purpose. I haven't understand the AVDTP enough to move
> > any part of it into the kernel at the moment.
>
> The avdtp document is almost 150 pages long and very terse! It looks to
> me like I start with sdp to find the avdtp psm, open it with raw l2cap,
> then do stream endpoint discovery and get capabilities, set stream
> config, open the l2cap stream psm and send the stream. I am planning to
> write an app that sends one of the reference sbc streams.

no need to search for the PSM via a SDP request. It is always PSM 25, so
you can simply skip this like we do for RFCOMM. Open it with a raw L2CAP
socket is wrong, because this gives you only access to the L2CAP signal
channel. Simply open it with SOCK_SEQPACKET and send the AVDTP commands
on it. Before you start streaming you must open another L2CAP channel on
PSM 25. There are no different PSMs like for HID or HCRP. It took me
some time to understand this and actually at that time I never realized
that this is even possible, but we already support it ;)

> What should the sdp search look like? The more promising sdptool options
> I found didn't work flawlessly... I'm assuming 0x110d is A2DP and 0x19
> is AVDTP (http://www.bluetooth.org/assigned-numbers.htm redirects to
> http://www.bluetoothsig.org/assigned-numbers/ which won't resolve). What
> is the uint16 under AVDTP trying to tell us?

The CVS version of sdptool should be able to decode everything A2DP and
AVDTP related. I think the uint16 for AVDTP shouldn't be there. It is a
bug as far as I know. However you don't need this, because it is always
PSM 25 and my sender device simply only looks if a A2DP sink is present
or not.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-10 05:46:51

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

[avdtp]
> This was not what I meant. You must open the signal channel first and
> then open the media channel. This is the basic mode.
>
>>I don't know where to start with the avdtp protocol handling. Can you
>>give me a pointer?
>
> I think you should start with a simple test implementation in user space
> that fulfils your purpose. I haven't understand the AVDTP enough to move
> any part of it into the kernel at the moment.

The avdtp document is almost 150 pages long and very terse! It looks to
me like I start with sdp to find the avdtp psm, open it with raw l2cap,
then do stream endpoint discovery and get capabilities, set stream
config, open the l2cap stream psm and send the stream. I am planning to
write an app that sends one of the reference sbc streams.

What should the sdp search look like? The more promising sdptool options
I found didn't work flawlessly... I'm assuming 0x110d is A2DP and 0x19
is AVDTP (http://www.bluetooth.org/assigned-numbers.htm redirects to
http://www.bluetoothsig.org/assigned-numbers/ which won't resolve). What
is the uint16 under AVDTP trying to tell us?

sdptool search --bdaddr 00:08:F4:30:05:BB 0x110d
Class 0x110D
Searching for 0x110d on 00:08:F4:30:05:BB ...
Service Name: Audio Sink
Service RecHandle: 0x10002
Service Class ID List:
"" (0x110b)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"" (0x0019)
uint16: 0x0
Profile Descriptor List:
"" (0x110d)
Version: 0x0100

Brad


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-07 21:33:44

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> > I looked a little bit into ALSA and actually what we really need is the
> > support in the ALSA library for understanding SBC. So the kernel don't
> > has to worry about it.
>
> good, so it's an alsa project. :)
>
> in the perfect world, you should be able to hand an mp3 over to a
> userspace library that only transcodes into SBC if the headset does not
> advertise its own mp3 codec. same with aac. avoiding the transcode would
> be good for reducing latency and preserving batteries on a portable
> player. it may be academic if none of the headsets implement optional
> codecs.

it is not really an ALSA project, but from my understanding it is the
best way to go. We must extend the ALSA kernel part to allow a PCM with
the type SBC and then expect from the library to do the rest for us.

And yes, if there are headphones with MP3 or any other codec in their
endpoint list, then we should use a native one. Actually as far as I got
through the ALSA code we simply set what we support and then the rest is
done automatically by the library.

> > In general yes, but the AVDTP is crap. It needs at least two L2CAP
> > channels on PSM 25.
>
> it may be ugly, but it's all we've got, eh?

This was not what I meant. You must open the signal channel first and
then open the media channel. This is the basic mode.

> > I saw that too and actually I don't know what is it good for. Maybe you
> > wanna try to connect it to a TTY and then copy the SBC files into it.
>
> I copied a few of the sbc streams. They resulted in a whole lot of
> static on the headset. I think we need to tell the headset we're using
> avdtp and get that media packet header in there.

Don't ask me. I don't know what this RFCOMM channel is for.

> I don't know where to start with the avdtp protocol handling. Can you
> give me a pointer?

I think you should start with a simple test implementation in user space
that fulfils your purpose. I haven't understand the AVDTP enough to move
any part of it into the kernel at the moment.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-07 18:55:59

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel

>>What I wanted to do was start by using the reference SBC codec or just
>>one of the reference streams (cleverly hidden in the *zipfile*
>>A2DP_TS.pdf at bluetooth.org) and then experiment with sending it to the
>>headset.
>
> I looked a little bit into ALSA and actually what we really need is the
> support in the ALSA library for understanding SBC. So the kernel don't
> has to worry about it.

good, so it's an alsa project. :)

in the perfect world, you should be able to hand an mp3 over to a
userspace library that only transcodes into SBC if the headset does not
advertise its own mp3 codec. same with aac. avoiding the transcode would
be good for reducing latency and preserving batteries on a portable
player. it may be academic if none of the headsets implement optional
codecs.

>>I'm looking at the diagram on p. 17 of the A2DP spec... it looks like
>>the AVDTP layer takes the encoded stream, breaks it up and puts the
>>media packet headers on it. Is that right?
>
>
> In general yes, but the AVDTP is crap. It needs at least two L2CAP
> channels on PSM 25.

it may be ugly, but it's all we've got, eh?

>>I am a little confused about this though... does this show the A2DP sink
>>as using the rfcomm protocol?
>>
>>$ sdptool search --bdaddr 00:08:F4:30:05:BB 0x1101
>>Class 0x1101
>>Searching for 0x1101 on 00:08:F4:30:05:BB ...
>>Service Name: Audio Sink
>>Service RecHandle: 0x10005
>>Service Class ID List:
>> "Serial Port" (0x1101)
>>Protocol Descriptor List:
>> "L2CAP" (0x0100)
>> "RFCOMM" (0x0003)
>> Channel: 1
>
>
> I saw that too and actually I don't know what is it good for. Maybe you
> wanna try to connect it to a TTY and then copy the SBC files into it.

I copied a few of the sbc streams. They resulted in a whole lot of
static on the headset. I think we need to tell the headset we're using
avdtp and get that media packet header in there.

I don't know where to start with the avdtp protocol handling. Can you
give me a pointer?

Brad


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-07 16:54:22

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> What I wanted to do was start by using the reference SBC codec or just
> one of the reference streams (cleverly hidden in the *zipfile*
> A2DP_TS.pdf at bluetooth.org) and then experiment with sending it to the
> headset.

I looked a little bit into ALSA and actually what we really need is the
support in the ALSA library for understanding SBC. So the kernel don't
has to worry about it.

> I'm looking at the diagram on p. 17 of the A2DP spec... it looks like
> the AVDTP layer takes the encoded stream, breaks it up and puts the
> media packet headers on it. Is that right?

In general yes, but the AVDTP is crap. It needs at least two L2CAP
channels on PSM 25.

> I am a little confused about this though... does this show the A2DP sink
> as using the rfcomm protocol?
>
> $ sdptool search --bdaddr 00:08:F4:30:05:BB 0x1101
> Class 0x1101
> Searching for 0x1101 on 00:08:F4:30:05:BB ...
> Service Name: Audio Sink
> Service RecHandle: 0x10005
> Service Class ID List:
> "Serial Port" (0x1101)
> Protocol Descriptor List:
> "L2CAP" (0x0100)
> "RFCOMM" (0x0003)
> Channel: 1

I saw that too and actually I don't know what is it good for. Maybe you
wanna try to connect it to a TTY and then copy the SBC files into it.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-07 16:34:36

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Marcel,

What I wanted to do was start by using the reference SBC codec or just
one of the reference streams (cleverly hidden in the *zipfile*
A2DP_TS.pdf at bluetooth.org) and then experiment with sending it to the
headset.

I'm looking at the diagram on p. 17 of the A2DP spec... it looks like
the AVDTP layer takes the encoded stream, breaks it up and puts the
media packet headers on it. Is that right?

I am a little confused about this though... does this show the A2DP sink
as using the rfcomm protocol?

$ sdptool search --bdaddr 00:08:F4:30:05:BB 0x1101
Class 0x1101
Searching for 0x1101 on 00:08:F4:30:05:BB ...
Service Name: Audio Sink
Service RecHandle: 0x10005
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1

Brad

Marcel Holtmann wrote:
> Hi Brad,
>
>
>>Is AVDTP complete enough to pass data around? When I try to create a socket
>>
>>socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_AVDTP)
>>
>>perror gave me "Protocol not supported." Is this the right way to get an
>>AVDTP socket?
>
>
> there is no AVDTP in the kernel. The only thing I did, was to reserve a
> protocol number for it when it was clear to me that this code should run
> inside the kernel.
>
> However what we really need first is an open source implementation of
> the SBC codec. I am not an audio expert and so I am a little bit lost
> here.
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel

2004-11-07 12:27:29

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] AVDTP socket?

Hi Brad,

> Is AVDTP complete enough to pass data around? When I try to create a socket
>
> socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_AVDTP)
>
> perror gave me "Protocol not supported." Is this the right way to get an
> AVDTP socket?

there is no AVDTP in the kernel. The only thing I did, was to reserve a
protocol number for it when it was clear to me that this code should run
inside the kernel.

However what we really need first is an open source implementation of
the SBC codec. I am not an audio expert and so I am a little bit lost
here.

Regards

Marcel




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel/listinfo/bluez-devel