hal: compilation fix for extended feature flags
- Fix compilation error for offload, Dolby,
HDMI pass through, FLAC decoder, and hardware
accelerated effects when extended feature
flags are disabled.
Change-Id: I5b36d7668f63a396ed930d62c0337c2c3f311c95
diff --git a/hal/Android.mk b/hal/Android.mk
index e0149f9..315aab2 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -53,6 +53,7 @@
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HDMI_EDID)),true)
+ LOCAL_CFLAGS += -DHDMI_EDID
LOCAL_SRC_FILES += edid.c
endif
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 7bbe2f8..e443f06 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -46,6 +46,9 @@
#define AUDIO_FORMAT_PCM_24_BIT_OFFLOAD (AUDIO_FORMAT_PCM_OFFLOAD | AUDIO_FORMAT_PCM_SUB_8_24_BIT)
#define AUDIO_OFFLOAD_CODEC_FORMAT "music_offload_codec_format"
#define audio_is_offload_pcm(format) (0)
+#define OFFLOAD_USE_SMALL_BUFFER false
+#else
+#define OFFLOAD_USE_SMALL_BUFFER (info->use_small_bufs)
#endif
#ifndef AFE_PROXY_ENABLED
@@ -316,6 +319,9 @@
void audio_extn_dolby_set_dmid(struct audio_device *adev);
#else
#define audio_extn_dolby_set_dmid(adev) (0)
+#define AUDIO_CHANNEL_OUT_PENTA (AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_FRONT_CENTER)
+#define AUDIO_CHANNEL_OUT_SURROUND (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | \
+ AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER)
#endif
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 3dbf159..7ad4811 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -71,7 +71,9 @@
#ifdef COMPRESS_VOIP_ENABLED
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_VOIP_RX),
#endif
+#ifdef HDMI_PASSTHROUGH_ENABLED
STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH),
+#endif
};
const struct string_to_enum s_format_name_to_enum_table[] = {
@@ -566,8 +568,11 @@
app_type_cfg[len++] = out->app_type_cfg.app_type;
app_type_cfg[len++] = acdb_dev_id;
if (((out->format == AUDIO_FORMAT_E_AC3) ||
- (out->format == AUDIO_FORMAT_E_AC3_JOC)) &&
- (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH))
+ (out->format == AUDIO_FORMAT_E_AC3_JOC))
+#ifdef HDMI_PASSTHROUGH_ENABLED
+ && (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH)
+#endif
+ )
app_type_cfg[len++] = sample_rate * 4;
else
app_type_cfg[len++] = sample_rate;
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index daafa77..80f56a4 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2921,7 +2921,7 @@
if (flags & AUDIO_OUTPUT_FLAG_NON_BLOCKING)
out->non_blocking = 1;
- if (config->offload_info.use_small_bufs) {
+ if (platform_use_small_buffer(&config->offload_info)) {
//this flag is set from framework only if its for PCM formats
//no need to check for PCM format again
out->non_blocking = 0;
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 67f5279..5e61d36 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -38,6 +38,7 @@
#ifndef QCOM_AUDIO_HW_H
#define QCOM_AUDIO_HW_H
+#include <stdlib.h>
#include <cutils/list.h>
#include <hardware/audio.h>
#include <tinyalsa/asoundlib.h>
diff --git a/hal/edid.h b/hal/edid.h
index ec83ec8..0d7fbe6 100644
--- a/hal/edid.h
+++ b/hal/edid.h
@@ -92,5 +92,9 @@
int channel_allocation;
} edid_audio_info;
+#ifndef HDMI_EDID
+#define edid_get_sink_caps(info, edid_data) (0)
+#else
bool edid_get_sink_caps(edid_audio_info* info, char *edid_data);
+#endif
#endif /* EDID_H */
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index 5fab099..1d5d1e6 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -1098,6 +1098,11 @@
return 0;
}
+bool platform_use_small_buffer(audio_offload_info_t* info)
+{
+ return false;
+}
+
int platform_get_edid_info(void *platform __unused)
{
return -ENOSYS;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index fc81443..eccf5b0 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -3197,6 +3197,11 @@
return fragment_size;
}
+bool platform_use_small_buffer(audio_offload_info_t* info)
+{
+ return OFFLOAD_USE_SMALL_BUFFER;
+}
+
int platform_set_codec_backend_cfg(struct audio_device* adev,
snd_device_t snd_device,
unsigned int bit_width, unsigned int sample_rate)
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 5542a6d..59cb554 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -92,6 +92,7 @@
struct audio_offload_info_t;
uint32_t platform_get_compress_offload_buffer_size(audio_offload_info_t* info);
uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info);
+bool platform_use_small_buffer(audio_offload_info_t* info);
uint32_t platform_get_compress_passthrough_buffer_size(audio_offload_info_t* info);
bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev,