DO NOT MERGE - 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
This commit is contained in:
Eric Laurent 2014-05-22 14:02:38 -07:00
parent a906a33d30
commit 060a115f44
2 changed files with 34 additions and 4 deletions

View file

@ -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;

View file

@ -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 {
/*