From f5e2469c02825f018df6336125882812003b8e64 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Sun, 27 Jul 2014 16:14:57 -0700 Subject: audio HAL: add parameters to open stream Pass device address (and audio source for inputs) to open_output_stream() and open_input_stream() audio HAL functions. Bug: 14815883. Change-Id: I5535677db3f3027917a31a7ed5c0a4c6bc013639 --- include/hardware/audio.h | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/hardware/audio.h b/include/hardware/audio.h index 95111dd..4ff4793 100644 --- a/include/hardware/audio.h +++ b/include/hardware/audio.h @@ -110,12 +110,12 @@ __BEGIN_DECLS * audio stream parameters */ -#define AUDIO_PARAMETER_STREAM_ROUTING "routing" // audio_devices_t -#define AUDIO_PARAMETER_STREAM_FORMAT "format" // audio_format_t -#define AUDIO_PARAMETER_STREAM_CHANNELS "channels" // audio_channel_mask_t -#define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" // size_t -#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" // audio_source_t -#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" // uint32_t +#define AUDIO_PARAMETER_STREAM_ROUTING "routing" /* audio_devices_t */ +#define AUDIO_PARAMETER_STREAM_FORMAT "format" /* audio_format_t */ +#define AUDIO_PARAMETER_STREAM_CHANNELS "channels" /* audio_channel_mask_t */ +#define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" /* size_t */ +#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" /* audio_source_t */ +#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" /* uint32_t */ /* Query supported formats. The response is a '|' separated list of strings from * audio_format_t enum e.g: "sup_formats=AUDIO_FORMAT_PCM_16_BIT" */ @@ -146,18 +146,6 @@ __BEGIN_DECLS /**************************************/ -/* common audio stream configuration parameters - * You should memset() the entire structure to zero before use to - * ensure forward compatibility - */ -struct audio_config { - uint32_t sample_rate; - audio_channel_mask_t channel_mask; - audio_format_t format; - audio_offload_info_t offload_info; -}; -typedef struct audio_config audio_config_t; - /* common audio stream parameters and operations */ struct audio_stream { @@ -563,13 +551,21 @@ struct audio_hw_device { size_t (*get_input_buffer_size)(const struct audio_hw_device *dev, const struct audio_config *config); - /** This method creates and opens the audio hardware output stream */ + /** This method creates and opens the audio hardware output stream. + * The "address" parameter qualifies the "devices" audio device type if needed. + * The format format depends on the device type: + * - Bluetooth devices use the MAC address of the device in the form "00:11:22:AA:BB:CC" + * - USB devices use the ALSA card and device numbers in the form "card=X;device=Y" + * - Other devices may use a number or any other string. + */ + int (*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); + struct audio_stream_out **stream_out, + const char *address); void (*close_output_stream)(struct audio_hw_device *dev, struct audio_stream_out* stream_out); @@ -580,7 +576,9 @@ struct audio_hw_device { audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in, - audio_input_flags_t flags); + audio_input_flags_t flags, + const char *address, + audio_source_t source); void (*close_input_stream)(struct audio_hw_device *dev, struct audio_stream_in *stream_in); -- cgit v1.1