summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-05-22 14:02:38 -0700
committerEric Laurent <elaurent@google.com>2014-05-22 18:24:02 -0700
commit73b8a7414afa5ee3f006468f287695d9c2054d76 (patch)
tree1ba5331e22e42c029eb4000f3471a2f9457f3cdd
parent447cae749c7bb4906bc21c645df5eb7e6d664027 (diff)
downloadhardware_libhardware-73b8a7414afa5ee3f006468f287695d9c2054d76.zip
hardware_libhardware-73b8a7414afa5ee3f006468f287695d9c2054d76.tar.gz
hardware_libhardware-73b8a7414afa5ee3f006468f287695d9c2054d76.tar.bz2
audio: audio HAL extension for routing and volume control
Added audio HAL functions to control audio routing and audio gain. Audio HALs above version 3.0 must implement these functions. These functions will be used by the framework instead of out_set_parameters("routing"=XXX) for device selection on an output or input stream. They will also allow direct connection of input devices to output devices as well as gain control on devices or streams. The gain or routing capabilities are exposed in audio_polciy.conf file. Change-Id: Ic293fd41d492e38e86bdc35e3ad93aa5deb0b48f
-rw-r--r--include/hardware/audio.h35
-rw-r--r--include/hardware/audio_policy.h3
2 files changed, 34 insertions, 4 deletions
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index cbcb954..d0648b7 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -54,7 +54,8 @@ __BEGIN_DECLS
#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_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
-#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_2_0
+#define AUDIO_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
+#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_0
/* Minimal audio HAL version supported by the audio framework */
#define AUDIO_DEVICE_API_VERSION_MIN AUDIO_DEVICE_API_VERSION_2_0
@@ -563,6 +564,38 @@ struct audio_hw_device {
* method may leave it set to NULL.
*/
int (*get_master_mute)(struct audio_hw_device *dev, bool *mute);
+
+ /**
+ * Routing control
+ */
+
+ /* Creates an audio patch between several source and sink ports.
+ * The handle is allocated by the HAL and should be unique for this
+ * audio HAL module. */
+ int (*create_audio_patch)(struct audio_hw_device *dev,
+ unsigned int num_sources,
+ const struct audio_port_config *sources,
+ unsigned int num_sinks,
+ const struct audio_port_config *sinks,
+ audio_patch_handle_t *handle);
+
+ /* Release an audio patch */
+ int (*release_audio_patch)(struct audio_hw_device *dev,
+ audio_patch_handle_t handle);
+
+ /* Fills the list of supported attributes for a given audio port.
+ * As input, "port" contains the information (type, role, address etc...)
+ * needed by the HAL to identify the port.
+ * As output, "port" contains possible attributes (sampling rates, formats,
+ * channel masks, gain controllers...) for this port.
+ */
+ int (*get_audio_port)(struct audio_hw_device *dev,
+ struct audio_port *port);
+
+ /* Set audio port configuration */
+ int (*set_audio_port_config)(struct audio_hw_device *dev,
+ const struct audio_port_config *config);
+
};
typedef struct audio_hw_device audio_hw_device_t;
diff --git a/include/hardware/audio_policy.h b/include/hardware/audio_policy.h
index 0e88361..99cb044 100644
--- a/include/hardware/audio_policy.h
+++ b/include/hardware/audio_policy.h
@@ -248,9 +248,6 @@ struct audio_policy {
const audio_offload_info_t *info);
};
-/* audio hw module handle used by load_hw_module(), open_output_on_module()
- * and open_input_on_module() */
-typedef int audio_module_handle_t;
struct audio_policy_service_ops {
/*