Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v3 0/5] A2DP sources with Media API
@ 2011-11-21 10:07 Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 1/5] media: release transport locks on acquisition failure Mikel Astiz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Mikel Astiz @ 2011-11-21 10:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

The following patches have been useful to make PulseAudio work using
the media API.

First two patches already acked by Luiz Augusto von Dentz.

Third patch solves a potential crash in 64 bit architectures.

Fourth and fifth patches split out the copyright statements.

Mikel Astiz (5):
  media: release transport locks on acquisition failure
  media: sep registration fix
  a2dp: avoid conversion between guint and pointers
  a2dp: update copyright statement
  media: update copyright statement

 audio/a2dp.c      |   21 ++++++++-------------
 audio/a2dp.h      |   13 +++++++------
 audio/media.c     |   20 +++++++++++---------
 audio/transport.c |    1 +
 4 files changed, 27 insertions(+), 28 deletions(-)

-- 
1.7.6.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/5] media: release transport locks on acquisition failure
  2011-11-21 10:07 [PATCH v3 0/5] A2DP sources with Media API Mikel Astiz
@ 2011-11-21 10:07 ` Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 2/5] media: sep registration fix Mikel Astiz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mikel Astiz @ 2011-11-21 10:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

---
 audio/transport.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/audio/transport.c b/audio/transport.c
index 2739199..7bde32d 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -670,6 +670,7 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
 	owner = media_owner_create(conn, msg, accesstype);
 	id = transport->resume(transport, owner);
 	if (id == 0) {
+		media_transport_release(transport, accesstype);
 		media_owner_free(owner);
 		return btd_error_not_authorized(msg);
 	}
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/5] media: sep registration fix
  2011-11-21 10:07 [PATCH v3 0/5] A2DP sources with Media API Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 1/5] media: release transport locks on acquisition failure Mikel Astiz
@ 2011-11-21 10:07 ` Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 3/5] a2dp: avoid conversion between guint and pointers Mikel Astiz
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mikel Astiz @ 2011-11-21 10:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

---
 audio/media.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index e5373b8..612408c 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -659,7 +659,7 @@ static struct media_endpoint *media_endpoint_create(struct media_adapter *adapte
 			goto failed;
 	} else if (strcasecmp(uuid, A2DP_SINK_UUID) == 0) {
 		endpoint->sep = a2dp_add_sep(&adapter->src,
-					AVDTP_SEP_TYPE_SOURCE, codec,
+					AVDTP_SEP_TYPE_SINK, codec,
 					delay_reporting, &a2dp_endpoint,
 					endpoint, a2dp_destroy_endpoint, err);
 		if (endpoint->sep == NULL)
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 3/5] a2dp: avoid conversion between guint and pointers
  2011-11-21 10:07 [PATCH v3 0/5] A2DP sources with Media API Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 1/5] media: release transport locks on acquisition failure Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 2/5] media: sep registration fix Mikel Astiz
