diff options
author | Mike Lockwood <lockwood@google.com> | 2012-04-24 16:41:18 -0700 |
---|---|---|
committer | Mike Lockwood <lockwood@google.com> | 2012-04-24 16:46:24 -0700 |
commit | 46a9809e9cd50af84f3e554c3d4ac214a8519831 (patch) | |
tree | 1111e4dcf29f306852c9cfb1f0a433a12b508653 /modules | |
parent | da4b0b26d170971448fdb04817b308900b5a6dd8 (diff) | |
download | hardware_libhardware-46a9809e9cd50af84f3e554c3d4ac214a8519831.zip hardware_libhardware-46a9809e9cd50af84f3e554c3d4ac214a8519831.tar.gz hardware_libhardware-46a9809e9cd50af84f3e554c3d4ac214a8519831.tar.bz2 |
Update USB audio HAL to use API
Also don't clear card and device when out_set_parameters is called
to set other parameters.
Change-Id: I4feda9f6a2e76cb45bbc8a8f8256bb1760302707
Signed-off-by: Mike Lockwood <lockwood@google.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/usbaudio/audio_hw.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/modules/usbaudio/audio_hw.c b/modules/usbaudio/audio_hw.c index 4022efd..9283016 100644 --- a/modules/usbaudio/audio_hw.c +++ b/modules/usbaudio/audio_hw.c @@ -156,9 +156,6 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) parms = str_parms_create_str(kvpairs); pthread_mutex_lock(&adev->lock); - adev->card = -1; - adev->device = -1; - ret = str_parms_get_str(parms, "card", value, sizeof(value)); if (ret >= 0) adev->card = atoi(value); @@ -247,8 +244,10 @@ static int out_get_next_write_timestamp(const struct audio_stream_out *stream, } 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 audio_device *adev = (struct audio_device *)dev; @@ -279,12 +278,15 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->dev = adev; - *format = out_get_format(&out->stream.common); - *channels = out_get_channels(&out->stream.common); - *sample_rate = out_get_sample_rate(&out->stream.common); + config->format = out_get_format(&out->stream.common); + config->channel_mask = out_get_channels(&out->stream.common); + config->sample_rate = out_get_sample_rate(&out->stream.common); out->standby = true; + adev->card = -1; + adev->device = -1; + *stream_out = &out->stream; return 0; @@ -345,16 +347,15 @@ 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) { return 0; } -static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices, - audio_format_t *format, uint32_t *channel_mask, - 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; @@ -397,7 +398,7 @@ static int adev_open(const hw_module_t* module, const char* name, return -ENOMEM; adev->hw_device.common.tag = HARDWARE_DEVICE_TAG; - adev->hw_device.common.version = 0; + adev->hw_device.common.version = AUDIO_DEVICE_API_VERSION_1_0; adev->hw_device.common.module = (struct hw_module_t *) module; adev->hw_device.common.close = adev_close; @@ -429,8 +430,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 = "USB audio HW HAL", .author = "The Android Open Source Project", |