audio HAL: add parameters to open stream

Pass device address (and audio source for inputs) to
open_output_stream() and open_input_stream() audio HAL functions.

Bug: 14815883.
Change-Id: I5535677db3f3027917a31a7ed5c0a4c6bc013639
This commit is contained in:
Eric Laurent 2014-07-27 16:14:57 -07:00
parent d61f84efe2
commit f5e2469c02
4 changed files with 34 additions and 27 deletions

View file

@ -110,12 +110,12 @@ __BEGIN_DECLS
* audio stream parameters
*/
#define AUDIO_PARAMETER_STREAM_ROUTING "routing" // audio_devices_t
#define AUDIO_PARAMETER_STREAM_FORMAT "format" // audio_format_t
#define AUDIO_PARAMETER_STREAM_CHANNELS "channels" // audio_channel_mask_t
#define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" // size_t
#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" // audio_source_t
#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" // uint32_t
#define AUDIO_PARAMETER_STREAM_ROUTING "routing" /* audio_devices_t */
#define AUDIO_PARAMETER_STREAM_FORMAT "format" /* audio_format_t */
#define AUDIO_PARAMETER_STREAM_CHANNELS "channels" /* audio_channel_mask_t */
#define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" /* size_t */
#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" /* audio_source_t */
#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" /* uint32_t */
/* Query supported formats. The response is a '|' separated list of strings from
* audio_format_t enum e.g: "sup_formats=AUDIO_FORMAT_PCM_16_BIT" */
@ -146,18 +146,6 @@ __BEGIN_DECLS
/**************************************/
/* common audio stream configuration parameters
* You should memset() the entire structure to zero before use to
* ensure forward compatibility
*/
struct audio_config {
uint32_t sample_rate;
audio_channel_mask_t channel_mask;
audio_format_t format;
audio_offload_info_t offload_info;
};
typedef struct audio_config audio_config_t;
/* common audio stream parameters and operations */
struct audio_stream {
@ -563,13 +551,21 @@ struct audio_hw_device {
size_t (*get_input_buffer_size)(const struct audio_hw_device *dev,
const struct audio_config *config);
/** This method creates and opens the audio hardware output stream */
/** This method creates and opens the audio hardware output stream.
* The "address" parameter qualifies the "devices" audio device type if needed.
* The format format depends on the device type:
* - Bluetooth devices use the MAC address of the device in the form "00:11:22:AA:BB:CC"
* - USB devices use the ALSA card and device numbers in the form "card=X;device=Y"
* - Other devices may use a number or any other string.
*/
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);
struct audio_stream_out **stream_out,
const char *address);
void (*close_output_stream)(struct audio_hw_device *dev,
struct audio_stream_out* stream_out);
@ -580,7 +576,9 @@ struct audio_hw_device {
audio_devices_t devices,
struct audio_config *config,
struct audio_stream_in **stream_in,
audio_input_flags_t flags);
audio_input_flags_t flags,
const char *address,
audio_source_t source);
void (*close_input_stream)(struct audio_hw_device *dev,
struct audio_stream_in *stream_in);

View file

@ -218,7 +218,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
audio_devices_t devices,
audio_output_flags_t flags,
struct audio_config *config,
struct audio_stream_out **stream_out)
struct audio_stream_out **stream_out,
const char *address __unused)
{
struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
struct stub_stream_out *out;
@ -328,7 +329,9 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
audio_devices_t devices,
struct audio_config *config,
struct audio_stream_in **stream_in,
audio_input_flags_t flags __unused)
audio_input_flags_t flags __unused,
const char *address __unused,
audio_source_t source __unused)
{
struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
struct stub_stream_in *in;

View file

@ -1188,7 +1188,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
audio_devices_t devices,
audio_output_flags_t flags,
struct audio_config *config,
struct audio_stream_out **stream_out)
struct audio_stream_out **stream_out,
const char *address __unused)
{
struct submix_audio_device * const rsxadev = audio_hw_device_get_submix_audio_device(dev);
ALOGV("adev_open_output_stream()");
@ -1374,7 +1375,9 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
audio_devices_t devices,
struct audio_config *config,
struct audio_stream_in **stream_in,
audio_input_flags_t flags __unused)
audio_input_flags_t flags __unused,
const char *address __unused,
audio_source_t source __unused)
{
struct submix_audio_device *rsxadev = audio_hw_device_get_submix_audio_device(dev);
struct submix_stream_in *in;

View file

@ -473,7 +473,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
audio_devices_t devices,
audio_output_flags_t flags,
struct audio_config *config,
struct audio_stream_out **stream_out)
struct audio_stream_out **stream_out,
const char *address __unused)
{
ALOGV("usb:audio_hw::out adev_open_output_stream() handle:0x%X, device:0x%X, flags:0x%X",
handle, devices, flags);
@ -888,7 +889,9 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
audio_devices_t devices,
struct audio_config *config,
struct audio_stream_in **stream_in,
audio_input_flags_t flags __unused)
audio_input_flags_t flags __unused,
const char *address __unused,
audio_source_t source __unused)
{
ALOGV("usb: in adev_open_input_stream() rate:%" PRIu32 ", chanMask:0x%" PRIX32 ", fmt:%" PRIu8,
config->sample_rate, config->channel_mask, config->format);