@ 2011-11-21 10:07 ` Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 4/5] a2dp: update copyright statement Mikel Astiz
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mikel Astiz @ 2011-11-21 10:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

These conversions might cause a segmentation fault in 64 bit machines.
---
 audio/a2dp.c  |   20 +++++++-------------
 audio/a2dp.h  |   12 ++++++------
 audio/media.c |   17 +++++++++--------
 3 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/audio/a2dp.c b/audio/a2dp.c
index 75ad6ce..2d59dd2 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -638,11 +638,9 @@ static gboolean mpeg_getcap_ind(struct avdtp *session,
 	return TRUE;
 }
 
-static void endpoint_setconf_cb(struct a2dp_sep *sep, guint setup_id,
-								gboolean ret)
-{
-	struct a2dp_setup *setup = GUINT_TO_POINTER(setup_id);
 
+static void endpoint_setconf_cb(struct a2dp_setup *setup, gboolean ret)
+{
 	if (ret == FALSE) {
 		setup->err = g_new(struct avdtp_error, 1);
 		avdtp_error_init(setup->err, AVDTP_MEDIA_CODEC,
@@ -704,7 +702,7 @@ static gboolean endpoint_setconf_ind(struct avdtp *session,
 		ret = a2dp_sep->endpoint->set_configuration(a2dp_sep,
 						setup->dev, codec->data,
 						cap->length - sizeof(*codec),
-						GPOINTER_TO_UINT(setup),
+						setup,
 						endpoint_setconf_cb,
 						a2dp_sep->user_data);
 		if (ret == 0)
@@ -768,10 +766,8 @@ static gboolean endpoint_getcap_ind(struct avdtp *session,
 	return TRUE;
 }
 
-static void endpoint_open_cb(struct a2dp_sep *sep, guint setup_id,
-								gboolean ret)
+static void endpoint_open_cb(struct a2dp_setup *setup, gboolean ret)
 {
-	struct a2dp_setup *setup = GUINT_TO_POINTER(setup_id);
 	int err;
 
 	if (ret == FALSE) {
@@ -839,7 +835,7 @@ static void setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
 		err = a2dp_sep->endpoint->set_configuration(a2dp_sep, dev,
 						codec->data, service->length -
 						sizeof(*codec),
-						GPOINTER_TO_UINT(setup),
+						setup,
 						endpoint_open_cb,
 						a2dp_sep->user_data);
 		if (err == 0)
@@ -1885,10 +1881,8 @@ static gboolean select_capabilities(struct avdtp *session,
 	return TRUE;
 }
 
-static void select_cb(struct a2dp_sep *sep, guint setup_id, void *ret,
-								int size)
+static void select_cb(struct a2dp_setup *setup, void *ret, int size)
 {
-	struct a2dp_setup *setup = GUINT_TO_POINTER(setup_id);
 	struct avdtp_service_capability *media_transport, *media_codec;
 	struct avdtp_media_codec_capability *cap;
 
@@ -2029,7 +2023,7 @@ unsigned int a2dp_select_capabilities(struct avdtp *session,
 
 	err = sep->endpoint->select_configuration(sep, codec->data,
 					service->length - sizeof(*codec),
-					GPOINTER_TO_UINT(setup),
+					setup,
 					select_cb, sep->user_data);
 	if (err == 0)
 		return cb_data->id;
diff --git a/audio/a2dp.h b/audio/a2dp.h
index 1637580..4ea9f60 100644
--- a/audio/a2dp.h
+++ b/audio/a2dp.h
@@ -120,11 +120,11 @@ struct mpeg_codec_cap {
 #endif
 
 struct a2dp_sep;
+struct a2dp_setup;
 
-typedef void (*a2dp_endpoint_select_t) (struct a2dp_sep *sep, guint setup_id,
-							void *ret, int size);
-typedef void (*a2dp_endpoint_config_t) (struct a2dp_sep *sep, guint setup_id,
-								gboolean ret);
+typedef void (*a2dp_endpoint_select_t) (struct a2dp_setup *setup, void *ret,
+					int size);
+typedef void (*a2dp_endpoint_config_t) (struct a2dp_setup *setup, gboolean ret);
 
 struct a2dp_endpoint {
 	const char *(*get_name) (struct a2dp_sep *sep, void *user_data);
@@ -134,14 +134,14 @@ struct a2dp_endpoint {
 	int (*select_configuration) (struct a2dp_sep *sep,
 						uint8_t *capabilities,
 						size_t length,
-						guint setup_id,
+						struct a2dp_setup *setup,
 						a2dp_endpoint_select_t cb,
 						void *user_data);
 	int (*set_configuration) (struct a2dp_sep *sep,
 						struct audio_device *dev,
 						uint8_t *configuration,
 						size_t length,
-						guint setup_id,
+						struct a2dp_setup *setup,
 						a2dp_endpoint_config_t cb,
 						void *user_data);
 	void (*clear_configuration) (struct a2dp_sep *sep, void *user_data);
diff --git a/audio/media.c b/audio/media.c
index 612408c..c943443 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -481,12 +481,12 @@ static size_t get_capabilities(struct a2dp_sep *sep, uint8_t **capabilities,
 }
 
 struct a2dp_config_data {
-	guint setup_id;
+	struct a2dp_setup *setup;
 	a2dp_endpoint_config_t cb;
 };
 
 struct a2dp_select_data {
-	guint setup_id;
+	struct a2dp_setup *setup;
 	a2dp_endpoint_select_t cb;
 };
 
@@ -495,18 +495,18 @@ static void select_cb(struct media_endpoint *endpoint, void *ret, int size,
 {
 	struct a2dp_select_data *data = user_data;
 
-	data->cb(endpoint->sep, data->setup_id, ret, size);
+	data->cb(data->setup, ret, size);
 }
 
 static int select_config(struct a2dp_sep *sep, uint8_t *capabilities,
-				size_t length, guint setup_id,
+				size_t length, struct a2dp_setup *setup,
 				a2dp_endpoint_select_t cb, void *user_data)
 {
 	struct media_endpoint *endpoint = user_data;
 	struct a2dp_select_data *data;
 
 	data = g_new0(struct a2dp_select_data, 1);
-	data->setup_id = setup_id;
+	data->setup = setup;
 	data->cb = cb;
 
 	if (select_configuration(endpoint, capabilities, length,
@@ -522,19 +522,20 @@ static void config_cb(struct media_endpoint *endpoint, void *ret, int size,
 {
 	struct a2dp_config_data *data = user_data;
 
-	data->cb(endpoint->sep, data->setup_id, ret ? TRUE : FALSE);
+	data->cb(data->setup, ret ? TRUE : FALSE);
 }
 
 static int set_config(struct a2dp_sep *sep, struct audio_device *dev,
 				uint8_t *configuration, size_t length,
-				guint setup_id, a2dp_endpoint_config_t cb,
+				struct a2dp_setup *setup,
+				a2dp_endpoint_config_t cb,
 				void *user_data)
 {
 	struct media_endpoint *endpoint = user_data;
 	struct a2dp_config_data *data;
 
 	data = g_new0(struct a2dp_config_data, 1);
-	data->setup_id = setup_id;
+	data->setup = setup;
 	data->cb = cb;
 
 	if (set_configuration(endpoint, dev, configuration, length,
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 4/5] a2dp: update copyright statement
  2011-11-21 10:07 [PATCH v3 0/5] A2DP sources with Media API Mikel Astiz
                   ` (2 preceding siblings ...)
  2011-11-21 10:07 ` [PATCH v3 3/5] a2dp: avoid conversion between guint and pointers Mikel Astiz
@ 2011-11-21 10:07 ` Mikel Astiz
  2011-11-21 10:07 ` [PATCH v3 5/5] media: " Mikel Astiz
  2011-11-21 11:00 ` [PATCH v3 0/5] A2DP sources with Media API Johan Hedberg
  5 siblings, 0 replies; 7+ messages in thread
From: Mikel Astiz @ 2011-11-21 10:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

---
 audio/a2dp.c |    1 +
 audio/a2dp.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/audio/a2dp.c b/audio/a2dp.c
index 2d59dd2..5ca105c 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2006-2010  Nokia Corporation
  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright (C) 2011  BMW Car IT GmbH. All rights reserved.
  *
  *
  *  This program is free software; you can redistribute it and/or modify
diff --git a/audio/a2dp.h b/audio/a2dp.h
index 4ea9f60..887c5ac 100644
--- a/audio/a2dp.h
+++ b/audio/a2dp.h
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2006-2010  Nokia Corporation
  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright (C) 2011  BMW Car IT GmbH. All rights reserved.
  *
  *
  *  This program is free software; you can redistribute it and/or modify
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 5/5] media: update copyright statement
  2011-11-21 10:07 [PATCH v3 0/5] A2DP sources with Media API Mikel Astiz
                   ` (3 preceding siblings ...)
  2011-11-21 10:07 ` [PATCH v3 4/5] a2dp: update copyright statement Mikel Astiz
@ 2011-11-21 10:07 ` Mikel Astiz
  2011-11-21 11:00 ` [PATCH v3 0/5] A2DP sources with Media API Johan Hedberg
  5 siblings, 0 replies; 7+ messages in thread
From: Mikel Astiz @ 2011-11-21 10:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

---
 audio/media.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index c943443..a2ef437 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2006-2007  Nokia Corporation
  *  Copyright (C) 2004-2009  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright (C) 2011  BMW Car IT GmbH. All rights reserved.
  *
  *
  *  This program is free software; you can redistribute it and/or modify
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/5] A2DP sources with Media API
  2011-11-21 10:07 [PATCH v3 0/5] A2DP sources with Media API Mikel Astiz
                   ` (4 preceding siblings ...)
  2011-11-21 10:07 ` [PATCH v3 5/5] media: " Mikel Astiz
@ 2011-11-21 11:00 ` Johan Hedberg
  5 siblings, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2011-11-21 11:00 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth

Hi Mikel,

On Mon, Nov 21, 2011, Mikel Astiz wrote:
> The following patches have been useful to make PulseAudio work using
> the media API.
> 
> First two patches already acked by Luiz Augusto von Dentz.
> 
> Third patch solves a potential crash in 64 bit architectures.
> 
> Fourth and fifth patches split out the copyright statements.
> 
> Mikel Astiz (5):
>   media: release transport locks on acquisition failure
>   media: sep registration fix
>   a2dp: avoid conversion between guint and pointers
>   a2dp: update copyright statement
>   media: update copyright statement
> 
>  audio/a2dp.c      |   21 ++++++++-------------
>  audio/a2dp.h      |   13 +++++++------
>  audio/media.c     |   20 +++++++++++---------
>  audio/transport.c |    1 +
>  4 files changed, 27 insertions(+), 28 deletions(-)

All patches have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-11-21 11:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 10:07 [PATCH v3 0/5] A2DP sources with Media API Mikel Astiz
2011-11-21 10:07 ` [PATCH v3 1/5] media: release transport locks on acquisition failure Mikel Astiz
2011-11-21 10:07 ` [PATCH v3 2/5] media: sep registration fix Mikel Astiz
2011-11-21 10:07 ` [PATCH v3 3/5] a2dp: avoid conversion between guint and pointers Mikel Astiz
2011-11-21 10:07 ` [PATCH v3 4/5] a2dp: update copyright statement Mikel Astiz
2011-11-21 10:07 ` [PATCH v3 5/5] media: " Mikel Astiz
2011-11-21 11:00 ` [PATCH v3 0/5] A2DP sources with Media API Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox