diff options
author | Eric Laurent <elaurent@google.com> | 2014-07-28 20:56:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-25 21:16:23 +0000 |
commit | ca413b6ec9fe7bd83e748c87fe46408607e8f117 (patch) | |
tree | dcd45a220eaef73f00f3c115114741da9c309755 | |
parent | 634e9484ebe324cbeb8aa874f5d71143f8354232 (diff) | |
parent | f5e2469c02825f018df6336125882812003b8e64 (diff) | |
download | libhardware-ca413b6ec9fe7bd83e748c87fe46408607e8f117.tar.gz |
Merge "audio HAL: add parameters to open stream" into lmp-dev
-rw-r--r-- | include/hardware/audio.h | 40 | ||||
-rw-r--r-- | modules/audio/audio_hw.c | 7 | ||||
-rw-r--r-- | modules/audio_remote_submix/audio_hw.cpp | 7 | ||||
-rw-r--r-- | modules/usbaudio/audio_hw.c | 7 |
4 files changed, 34 insertions, 27 deletions
diff --git a/include/hardware/audio.h b/include/hardware/audio.h index 95111dd1..4ff47936 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); diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c index ef070c1f..18c0e594 100644 --- a/modules/audio/audio_hw.c +++ b/modules/audio/audio_hw.c @@ -218,7 +218,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev, 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 __unused) { struct stub_audio_device *ladev = (struct stub_audio_device *)dev; struct stub_stream_out *out; @@ -328,7 +329,9 @@ static int adev_open_input_stream(struct audio_hw_device *dev, audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in, - audio_input_flags_t flags __unused) + audio_input_flags_t flags __unused, + const char *address __unused, + audio_source_t source __unused) { struct stub_audio_device *ladev = (struct stub_audio_device *)dev; struct stub_stream_in *in; diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp index 9e824b13..014da8ed 100644 --- a/modules/audio_remote_submix/audio_hw.cpp +++ b/modules/audio_remote_submix/audio_hw.cpp @@ -1188,7 +1188,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev, 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 __unused) { struct submix_audio_device * const rsxadev = audio_hw_device_get_submix_audio_device(dev); ALOGV("adev_open_output_stream()"); @@ -1374,7 +1375,9 @@ static int adev_open_input_stream(struct audio_hw_device *dev, audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in, - audio_input_flags_t flags __unused) + audio_input_flags_t flags __unused, + const char *address __unused, + audio_source_t source __unused) { struct submix_audio_device *rsxadev = audio_hw_device_get_submix_audio_device(dev); struct submix_stream_in *in; diff --git a/modules/usbaudio/audio_hw.c b/modules/usbaudio/audio_hw.c index 4a946e7f..d9bb6114 100644 --- a/modules/usbaudio/audio_hw.c +++ b/modules/usbaudio/audio_hw.c @@ -473,7 +473,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev, 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 __unused) { ALOGV("usb:audio_hw::out adev_open_output_stream() handle:0x%X, device:0x%X, flags:0x%X", handle, devices, flags); @@ -888,7 +889,9 @@ static int adev_open_input_stream(struct audio_hw_device *dev, audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in, - audio_input_flags_t flags __unused) + audio_input_flags_t flags __unused, + const char *address __unused, + audio_source_t source __unused) { ALOGV("usb: in adev_open_input_stream() rate:%" PRIu32 ", chanMask:0x%" PRIX32 ", fmt:%" PRIu8, config->sample_rate, config->channel_mask, config->format); |