summaryrefslogtreecommitdiffstats
path: root/include/hardware/audio.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-04-10 16:56:32 -0700
committerEric Laurent <elaurent@google.com>2012-04-17 16:02:48 -0700
commit55786bcf3ced97dea8fa7ce79df2889d4d06e8a7 (patch)
treeea7089f133e92da7112cfcb15bbc1bc7a9041ef0 /include/hardware/audio.h
parent0c8e630ad66b30058009b9afa682b28b7f55b33a (diff)
downloadhardware_libhardware-55786bcf3ced97dea8fa7ce79df2889d4d06e8a7.zip
hardware_libhardware-55786bcf3ced97dea8fa7ce79df2889d4d06e8a7.tar.gz
hardware_libhardware-55786bcf3ced97dea8fa7ce79df2889d4d06e8a7.tar.bz2
audio: updated audio HAL device API
Modified open output and input stream functions to add new parameters needed by audio HAL. Also grouped parameters in a config structure for clarity. Change-Id: I60832d8e5b5e4a48f209a6d83f5ca9c044be61f1
Diffstat (limited to 'include/hardware/audio.h')
-rw-r--r--include/hardware/audio.h51
1 files changed, 38 insertions, 13 deletions
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 878b1b2..ef7d342 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -41,6 +41,20 @@ __BEGIN_DECLS
*/
#define AUDIO_HARDWARE_INTERFACE "audio_hw_if"
+
+/* Use version 0.1 to be compatible with first generation of audio hw module with version_major
+ * hardcoded to 1. No audio module API change.
+ */
+#define AUDIO_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
+#define AUDIO_MODULE_API_VERSION_CURRENT AUDIO_MODULE_API_VERSION_0_1
+
+/* First generation of audio devices had version hardcoded to 0. all devices with versions < 1.0
+ * will be considered of first generation API.
+ */
+#define AUDIO_DEVICE_API_VERSION_0_0 HARDWARE_DEVICE_API_VERSION(0, 0)
+#define AUDIO_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
+#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_1_0
+
/**
* List of known audio HAL modules. This is the base name of the audio HAL
* library composed of the "audio." prefix, one of the base names below and
@@ -88,8 +102,18 @@ __BEGIN_DECLS
#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" // audio_source_t
#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" // uint32_t
+
/**************************************/
+/* common audio stream configuration parameters */
+struct audio_config {
+ uint32_t sample_rate;
+ audio_channel_mask_t channel_mask;
+ audio_format_t format;
+};
+
+typedef struct audio_config audio_config_t;
+
/* common audio stream parameters and operations */
struct audio_stream {
@@ -113,7 +137,7 @@ struct audio_stream {
* Return the channel mask -
* e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO
*/
- uint32_t (*get_channels)(const struct audio_stream *stream);
+ audio_channel_mask_t (*get_channels)(const struct audio_stream *stream);
/**
* Return the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT
@@ -345,27 +369,28 @@ struct audio_hw_device {
* See also get_buffer_size which is for a particular stream.
*/
size_t (*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);
/** This method creates and opens the audio hardware output stream */
- int (*open_output_stream)(struct audio_hw_device *dev, uint32_t devices,
- audio_format_t *format, uint32_t *channels,
- uint32_t *sample_rate,
- struct audio_stream_out **out);
+ 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);
void (*close_output_stream)(struct audio_hw_device *dev,
- struct audio_stream_out* out);
+ struct audio_stream_out* stream_out);
/** This method creates and opens the audio hardware input stream */
- int (*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,
+ int (*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);
void (*close_input_stream)(struct audio_hw_device *dev,
- struct audio_stream_in *in);
+ struct audio_stream_in *stream_in);
/** This method dumps the state of the audio hardware */
int (*dump)(const struct audio_hw_device *dev, int fd);