summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrago <rago@google.com>2018-01-22 16:00:30 -0800
committerjiabin <jiabin@google.com>2018-03-21 14:16:52 -0700
commit909a8f988b4a6ac52491e0af0ceef2cd4dbb25be (patch)
treebd59ea2569d983f90f393bf4337e3b7787c64be4
parent762407ccc3628934ec722a4d426e81dd6f544674 (diff)
downloadlibhardware-909a8f988b4a6ac52491e0af0ceef2cd4dbb25be.tar.gz
Support query microphones information.
Get list of all/currently active microphones from input stream. Part of the device enumeration feature. Bug: 64038649 Test: Manual Testing and Cts integration test Change-Id: Ibe231c430186c18ce43497c351b7d3e3b2425811
-rw-r--r--include/hardware/audio.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 53808dd5..9ad0f8b5 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -512,6 +512,24 @@ struct audio_stream_in {
*/
int (*get_mmap_position)(const struct audio_stream_in *stream,
struct audio_mmap_position *position);
+
+ /**
+ * Called by the framework to read active microphones
+ *
+ * \param[in] stream the stream object.
+ * \param[out] mic_array Pointer to first element on array with microphone info
+ * \param[out] mic_count When called, this holds the value of the max number of elements
+ * allowed in the mic_array. The actual number of elements written
+ * is returned here.
+ * if mic_count is passed as zero, mic_array will not be populated,
+ * and mic_count will return the actual number of active microphones.
+ *
+ * \return 0 if the microphone array is successfully filled.
+ * -ENOSYS if there is an error filling the data
+ */
+ int (*get_active_microphones)(const struct audio_stream_in *stream,
+ struct audio_microphone_characteristic_t *mic_array,
+ size_t *mic_count);
};
typedef struct audio_stream_in audio_stream_in_t;
@@ -684,6 +702,25 @@ struct audio_hw_device {
void (*close_input_stream)(struct audio_hw_device *dev,
struct audio_stream_in *stream_in);
+ /**
+ * Called by the framework to read available microphones characteristics.
+ *
+ * \param[in] dev the hw_device object.
+ * \param[out] mic_array Pointer to first element on array with microphone info
+ * \param[out] mic_count When called, this holds the value of the max number of elements
+ * allowed in the mic_array. The actual number of elements written
+ * is returned here.
+ * if mic_count is passed as zero, mic_array will not be populated,
+ * and mic_count will return the actual number of microphones in the
+ * system.
+ *
+ * \return 0 if the microphone array is successfully filled.
+ * -ENOSYS if there is an error filling the data
+ */
+ int (*get_microphones)(const struct audio_hw_device *dev,
+ struct audio_microphone_characteristic_t *mic_array,
+ size_t *mic_count);
+
/** This method dumps the state of the audio hardware */
int (*dump)(const struct audio_hw_device *dev, int fd);