diff options
author | Paul Mclean <pmclean@google.com> | 2019-01-17 21:34:33 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-01-17 21:34:33 +0000 |
commit | 83b4d508b973dc9ab69d2b704bc2467e8676e8e3 (patch) | |
tree | f4af4f807e9778f3d5cc24bfab758459d8b6eb13 | |
parent | 528258118a799a1a5fce7d1ff1670cf4d6213819 (diff) | |
parent | fa3ae3ed7469b5c5d50364c491d275a6e405157e (diff) | |
download | libhardware-83b4d508b973dc9ab69d2b704bc2467e8676e8e3.tar.gz |
Merge "Adding Audio HAL V5: Direction API"
-rw-r--r-- | include/hardware/audio.h | 30 | ||||
-rw-r--r-- | modules/usbaudio/audio_hal.c | 28 |
2 files changed, 58 insertions, 0 deletions
diff --git a/include/hardware/audio.h b/include/hardware/audio.h index 10a8789a..feebd23e 100644 --- a/include/hardware/audio.h +++ b/include/hardware/audio.h @@ -550,6 +550,36 @@ struct audio_stream_in { size_t *mic_count); /** + * Called by the framework to instruct the HAL to optimize the capture stream in the + * specified direction. + * + * \param[in] stream the stream object. + * \param[in] direction The direction constant (from audio-base.h) + * MIC_DIRECTION_UNSPECIFIED Don't do any directionality processing of the + * activated microphone(s). + * MIC_DIRECTION_FRONT Optimize capture for audio coming from the screen-side + * of the device. + * MIC_DIRECTION_BACK Optimize capture for audio coming from the side of the + * device opposite the screen. + * MIC_DIRECTION_EXTERNAL Optimize capture for audio coming from an off-device + * microphone. + * \return OK if the call is successful, an error code otherwise. + */ + int (*set_microphone_direction)(const struct audio_stream_in *stream, + audio_microphone_direction_t direction); + + /** + * Called by the framework to specify to the HAL the desired zoom factor for the selected + * microphone(s). + * + * \param[in] stream the stream object. + * \param[in] zoom the zoom factor. + * \return OK if the call is successful, an error code otherwise. + */ + int (*set_microphone_field_dimension)(const struct audio_stream_in *stream, + float zoom); + + /** * Called when the metadata of the stream's sink has been changed. * @param sink_metadata Description of the audio that is recorded by the clients. */ diff --git a/modules/usbaudio/audio_hal.c b/modules/usbaudio/audio_hal.c index cddcc142..f0ea015a 100644 --- a/modules/usbaudio/audio_hal.c +++ b/modules/usbaudio/audio_hal.c @@ -918,6 +918,30 @@ static int in_get_capture_position(const struct audio_stream_in *stream, return ret; } +static int in_get_active_microphones(const struct audio_stream_in *stream, + struct audio_microphone_characteristic_t *mic_array, + size_t *mic_count) { + (void)stream; + (void)mic_array; + (void)mic_count; + + return -ENOSYS; +} + +static int in_set_microphone_direction(const struct audio_stream_in *stream, + audio_microphone_direction_t dir) { + (void)stream; + (void)dir; + ALOGV("---- in_set_microphone_direction()"); + return -ENOSYS; +} + +static int in_set_microphone_field_dimension(const struct audio_stream_in *stream, float zoom) { + (void)zoom; + ALOGV("---- in_set_microphone_field_dimension()"); + return -ENOSYS; +} + static int adev_open_input_stream(struct audio_hw_device *hw_dev, audio_io_handle_t handle, audio_devices_t devicesSpec __unused, @@ -963,6 +987,10 @@ static int adev_open_input_stream(struct audio_hw_device *hw_dev, in->stream.get_input_frames_lost = in_get_input_frames_lost; in->stream.get_capture_position = in_get_capture_position; + in->stream.get_active_microphones = in_get_active_microphones; + in->stream.set_microphone_direction = in_set_microphone_direction; + in->stream.set_microphone_field_dimension = in_set_microphone_field_dimension; + stream_lock_init(&in->lock); in->adev = (struct audio_device *)hw_dev; |