Skip to contentSkip to conversation

a2play code that is working

Bluez-devel Mayank Batra 3 participants 6 messages Apr 26, 2005 1 message not in the archive Bluetooth drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Brad,

Quoted 3 lines

There is sometimes a delay before cvs gets updated by sourceforge. I had
made those changes to sbc.h

Are you sure it will be ok if we change the sbc.h and sbc.c files ?
Because then the other applications making use of the sbc encoder will also have to change accordingly...??

I mean it is ok for a2dp applications, but what about others...??

Mayank

Quoted 36 lines
Quoted 7 lines · Mayank Batra

Brad,

I tried the code from the CVS.

It was not compiling.

Reason is that you have changed the no. of

parameters

Quoted 1 line

being passed through sbc_encode(). But in sbc.h

the

Quoted 3 lines

declaration is different.

So I have made a new file called sbc_a2dp.h which

now

Quoted 4 lines

contains the new declaration.

Also we will have to include the file sbc_a2dp.c because the sbc.c file contains the old definition

of

Quoted 1 line

sbc_encode(). Now since the definintion has

changed I

Quoted 1 line

have made a new file called sbc_a2dp.c which we

will

Quoted 1 line

have to include in the a2play.c file. I know that

it

Quoted 9 lines

is not good to include .c files in the code... but can't help it.

If you have a better way out, please tell me.

Put the sbc_a2play.h and sbc_a2play.c files in the sbc/ folder.

After making the above files and including

sbc_a2dp.h

Quoted 19 lines
Quoted 1 line

and sbc_a2dp.c files in the a2play.c file, then

the

Quoted 3 lines

compilation is taking place fine.

Please note that after including the sbc_a2dp.h

and

Quoted 1 line

sbc_a2dp.c files in the a2play.c file you should

not

Quoted 10 lines

give -lsbc during compilation.

I am not sending the patch once again. Please bear with me.

Thanks.

Mayank

________________________________________________________________________

Quoted 7 lines
Quoted 1 line

Yahoo! India Matrimony: Find your life partner

online

Quoted 4 lines

Go to: http://yahoo.shaadi.com/india-matrimony

------------------------------------------------------------------------

Quoted 8 lines
Quoted 4 lines

/*
* a2play.c
* experimenting with sending a2dp audio to a

headset

Quoted 2 lines

* Brad Midgley
*

*************************************************************************************

Quoted 101 lines
Quoted 1 line

* Mayank Batra <[email protected]> (Added

real time SBC encoding while streaming)

Quoted 3 lines

* Abhinav Mathur <[email protected]>
*
* This program is free software; you can

redistribute it and/or modify

Quoted 1 line

* it under the terms of the GNU General Public

License as published by

Quoted 1 line

* the Free Software Foundation; either version

2 of the License, or

Quoted 3 lines

* (at your option) any later version.
*
* This program is distributed in the hope that

it will be useful,

Quoted 1 line

* but WITHOUT ANY WARRANTY; without even the

implied warranty of

Quoted 1 line

* MERCHANTABILITY or FITNESS FOR A PARTICULAR

PURPOSE. See the

Quoted 3 lines

* GNU General Public License for more details.
*
* You should have received a copy of the GNU

General Public License

Quoted 1 line

* along with this program; if not, write to the

Free Software

Quoted 1 line

* Foundation, Inc., 59 Temple Place, Suite 330,

Boston, MA 02111-1307 USA

Quoted 24 lines

*
*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <signal.h>
#include <string.h>
#include <sys/socket.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>

Quoted 3 lines

#include <netinet/in.h>

/* This is because we have changed the declaration

of sbc_encode */

Quoted 2 lines

#include "sbc/sbc_a2dp.h"
/* This is because we have changed the definition

of sbc_encode */

Quoted 1 line

#include "sbc/sbc_a2dp.c" //Even though it is not

good to do so

Quoted 1 line

/* So, we do not want to use the sbc.h and sbc.c

files as they contain the old definition and
declaration */

Quoted 33 lines

/* AVDTP structures */

/* packet components */

