hal: add support for configuring render window
Add support to set render window in transcode loopback usecase.
Render window is used by DSP to take rendering decision, i.e,
whether input frame should be rendered, dropped or repeated.
Change-Id: I87560a8e437b33dcd15094f30a532b3ed3d3749f
diff --git a/qahw/inc/qahw.h b/qahw/inc/qahw.h
index e91fd00..dd5b403 100644
--- a/qahw/inc/qahw.h
+++ b/qahw/inc/qahw.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2011 The Android Open Source Project *
@@ -463,6 +463,13 @@
/* Release an audio patch */
int qahw_release_audio_patch_l(qahw_module_handle_t *hw_module,
audio_patch_handle_t handle);
+
+/* API to set loopback stream specific config parameters. */
+int qahw_loopback_set_param_data_l(qahw_module_handle_t *hw_module,
+ audio_patch_handle_t handle,
+ qahw_loopback_param_id param_id,
+ qahw_loopback_param_payload *payload);
+
/* Fills the list of supported attributes for a given audio port.
* As input, "port" contains the information (type, role, address etc...)
* needed by the HAL to identify the port.
diff --git a/qahw/inc/qahw_defs.h b/qahw/inc/qahw_defs.h
index 4e7faff..755553b 100644
--- a/qahw/inc/qahw_defs.h
+++ b/qahw/inc/qahw_defs.h
@@ -417,6 +417,14 @@
QAHW_PARAM_LICENSE_PARAMS,
} qahw_param_id;
+typedef union {
+ struct qahw_out_render_window_param render_window_params;
+} qahw_loopback_param_payload;
+
+typedef enum {
+ QAHW_PARAM_LOOPBACK_RENDER_WINDOW /* PARAM to set render window */
+} qahw_loopback_param_id;
+
__END_DECLS
#endif // QTI_AUDIO_HAL_DEFS_H
diff --git a/qahw/src/qahw.c b/qahw/src/qahw.c
index 0c00158..126f794 100644
--- a/qahw/src/qahw.c
+++ b/qahw/src/qahw.c
@@ -69,6 +69,10 @@
qahw_param_id param_id,
qahw_param_payload *payload);
+typedef int (*qahwi_loopback_set_param_data_t)(audio_patch_handle_t patch_handle,
+ qahw_param_id param_id,
+ qahw_param_payload *payload);
+
typedef struct {
audio_hw_device_t *audio_device;
char module_name[MAX_MODULE_NAME_LENGTH];
@@ -80,6 +84,7 @@
const hw_module_t* module;
qahwi_get_param_data_t qahwi_get_param_data;
qahwi_set_param_data_t qahwi_set_param_data;
+ qahwi_loopback_set_param_data_t qahwi_loopback_set_param_data;
} qahw_module_t;
typedef struct {
@@ -1438,6 +1443,34 @@
return ret;
}
+int qahw_loopback_set_param_data_l(qahw_module_handle_t *hw_module,
+ audio_patch_handle_t handle,
+ qahw_loopback_param_id param_id,
+ qahw_loopback_param_payload *payload)
+
+{
+ int ret = -EINVAL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+
+ if (!payload) {
+ ALOGE("%s:: invalid param", __func__);
+ goto exit;
+ }
+
+ if (qahw_module->qahwi_loopback_set_param_data) {
+ ret = qahw_module->qahwi_loopback_set_param_data(handle,
+ param_id,
+ (void *)payload);
+ } else {
+ ret = -ENOSYS;
+ ALOGE("%s not supported\n", __func__);
+ }
+
+exit:
+ return ret;
+
+}
+
/* Fills the list of supported attributes for a given audio port.
* As input, "port" contains the information (type, role, address etc...)
* needed by the HAL to identify the port.
@@ -1889,6 +1922,12 @@
if (!qahw_module->qahwi_set_param_data)
ALOGD("%s::qahwi_set_param_data api is not defined\n",__func__);
+ qahw_module->qahwi_loopback_set_param_data = (qahwi_loopback_set_param_data_t)
+ dlsym(module->dso,
+ "qahwi_loopback_set_param_data");
+ if (!qahw_module->qahwi_loopback_set_param_data)
+ ALOGD("%s::qahwi_loopback_set_param_data api is not defined\n", __func__);
+
if (!qahw_list_count)
list_init(&qahw_module_list);
qahw_list_count++;