hal: Remove storage of audio device on bitfields
Audio devices were stored in HAL on variables with
type audio_devices_t. This change removes the storage
of multiple devices on a bitfield. Device comparisons,
assigments, removal have been updated. Helper functions
have been introduced for device operations.
Change-Id: I9ce8b0f9bdc542c386cbfe45b685158cc51d47b6
diff --git a/hal/audio_extn/passthru.c b/hal/audio_extn/passthru.c
index 78a5b7f..293ffac 100644
--- a/hal/audio_extn/passthru.c
+++ b/hal/audio_extn/passthru.c
@@ -256,7 +256,7 @@
#else
compr_passthr = out->compr_config.codec->compr_passthr;
#endif
- if ((out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) &&
+ if (compare_device_type(&out->device_list, AUDIO_DEVICE_OUT_AUX_DIGITAL) &&
(((out->format & AUDIO_FORMAT_MAIN_MASK) == AUDIO_FORMAT_PCM) ||
((out->compr_config.codec != NULL) && (compr_passthr == LEGACY_PCM)))) {
if (android_atomic_acquire_load(&compress_passthru_active) > 0) {
@@ -292,7 +292,7 @@
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (usecase->stream.out && usecase->type == PCM_PLAYBACK &&
- usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
+ compare_device_type(&usecase->device_list, AUDIO_DEVICE_OUT_AUX_DIGITAL)) {
o = usecase->stream.out;
temp = o->config.period_size * 1000000LL / o->sample_rate;
if (temp > max_period_us)
@@ -321,7 +321,7 @@
android_atomic_dec(&compress_passthru_active);
}
- if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
+ if (compare_device_type(&out->device_list, AUDIO_DEVICE_OUT_AUX_DIGITAL)) {
ALOGD("%s: passthru on aux digital, start keep alive", __func__);
fp_audio_extn_keep_alive_start(KEEP_ALIVE_OUT_HDMI);
}
@@ -502,7 +502,7 @@
}
//check supported device, currently only on HDMI.
- if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
+ if (compare_device_type(&out->device_list, AUDIO_DEVICE_OUT_AUX_DIGITAL)) {
//passthrough flag
if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH)
return true;