Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCHv2 1/2] android/hal-audio: Add support for new Android API
@ 2014-11-04 14:37 Andrei Emeltchenko
  2014-11-04 14:37 ` [PATCHv2 2/2] android/hal-audio: Implement dummy Audio HAL functions Andrei Emeltchenko
  2014-11-04 15:02 ` [PATCHv2 1/2] android/hal-audio: Add support for new Android API Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2014-11-04 14:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

For new Android API add parameter address to audio_open_output_stream()
and audio_open_input_stream().
---
 android/hal-audio.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 59 insertions(+), 5 deletions(-)

diff --git a/android/hal-audio.c b/android/hal-audio.c
index e70351e..0e9891d 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -1108,13 +1108,13 @@ static int in_remove_audio_effect(const struct audio_stream *stream,
 	return -ENOSYS;
 }
 
-static int audio_open_output_stream(struct audio_hw_device *dev,
+static int audio_open_output_stream_real(struct audio_hw_device *dev,
 					audio_io_handle_t handle,
 					audio_devices_t devices,
 					audio_output_flags_t flags,
 					struct audio_config *config,
-					struct audio_stream_out **stream_out)
-
+					struct audio_stream_out **stream_out,
+					const char *address)
 {
 	struct a2dp_audio_dev *a2dp_dev = (struct a2dp_audio_dev *) dev;
 	struct a2dp_stream_out *out;
@@ -1171,6 +1171,31 @@ fail:
 	return -EIO;
 }
 
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static int audio_open_output_stream(struct audio_hw_device *dev,
+					audio_io_handle_t handle,
+					audio_devices_t devices,
+					audio_output_flags_t flags,
+					struct audio_config *config,
+					struct audio_stream_out **stream_out,
+					const char *address)
+{
+	return audio_open_output_stream_real(dev, handle, devices, flags,
+						config, stream_out, address);
+}
+#else
+static int audio_open_output_stream(struct audio_hw_device *dev,
+					audio_io_handle_t handle,
+					audio_devices_t devices,
+					audio_output_flags_t flags,
+					struct audio_config *config,
+					struct audio_stream_out **stream_out)
+{
+	return audio_open_output_stream_real(dev, handle, devices, flags,
+						config, stream_out, NULL);
+}
+#endif
+
 static void audio_close_output_stream(struct audio_hw_device *dev,
 					struct audio_stream_out *stream)
 {
@@ -1252,11 +1277,14 @@ static size_t audio_get_input_buffer_size(const struct audio_hw_device *dev,
 	return -ENOSYS;
 }
 
-static int audio_open_input_stream(struct audio_hw_device *dev,
+static int audio_open_input_stream_real(struct audio_hw_device *dev,
 					audio_io_handle_t handle,
 					audio_devices_t devices,
 					struct audio_config *config,
-					struct audio_stream_in **stream_in)
+					struct audio_stream_in **stream_in,
+					audio_input_flags_t flags,
+					const char *address,
+					audio_source_t source)
 {
 	struct audio_stream_in *in;
 
@@ -1287,6 +1315,32 @@ static int audio_open_input_stream(struct audio_hw_device *dev,
 	return 0;
 }
 
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static int audio_open_input_stream(struct audio_hw_device *dev,
+					audio_io_handle_t handle,
+					audio_devices_t devices,
+					struct audio_config *config,
+					struct audio_stream_in **stream_in,
+					audio_input_flags_t flags,
+					const char *address,
+					audio_source_t source)
+{
+	return audio_open_input_stream_real(dev, handle, devices, config,
+						stream_in, flags, address,
+						source);
+}
+#else
+static int audio_open_input_stream(struct audio_hw_device *dev,
+					audio_io_handle_t handle,
+					audio_devices_t devices,
+					struct audio_config *config,
+					struct audio_stream_in **stream_in)
+{
+	return audio_open_input_stream_real(dev, handle, devices, config,
+						stream_in, 0, NULL, 0);
+}
+#endif
+
 static void audio_close_input_stream(struct audio_hw_device *dev,
 					struct audio_stream_in *stream_in)
 {
-- 
1.9.1


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

* [PATCHv2 2/2] android/hal-audio: Implement dummy Audio HAL functions
  2014-11-04 14:37 [PATCHv2 1/2] android/hal-audio: Add support for new Android API Andrei Emeltchenko
@ 2014-11-04 14:37 ` Andrei Emeltchenko
  2014-11-04 15:02 ` [PATCHv2 1/2] android/hal-audio: Add support for new Android API Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2014-11-04 14:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Enable debug prints and prevent crash.
---
 android/hal-audio.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/android/hal-audio.c b/android/hal-audio.c
index 0e9891d..1caa4eb 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -1354,6 +1354,51 @@ static int audio_dump(const audio_hw_device_t *device, int fd)
 	return -ENOSYS;
 }
 
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static int set_master_mute(struct audio_hw_device *dev, bool mute)
+{
+	DBG("");
+	return -ENOSYS;
+}
+
+static int get_master_mute(struct audio_hw_device *dev, bool *mute)
+{
+	DBG("");
+	return -ENOSYS;
+}
+
+static int create_audio_patch(struct audio_hw_device *dev,
+					unsigned int num_sources,
+					const struct audio_port_config *sources,
+					unsigned int num_sinks,
+					const struct audio_port_config *sinks,
+					audio_patch_handle_t *handle)
+{
+	DBG("");
+	return -ENOSYS;
+}
+
+static int release_audio_patch(struct audio_hw_device *dev,
+					audio_patch_handle_t handle)
+{
+	DBG("");
+	return -ENOSYS;
+}
+
+static int get_audio_port(struct audio_hw_device *dev, struct audio_port *port)
+{
+	DBG("");
+	return -ENOSYS;
+}
+
+static int set_audio_port_config(struct audio_hw_device *dev,
+					const struct audio_port_config *config)
+{
+	DBG("");
+	return -ENOSYS;
+}
+#endif
+
 static int audio_close(hw_device_t *device)
 {
 	struct a2dp_audio_dev *a2dp_dev = (struct a2dp_audio_dev *)device;
@@ -1550,6 +1595,14 @@ static int audio_open(const hw_module_t *module, const char *name,
 	a2dp_dev->dev.open_input_stream = audio_open_input_stream;
 	a2dp_dev->dev.close_input_stream = audio_close_input_stream;
 	a2dp_dev->dev.dump = audio_dump;
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+	a2dp_dev->dev.set_master_mute = set_master_mute;
+	a2dp_dev->dev.get_master_mute = get_master_mute;
+	a2dp_dev->dev.create_audio_patch = create_audio_patch;
+	a2dp_dev->dev.release_audio_patch = release_audio_patch;
+	a2dp_dev->dev.get_audio_port = get_audio_port;
+	a2dp_dev->dev.set_audio_port_config = set_audio_port_config;
+#endif
 
 	for (i = 0; i < NUM_CODECS; i++) {
 		const struct audio_codec *codec = audio_codecs[i].get_codec();
-- 
1.9.1


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

* Re: [PATCHv2 1/2] android/hal-audio: Add support for new Android API
  2014-11-04 14:37 [PATCHv2 1/2] android/hal-audio: Add support for new Android API Andrei Emeltchenko
  2014-11-04 14:37 ` [PATCHv2 2/2] android/hal-audio: Implement dummy Audio HAL functions Andrei Emeltchenko
@ 2014-11-04 15:02 ` Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2014-11-04 15:02 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

On Tuesday 04 of November 2014 16:37:36 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> For new Android API add parameter address to audio_open_output_stream()
> and audio_open_input_stream().
> ---
>  android/hal-audio.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 59 insertions(+), 5 deletions(-)
> 
> diff --git a/android/hal-audio.c b/android/hal-audio.c
> index e70351e..0e9891d 100644
> --- a/android/hal-audio.c
> +++ b/android/hal-audio.c
> @@ -1108,13 +1108,13 @@ static int in_remove_audio_effect(const struct audio_stream *stream,
>  	return -ENOSYS;
>  }
>  
> -static int audio_open_output_stream(struct audio_hw_device *dev,
> +static int audio_open_output_stream_real(struct audio_hw_device *dev,
>  					audio_io_handle_t handle,
>  					audio_devices_t devices,
>  					audio_output_flags_t flags,
>  					struct audio_config *config,
> -					struct audio_stream_out **stream_out)
> -
> +					struct audio_stream_out **stream_out,
> +					const char *address)
>  {
>  	struct a2dp_audio_dev *a2dp_dev = (struct a2dp_audio_dev *) dev;
>  	struct a2dp_stream_out *out;
> @@ -1171,6 +1171,31 @@ fail:
>  	return -EIO;
>  }
>  
> +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
> +static int audio_open_output_stream(struct audio_hw_device *dev,
> +					audio_io_handle_t handle,
> +					audio_devices_t devices,
> +					audio_output_flags_t flags,
> +					struct audio_config *config,
> +					struct audio_stream_out **stream_out,
> +					const char *address)
> +{
> +	return audio_open_output_stream_real(dev, handle, devices, flags,
> +						config, stream_out, address);
> +}
> +#else
> +static int audio_open_output_stream(struct audio_hw_device *dev,
> +					audio_io_handle_t handle,
> +					audio_devices_t devices,
> +					audio_output_flags_t flags,
> +					struct audio_config *config,
> +					struct audio_stream_out **stream_out)
> +{
> +	return audio_open_output_stream_real(dev, handle, devices, flags,
> +						config, stream_out, NULL);
> +}
> +#endif
> +
>  static void audio_close_output_stream(struct audio_hw_device *dev,
>  					struct audio_stream_out *stream)
>  {
> @@ -1252,11 +1277,14 @@ static size_t audio_get_input_buffer_size(const struct audio_hw_device *dev,
>  	return -ENOSYS;
>  }
>  
> -static int audio_open_input_stream(struct audio_hw_device *dev,
> +static int audio_open_input_stream_real(struct audio_hw_device *dev,
>  					audio_io_handle_t handle,
>  					audio_devices_t devices,
>  					struct audio_config *config,
> -					struct audio_stream_in **stream_in)
> +					struct audio_stream_in **stream_in,
> +					audio_input_flags_t flags,
> +					const char *address,
> +					audio_source_t source)
>  {
>  	struct audio_stream_in *in;
>  
> @@ -1287,6 +1315,32 @@ static int audio_open_input_stream(struct audio_hw_device *dev,
>  	return 0;
>  }
>  
> +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
> +static int audio_open_input_stream(struct audio_hw_device *dev,
> +					audio_io_handle_t handle,
> +					audio_devices_t devices,
> +					struct audio_config *config,
> +					struct audio_stream_in **stream_in,
> +					audio_input_flags_t flags,
> +					const char *address,
> +					audio_source_t source)
> +{
> +	return audio_open_input_stream_real(dev, handle, devices, config,
> +						stream_in, flags, address,
> +						source);
> +}
> +#else
> +static int audio_open_input_stream(struct audio_hw_device *dev,
> +					audio_io_handle_t handle,
> +					audio_devices_t devices,
> +					struct audio_config *config,
> +					struct audio_stream_in **stream_in)
> +{
> +	return audio_open_input_stream_real(dev, handle, devices, config,
> +						stream_in, 0, NULL, 0);
> +}
> +#endif
> +
>  static void audio_close_input_stream(struct audio_hw_device *dev,
>  					struct audio_stream_in *stream_in)
>  {
> 

Both patches applied, thanks.

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-11-04 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 14:37 [PATCHv2 1/2] android/hal-audio: Add support for new Android API Andrei Emeltchenko
2014-11-04 14:37 ` [PATCHv2 2/2] android/hal-audio: Implement dummy Audio HAL functions Andrei Emeltchenko
2014-11-04 15:02 ` [PATCHv2 1/2] android/hal-audio: Add support for new Android API Szymon Janc

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