Merge "hal: Add new parameter in SA+ effects and resolve compilation issue" into audio-hal.lnx.5.1
diff --git a/post_proc/bass_boost.c b/post_proc/bass_boost.c
index 68cd46f..02c68d4 100644
--- a/post_proc/bass_boost.c
+++ b/post_proc/bass_boost.c
@@ -32,6 +32,8 @@
#include "effect_api.h"
#include "bass_boost.h"
+#define BASSBOOST_MAX_LATENCY 30
+
/* Offload bassboost UUID: 2c4a8c24-1581-487f-94f6-0002a5d5c51b */
const effect_descriptor_t bassboost_descriptor = {
{0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
@@ -101,6 +103,11 @@
p->status = -EINVAL;
p->vsize = sizeof(int16_t);
break;
+ case BASSBOOST_PARAM_LATENCY:
+ if (p->vsize < sizeof(uint32_t))
+ p->status = -EINVAL;
+ p->vsize = sizeof(uint32_t);
+ break;
default:
p->status = -EINVAL;
}
@@ -127,6 +134,10 @@
*(int16_t *)value = 0;
break;
+ case BASSBOOST_PARAM_LATENCY:
+ *(uint32_t *)value = BASSBOOST_MAX_LATENCY;
+ break;
+
default:
p->status = -EINVAL;
break;
diff --git a/post_proc/bass_boost.h b/post_proc/bass_boost.h
index 8bf51d3..ff674d4 100644
--- a/post_proc/bass_boost.h
+++ b/post_proc/bass_boost.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, 2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -20,6 +20,8 @@
#ifndef OFFLOAD_EFFECT_BASS_BOOST_H_
#define OFFLOAD_EFFECT_BASS_BOOST_H_
+#define BASSBOOST_PARAM_LATENCY 0x80000000
+
#include "bundle.h"
enum {
diff --git a/post_proc/equalizer.c b/post_proc/equalizer.c
index c1c1303..479f848 100644
--- a/post_proc/equalizer.c
+++ b/post_proc/equalizer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -29,6 +29,8 @@
#include "effect_api.h"
#include "equalizer.h"
+#define EQUALIZER_MAX_LATENCY 0
+
/* Offload equalizer UUID: a0dac280-401c-11e3-9379-0002a5d5c51b */
const effect_descriptor_t equalizer_descriptor = {
{0x0bed4300, 0xddd6, 0x11db, 0x8f34, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // type
@@ -253,6 +255,12 @@
p->vsize = (2 + NUM_EQ_BANDS) * sizeof(uint16_t);
break;
+ case EQ_PARAM_LATENCY:
+ if (p->vsize < sizeof(uint32_t))
+ p->status = -EINVAL;
+ p->vsize = sizeof(uint32_t);
+ break;
+
default:
p->status = -EINVAL;
}
@@ -352,6 +360,10 @@
}
} break;
+ case EQ_PARAM_LATENCY:
+ *(uint32_t *)value = EQUALIZER_MAX_LATENCY;
+ break;
+
default:
p->status = -EINVAL;
break;
diff --git a/post_proc/equalizer.h b/post_proc/equalizer.h
index 7fec058..2cd06c2 100644
--- a/post_proc/equalizer.h
+++ b/post_proc/equalizer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -26,6 +26,8 @@
#define INVALID_PRESET -2
#define PRESET_CUSTOM -1
+#define EQ_PARAM_LATENCY 0x80000000
+
extern const effect_descriptor_t equalizer_descriptor;
typedef struct equalizer_context_s {
diff --git a/post_proc/reverb.c b/post_proc/reverb.c
index e97b651..a0a0441 100644
--- a/post_proc/reverb.c
+++ b/post_proc/reverb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 - 2014, 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013 - 2014, 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -30,6 +30,8 @@
#include "effect_api.h"
#include "reverb.h"
+#define REVERB_MAX_LATENCY 100
+
/* Offload auxiliary environmental reverb UUID: 79a18026-18fd-4185-8233-0002a5d5c51b */
const effect_descriptor_t aux_env_reverb_descriptor = {
{ 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
@@ -522,6 +524,11 @@
p->status = -EINVAL;
p->vsize = sizeof(reverb_settings_t);
break;
+ case REVERB_PARAM_LATENCY:
+ if (p->vsize < sizeof(uint32_t))
+ return -EINVAL;
+ p->vsize = sizeof(uint32_t);
+ break;
default:
p->status = -EINVAL;
}
@@ -575,6 +582,9 @@
reverb_settings->diffusion = reverb_get_diffusion(reverb_ctxt);
reverb_settings->density = reverb_get_density(reverb_ctxt);
break;
+ case REVERB_PARAM_LATENCY:
+ *(uint16_t *)value = REVERB_MAX_LATENCY;
+ break;
default:
p->status = -EINVAL;
break;
diff --git a/post_proc/reverb.h b/post_proc/reverb.h
index 3bdd9af..cc11c46 100644
--- a/post_proc/reverb.h
+++ b/post_proc/reverb.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -24,6 +24,8 @@
#define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
+#define REVERB_PARAM_LATENCY 0x80000000
+
extern const effect_descriptor_t aux_env_reverb_descriptor;
extern const effect_descriptor_t ins_env_reverb_descriptor;
extern const effect_descriptor_t aux_preset_reverb_descriptor;
diff --git a/post_proc/virtualizer.c b/post_proc/virtualizer.c
index dfa7691..578cf0b 100644
--- a/post_proc/virtualizer.c
+++ b/post_proc/virtualizer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -29,6 +29,8 @@
#include "effect_api.h"
#include "virtualizer.h"
+#define VIRUALIZER_MAX_LATENCY 30
+
/* Offload Virtualizer UUID: 509a4498-561a-4bea-b3b1-0002a5d5c51b */
const effect_descriptor_t virtualizer_descriptor = {
{0x37cc2c00, 0xdddd, 0x11db, 0x8577, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
@@ -304,6 +306,11 @@
p->status = -EINVAL;
p->vsize = sizeof(uint32_t);
break;
+ case VIRTUALIZER_PARAM_LATENCY:
+ if (p->vsize < sizeof(uint32_t))
+ p->status = -EINVAL;
+ p->vsize = sizeof(uint32_t);
+ break;
default:
p->status = -EINVAL;
}
@@ -347,6 +354,10 @@
*(uint32_t *)value = (uint32_t) virtualizer_get_virtualization_mode(virt_ctxt);
break;
+ case VIRTUALIZER_PARAM_LATENCY:
+ *(uint32_t *)value = VIRUALIZER_MAX_LATENCY;
+ break;
+
default:
p->status = -EINVAL;
break;
diff --git a/post_proc/virtualizer.h b/post_proc/virtualizer.h
index 904a0c6..c0e6a87 100644
--- a/post_proc/virtualizer.h
+++ b/post_proc/virtualizer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, 2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -20,6 +20,8 @@
#ifndef OFFLOAD_VIRTUALIZER_H_
#define OFFLOAD_VIRTUALIZER_H_
+#define VIRTUALIZER_PARAM_LATENCY 0x80000000
+
#include "bundle.h"
extern const effect_descriptor_t virtualizer_descriptor;
diff --git a/qahw_api/inc/qahw_effect_bassboost.h b/qahw_api/inc/qahw_effect_bassboost.h
index 2ca8409..b397f21 100644
--- a/qahw_api/inc/qahw_effect_bassboost.h
+++ b/qahw_api/inc/qahw_effect_bassboost.h
@@ -40,7 +40,9 @@
typedef enum
{
BASSBOOST_PARAM_STRENGTH_SUPPORTED,
- BASSBOOST_PARAM_STRENGTH
+ BASSBOOST_PARAM_STRENGTH,
+ BASSBOOST_PARAM_LATENCY = 0x80000000 // Internal paramter specific to qahw.
+ // Used to get latency introduced by bassboost effect.
} qahw_bassboost_params;
#ifdef __cplusplus
diff --git a/qahw_api/inc/qahw_effect_environmentalreverb.h b/qahw_api/inc/qahw_effect_environmentalreverb.h
index a47eb28..61ef39e 100644
--- a/qahw_api/inc/qahw_effect_environmentalreverb.h
+++ b/qahw_api/inc/qahw_effect_environmentalreverb.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2011 The Android Open Source Project
@@ -22,7 +22,7 @@
#include <qahw_effect_api.h>
-#if __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
@@ -55,7 +55,9 @@
REVERB_PARAM_DIFFUSION, // in permilles, range 0 to 1000
REVERB_PARAM_DENSITY, // in permilles, range 0 to 1000
REVERB_PARAM_PROPERTIES,
- REVERB_PARAM_BYPASS
+ REVERB_PARAM_BYPASS,
+ REVERB_PARAM_LATENCY = 0x80000000 // Internal paramter specific to qahw.
+ // Used to get latency introduced by reverb effect.
} qahw_env_reverb_params;
//qahw_reverb_settings is equal to SLEnvironmentalReverbSettings defined in OpenSL ES specification.
@@ -73,7 +75,7 @@
} __attribute__((packed)) qahw_reverb_settings;
-#if __cplusplus
+#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/qahw_api/inc/qahw_effect_equalizer.h b/qahw_api/inc/qahw_effect_equalizer.h
index fd71c4c..e4d6c5b 100644
--- a/qahw_api/inc/qahw_effect_equalizer.h
+++ b/qahw_api/inc/qahw_effect_equalizer.h
@@ -50,7 +50,9 @@
EQ_PARAM_CUR_PRESET, // Gets/Sets the current preset.
EQ_PARAM_GET_NUM_OF_PRESETS, // Gets the total number of presets the equalizer supports.
EQ_PARAM_GET_PRESET_NAME, // Gets the preset name based on the index.
- EQ_PARAM_PROPERTIES // Gets/Sets all parameters at a time.
+ EQ_PARAM_PROPERTIES, // Gets/Sets all parameters at a time.
+ EQ_PARAM_LATENCY = 0x80000000 // Internal paramter specific to qahw.
+ // Used to get latency introduced by equalizer effect.
} qahw_equalizer_params;
enum
diff --git a/qahw_api/inc/qahw_effect_virtualizer.h b/qahw_api/inc/qahw_effect_virtualizer.h
index 5ff95ce..481f0ef 100644
--- a/qahw_api/inc/qahw_effect_virtualizer.h
+++ b/qahw_api/inc/qahw_effect_virtualizer.h
@@ -75,7 +75,10 @@
// AUDIO_DEVICE_NONE when not virtualizing
// status int -EINVAL if an error occurred
// 0 if the output value is successfully retrieved
- VIRTUALIZER_PARAM_VIRTUALIZATION_MODE
+ VIRTUALIZER_PARAM_VIRTUALIZATION_MODE,
+ // Internal paramter specific to qahw.
+ // Used to get latency introduced by virtuaizer effect.
+ VIRTUALIZER_PARAM_LATENCY = 0x80000000
} qahw_virtualizer_params;
#ifdef __cplusplus