struct avdtp_header {
	uint8_t packet_type:2;
	uint8_t message_type:2;
	uint8_t transaction_label:4;
	uint8_t signal_id:6;
	uint8_t rfa0:2;
} __attribute__ ((packed));
struct acp_seid_info {
	uint8_t rfa0:1;
	uint8_t inuse0:1;
	uint8_t acp_seid:6;
	uint8_t rfa2:3;
	uint8_t tsep:1;
	uint8_t media_type:4;
} __attribute__ ((packed));
struct sbc_codec_specific_elements {
	// a2dp p. 20
	uint8_t channel_mode:4;
	uint8_t frequency:4;
	uint8_t allocation_method:2;
	uint8_t subbands:2;
	uint8_t block_length:4;
	uint8_t min_bitpool;
	uint8_t max_bitpool;
} __attribute__ ((packed));
Quoted 2 lines

#define MAX_ADDITIONAL_CODEC 4
#define MAX_ADDITIONAL_CODEC_OCTETS

(MAX_ADDITIONAL_CODEC*sizeof(struct acp_seid_info))

Quoted 3 lines

/* packets */

Quoted 13 lines
Quoted 7 lines
struct sepd_req {
	struct avdtp_header header;
} __attribute__ ((packed));
struct sepd_resp {
	struct avdtp_header header;
	struct acp_seid_info infos[1 +

MAX_ADDITIONAL_CODEC];

Quoted 4 lines

} __attribute__ ((packed));

struct getcap_req {
	struct avdtp_header header;

=== message truncated ===

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony

-------------------------------------------------------
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://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#2 lore raw

Hi Mayank,

Quoted 8 lines
Quoted 3 lines

There is sometimes a delay before cvs gets updated by sourceforge. I had
made those changes to sbc.h

Are you sure it will be ok if we change the sbc.h and sbc.c files ?
Because then the other applications making use of the sbc encoder will also have to change accordingly...??

there is no official SBC library release yet and so there is no problem at all. For the pcm_a2dp plugin I copied the SBC code.

However I don't agree with these changes and you should never do a library change together with the application change. Always make it two different change sets. This is easier for tracking and I actually missed that you changed the SBC library.

Now commenting on the change itself. The "struct sbc_frame_header" should not placed inside the sbc.h header file. This is the API interface and we don't need a definition of the SBC file format there. If you wanna modify the additional SBC parameters add them to sbc_struct and set them there. Please fix this.

Also a library should not use printf() at all. Remove them and improve the return values to match -ENOMEM etc.

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://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw

Marcel

Quoted 8 lines

Now commenting on the change itself. The "struct sbc_frame_header" should not placed inside the sbc.h header file. This is the API interface and we don't need a definition of the SBC file format there. If you wanna modify the additional SBC parameters add them to sbc_struct and set them there. Please fix this.

Also a library should not use printf() at all. Remove them and improve the return values to match -ENOMEM etc.

I will clean this up (I was being lazy and rolling in submissions without reworking them enough)

Brad

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw

Marcel,

How about if I move the declaration for struct sbc_frame into sbc.h and change that last argument to sbc_encode to be an sbc_frame *

We wouldn't expose the data in the private struct, but just reuse the struct for communicating sbc info back to the caller...

Brad

Quoted 5 lines

I will clean this up (I was being lazy and rolling in submissions without reworking them enough)

Brad

Quoted 9 lines

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#5 lore raw

Hi Brad,

Quoted 5 lines

How about if I move the declaration for struct sbc_frame into sbc.h and change that last argument to sbc_encode to be an sbc_frame *

We wouldn't expose the data in the private struct, but just reuse the struct for communicating sbc info back to the caller...

this is a bad idea, because then we can never change the internals of the decoder/encoder. One of the goals should be to get a SBC codec that uses only integer operation.

The sbc_struct already contains "rate" and "channels" and we should simply add the rest of them. I was do lazy to do in the first place and actually because I had no use for them.

Regards

Marcel

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw

ok, I will add the parameters to sbc_struct.

Quoted 23 lines · Marcel Holtmann

Hi Brad,

Quoted 3 lines

How about if I move the declaration for struct sbc_frame into sbc.h and change that last argument to sbc_encode to be an sbc_frame *

We wouldn't expose the data in the private struct, but just reuse the struct for communicating sbc info back to the caller...

this is a bad idea, because then we can never change the internals of the decoder/encoder. One of the goals should be to get a SBC codec that uses only integer operation.

The sbc_struct already contains "rate" and "channels" and we should simply add the rest of them. I was do lazy to do in the first place and actually because I had no use for them.

Regards

Marcel

Quoted 9 lines

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel