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
This commit is contained in:
Mingming Yin 2015-07-01 16:57:32 -07:00
parent 18175cc5a5
commit 497419fcb8
15 changed files with 51 additions and 7 deletions

View File

@ -125,6 +125,7 @@ namespace android {
struct dirent* in_file;
int fd;
String8 path;
String8 d_name;
if ((dp = opendir(events_dir)) == NULL) {
ALOGE("Cannot open switch directory to get list of audio events %s", events_dir);
@ -148,8 +149,9 @@ namespace android {
if (fd == -1) {
ALOGE("Open %s failed : %s", path.string(), strerror(errno));
} else {
mAudioEvents.push_back(std::make_pair(in_file->d_name, fd));
mAudioEventsStatus.push_back(std::make_pair(in_file->d_name, 0));
d_name = in_file->d_name;
mAudioEvents.push_back(std::make_pair(d_name, fd));
mAudioEventsStatus.push_back(std::make_pair(d_name, 0));
ALOGD("event status mAudioEventsStatus= %s",
mAudioEventsStatus[0].first.string());
}

View File

@ -53,6 +53,7 @@ LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
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

View File

@ -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_check_and_set_dts_hpx_state(const struct audio_device *adev);
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

View File

@ -71,7 +71,9 @@ const struct string_to_enum s_flag_name_to_enum_table[] = {
#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 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase)
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;

View File

@ -2921,7 +2921,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
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;

View File

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

View File

@ -92,5 +92,9 @@ typedef struct edid_audio_info {
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 */

View File

@ -1098,6 +1098,11 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info __unuse
return 0;
}
bool platform_use_small_buffer(audio_offload_info_t* info)
{
return false;
}
int platform_get_edid_info(void *platform __unused)
{
return -ENOSYS;

View File

@ -3197,6 +3197,11 @@ uint32_t platform_get_pcm_offload_buffer_size(audio_offload_info_t* info)
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)

View File

@ -92,6 +92,7 @@ int platform_info_init(const char *filename);
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,

View File

@ -14,8 +14,12 @@ LOCAL_SRC_FILES:= \
virtualizer.c \
reverb.c \
effect_api.c \
effect_util.c \
hw_accelerator.c
effect_util.c
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS)),true)
LOCAL_CFLAGS += -DHW_ACCELERATED_EFFECTS
LOCAL_SRC_FILES += hw_accelerator.c
endif
LOCAL_CFLAGS+= -O2 -fvisibility=hidden

View File

@ -38,6 +38,7 @@
#define LOG_TAG "offload_effect_bundle"
//#define LOG_NDEBUG 0
#include <stdlib.h>
#include <cutils/list.h>
#include <cutils/log.h>
#include <system/thread_defs.h>
@ -69,7 +70,9 @@ const effect_descriptor_t *descriptors[] = {
&ins_env_reverb_descriptor,
&aux_preset_reverb_descriptor,
&ins_preset_reverb_descriptor,
#ifdef HW_ACCELERATED_EFFECTS
&hw_accelerator_descriptor,
#endif
NULL,
};
@ -604,6 +607,7 @@ int effect_lib_create(const effect_uuid_t *uuid,
reverb_preset_init(reverb_ctxt);
}
reverb_ctxt->ctl = NULL;
#ifdef HW_ACCELERATED_EFFECTS
} else if (memcmp(uuid, &hw_accelerator_descriptor.uuid,
sizeof(effect_uuid_t)) == 0) {
hw_accelerator_context_t *hw_acc_ctxt = (hw_accelerator_context_t *)
@ -625,6 +629,7 @@ int effect_lib_create(const effect_uuid_t *uuid,
context->ops.process = hw_accelerator_process;
context->desc = &hw_accelerator_descriptor;
#endif
} else {
return -EINVAL;
}
@ -911,6 +916,7 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
} break;
#ifdef HW_ACCELERATED_EFFECTS
case EFFECT_CMD_HW_ACC: {
ALOGV("EFFECT_CMD_HW_ACC cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
cmdSize, pCmdData, *replySize, pReplyData);
@ -925,6 +931,7 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
context->hw_acc_enabled = (value > 0) ? true : false;
break;
}
#endif
default:
if (cmdCode >= EFFECT_CMD_FIRST_PROPRIETARY && context->ops.command)
status = context->ops.command(context, cmdCode, cmdSize,

View File

@ -55,6 +55,7 @@
#endif
#include <stdbool.h>
#include <errno.h>
#include <cutils/log.h>
#include <tinyalsa/asoundlib.h>
#include <sound/audio_effects.h>

View File

@ -16,6 +16,7 @@
#include <utils/Log.h>
#include <stdlib.h>
#include <string.h>
#include "effect_util.h"
#ifdef LOG_TAG

View File

@ -16,6 +16,7 @@
#define LOG_TAG "voice_processing"
/*#define LOG_NDEBUG 0*/
#include <stdlib.h>
#include <dlfcn.h>
#include <cutils/log.h>
#include <cutils/list.h>