Re: [RFCv1 14/20] android/avdtp: Add set vendor codec function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 
On Fri, 2015-02-27 at 17:03 +0200, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
> 
> ---
>  profiles/audio/avdtp.c | 22 ++++++++++++++++++++++
>  profiles/audio/avdtp.h |  2 ++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
> index 6132c13..c396e8f 100644
> --- a/profiles/audio/avdtp.c
> +++ b/profiles/audio/avdtp.c
> @@ -49,6 +49,7 @@
>  #include "src/adapter.h"
>  #include "src/device.h"
>  
> +#include "../profiles/audio/a2dp-codecs.h"
>  #include "avdtp.h"
>  #include "a2dp.h"
>  #include "sink.h"
> @@ -330,6 +331,8 @@ struct avdtp_local_sep {
>  	struct avdtp_stream *stream;
>  	struct seid_info info;
>  	uint8_t codec;
> +	uint32_t vndcodec_vendor;
> +	uint16_t vndcodec_codec;
>  	gboolean delay_reporting;
>  	GSList *caps;
>  	struct avdtp_sep_ind *ind;
> @@ -1274,6 +1277,18 @@ struct avdtp_remote_sep *avdtp_find_remote_sep(struct avdtp *session,
>  		if (codec_data->media_codec_type != lsep->codec)
>  			continue;
>  
> +		/* FIXME: Add Vendor Specific Codec match to SEP callback */
> +		if (lsep->codec == A2DP_CODEC_VENDOR) {
> +			a2dp_vendor_codec_t *vndcodec =
> +						(void *) codec_data->data;
> +
> +			if (btohl(vndcodec->vendor_id) != lsep->vndcodec_vendor)
> +				continue;
> +
> +			if (btohs(vndcodec->codec_id) != lsep->vndcodec_codec)
> +				continue;
> +		}
> +
>  		if (sep->stream == NULL)
>  			return sep;
>  	}
> @@ -3753,6 +3768,13 @@ struct avdtp_local_sep *avdtp_register_sep(struct queue *lseps, uint8_t type,
>  	return sep;
>  }
>  
> +void avdtp_sep_set_vendor_codec(struct avdtp_local_sep *sep, uint32_t vendor_id,
> +							uint16_t codec_id)
> +{
> +	sep->vndcodec_vendor = vendor_id;
> +	sep->vndcodec_codec = codec_id;
> +}
> +
>  int avdtp_unregister_sep(struct queue *lseps, struct avdtp_local_sep *sep)
>  {
>  	if (!sep)
> diff --git a/profiles/audio/avdtp.h b/profiles/audio/avdtp.h
> index af55f76..0fc8fe2 100644
> --- a/profiles/audio/avdtp.h
> +++ b/profiles/audio/avdtp.h
> @@ -282,6 +282,8 @@ struct avdtp_local_sep *avdtp_register_sep(struct queue *lseps, uint8_t type,
>  						struct avdtp_sep_ind *ind,
>  						struct avdtp_sep_cfm *cfm,
>  						void *user_data);
> +void avdtp_sep_set_vendor_codec(struct avdtp_local_sep *sep, uint32_t vendor_id,
> +							uint16_t codec_id);
>  
>  /* Find a matching pair of local and remote SEP ID's */
>  struct avdtp_remote_sep *avdtp_find_remote_sep(struct avdtp *session,

I find out that bluez a2dp also do not work fine in case of multiple
vendor codecs in remote. So I think bluez also needs this android bluez
patch.

Originally I consider to use check_vendor(profile/audio/a2dp.c)function
from avdtp_find_remote_sep. but it does not seem good to me.

Could you give us the guidance?

Thanks
Chanyeol

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux