aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-04-17 17:31:32 -0700
committerEric Laurent <elaurent@google.com>2012-04-17 17:36:59 -0700
commit635699a5d1761b3ed9572537fc620e0eb05bf500 (patch)
tree30e2c90d205b5ea8d374e5af31554a8a8803b493
parent99226bc1a9a6491118a6f30686c53fd406035828 (diff)
downloadbluez-635699a5d1761b3ed9572537fc620e0eb05bf500.tar.gz
fix gpl build
Change-Id: Ia1dfb030383384813c6f5780f5e83967c7d21a23
-rw-r--r--audio/android_audio_hw.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/audio/android_audio_hw.c b/audio/android_audio_hw.c
index 12cbd8d7..ca399bff 100644
--- a/audio/android_audio_hw.c
+++ b/audio/android_audio_hw.c
@@ -601,12 +601,19 @@ static int _out_a2dp_suspend(struct astream_out *out, bool suspend)
return 0;
}
+#ifdef AUDIO_DEVICE_API_VERSION_1_0
static int adev_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)
+#else
+static int adev_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 **stream_out)
+#endif
{
struct adev_a2dp *adev = (struct adev_a2dp *)dev;
struct astream_out *out;
@@ -664,9 +671,16 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->buffer_duration_us = ((out->buffer_size * 1000 ) /
audio_stream_frame_size(&out->stream.common) /
out->sample_rate) * 1000;
+#ifdef AUDIO_DEVICE_API_VERSION_1_0
if (!_out_validate_parms(out, config->format,
config->channel_mask,
- config->sample_rate)) {
+ config->sample_rate))
+#else
+ if (!_out_validate_parms(out, format ? *format : 0,
+ channels ? *channels : 0,
+ sample_rate ? *sample_rate : 0))
+#endif
+ {
ALOGV("invalid parameters");
ret = -EINVAL;
goto err_validate_parms;
@@ -690,10 +704,18 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
adev->output = out;
+#ifdef AUDIO_DEVICE_API_VERSION_1_0
config->format = out->format;
config->channel_mask = out->channels;
config->sample_rate = out->sample_rate;
-
+#else
+ if (format)
+ *format = out->format;
+ if (channels)
+ *channels = out->channels;
+ if (sample_rate)
+ *sample_rate = out->sample_rate;
+#endif
pthread_mutex_unlock(&adev->lock);
*stream_out = &out->stream;
@@ -855,18 +877,32 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
return -ENOSYS;
}
+#ifdef AUDIO_DEVICE_API_VERSION_1_0
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
const struct audio_config *config)
+#else
+static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
+ uint32_t sample_rate, audio_format_t format,
+ int channel_count)
+#endif
{
/* no input */
return 0;
}
+#ifdef AUDIO_DEVICE_API_VERSION_1_0
static int adev_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)
+#else
+static int adev_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,
+ struct audio_stream_in **stream_in)
+#endif
{
return -ENOSYS;
}
@@ -919,7 +955,11 @@ static int adev_open(const hw_module_t* module, const char* name,
adev->output = NULL;
adev->device.common.tag = HARDWARE_DEVICE_TAG;
+#ifdef AUDIO_DEVICE_API_VERSION_1_0
adev->device.common.version = AUDIO_DEVICE_API_VERSION_1_0;
+#else
+ adev->device.common.version = 0;
+#endif
adev->device.common.module = (struct hw_module_t *) module;
adev->device.common.close = adev_close;
@@ -955,8 +995,13 @@ static struct hw_module_methods_t hal_module_methods = {
struct audio_module HAL_MODULE_INFO_SYM = {
.common = {
.tag = HARDWARE_MODULE_TAG,
+#ifdef AUDIO_MODULE_API_VERSION_0_1
.module_api_version = AUDIO_MODULE_API_VERSION_0_1,
.hal_api_version = HARDWARE_HAL_API_VERSION,
+#else
+ .version_major = 1,
+ .version_minor = 0,
+#endif
.id = AUDIO_HARDWARE_MODULE_ID,
.name = "A2DP Audio HW HAL",
.author = "The Android Open Source Project",