From 99226bc1a9a6491118a6f30686c53fd406035828 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 13 Apr 2012 17:48:05 -0700 Subject: audio: update to new audio HAL device API. Change-Id: Iba0802f8d03bc57ecf32736f5eb8beb59ac56f39 --- audio/android_audio_hw.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/audio/android_audio_hw.c b/audio/android_audio_hw.c index 07461096..12cbd8d7 100644 --- a/audio/android_audio_hw.c +++ b/audio/android_audio_hw.c @@ -602,8 +602,10 @@ static int _out_a2dp_suspend(struct astream_out *out, bool suspend) } static int adev_open_output_stream(struct audio_hw_device *dev, - uint32_t devices, audio_format_t *format, - uint32_t *channels, uint32_t *sample_rate, + 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 adev_a2dp *adev = (struct adev_a2dp *)dev; @@ -662,9 +664,9 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->buffer_duration_us = ((out->buffer_size * 1000 ) / audio_stream_frame_size(&out->stream.common) / out->sample_rate) * 1000; - if (!_out_validate_parms(out, format ? *format : 0, - channels ? *channels : 0, - sample_rate ? *sample_rate : 0)) { + if (!_out_validate_parms(out, config->format, + config->channel_mask, + config->sample_rate)) { ALOGV("invalid parameters"); ret = -EINVAL; goto err_validate_parms; @@ -688,12 +690,9 @@ static int adev_open_output_stream(struct audio_hw_device *dev, adev->output = out; - if (format) - *format = out->format; - if (channels) - *channels = out->channels; - if (sample_rate) - *sample_rate = out->sample_rate; + config->format = out->format; + config->channel_mask = out->channels; + config->sample_rate = out->sample_rate; pthread_mutex_unlock(&adev->lock); @@ -857,17 +856,16 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state) } static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev, - uint32_t sample_rate, audio_format_t format, - int channel_count) + const struct audio_config *config) { /* no input */ return 0; } -static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices, - audio_format_t *format, uint32_t *channels, - uint32_t *sample_rate, - audio_in_acoustics_t acoustics, +static int adev_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 -ENOSYS; @@ -921,7 +919,7 @@ static int adev_open(const hw_module_t* module, const char* name, adev->output = NULL; adev->device.common.tag = HARDWARE_DEVICE_TAG; - adev->device.common.version = 0; + adev->device.common.version = AUDIO_DEVICE_API_VERSION_1_0; adev->device.common.module = (struct hw_module_t *) module; adev->device.common.close = adev_close; @@ -957,8 +955,8 @@ static struct hw_module_methods_t hal_module_methods = { struct audio_module HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG, - .version_major = 1, - .version_minor = 0, + .module_api_version = AUDIO_MODULE_API_VERSION_0_1, + .hal_api_version = HARDWARE_HAL_API_VERSION, .id = AUDIO_HARDWARE_MODULE_ID, .name = "A2DP Audio HW HAL", .author = "The Android Open Source Project", -- cgit v1.2.3