audio: hal: Add new get_param_data api
Implement get_param_data api to store Sourcetracking parameters in payload. Change-Id: Idd8c3ddbe053237ea642c61dcc8441ed404e9c75
This commit is contained in:
parent
74cf00b1b7
commit
a3da380a82
|
@ -1,2 +1,7 @@
|
|||
SUBDIRS = hal qahw_api qahw_api/test
|
||||
SUBDIRS = hal
|
||||
|
||||
if QAHW_SUPPORT
|
||||
SUBDIRS += qahw_api qahw_api/test
|
||||
endif
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
|
|
@ -56,6 +56,8 @@ fi
|
|||
|
||||
AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
|
||||
|
||||
AM_CONDITIONAL([QAHW_SUPPORT], [test x$BOARD_SUPPORTS_QAHW = xtrue])
|
||||
|
||||
AM_CONDITIONAL([HDMI_EDID], [test x$AUDIO_FEATURE_ENABLED_HDMI_EDID = xtrue])
|
||||
AM_CONDITIONAL([FM_POWER_OPT], [test x$AUDIO_FEATURE_ENABLED_FM_POWER_OPT = xtrue])
|
||||
AM_CONDITIONAL([USBAUDIO], [test x$AUDIO_FEATURE_ENABLED_USBAUDIO = xtrue])
|
||||
|
|
|
@ -111,4 +111,30 @@
|
|||
*/
|
||||
#define AUDIO_INPUT_FLAG_TIMESTAMP 0x80000000
|
||||
|
||||
/* MAX SECTORS for sourcetracking feature */
|
||||
#define MAX_SECTORS 8
|
||||
|
||||
struct qahw_source_tracking_param {
|
||||
uint8_t vad[MAX_SECTORS];
|
||||
uint16_t doa_speech;
|
||||
uint16_t doa_noise[3];
|
||||
uint8_t polar_activity[360];
|
||||
};
|
||||
|
||||
struct qahw_sound_focus_param {
|
||||
uint16_t start_angle[MAX_SECTORS];
|
||||
uint8_t enable[MAX_SECTORS];
|
||||
uint16_t gain_step;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct qahw_source_tracking_param st_params;
|
||||
struct qahw_sound_focus_param sf_params;
|
||||
} qahw_param_payload;
|
||||
|
||||
typedef enum {
|
||||
QAHW_PARAM_SOURCE_TRACK,
|
||||
QAHW_PARAM_SOUND_FOCUS
|
||||
} qahw_param_id;
|
||||
|
||||
#endif /* AUDIO_DEFS_H */
|
||||
|
|
|
@ -502,6 +502,36 @@ static void send_soundfocus_sourcetracking_params(struct str_parms *reply,
|
|||
}
|
||||
}
|
||||
|
||||
int audio_extn_get_soundfocus_data(const struct audio_device *adev,
|
||||
struct sound_focus_param *payload)
|
||||
{
|
||||
int ret = 0;
|
||||
int bitmask =0;
|
||||
struct sound_focus_param *sound_focus_data = payload;
|
||||
|
||||
bitmask = BITMASK_AUDIO_PARAMETER_KEYS_SOUND_FOCUS;
|
||||
|
||||
ret = get_soundfocus_sourcetracking_data(adev, bitmask,
|
||||
sound_focus_data, NULL);
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
int audio_extn_get_sourcetrack_data(const struct audio_device *adev,
|
||||
struct source_tracking_param *payload)
|
||||
{
|
||||
int ret = 0;
|
||||
int bitmask = 0;
|
||||
struct source_tracking_param *source_tracking_data = payload;
|
||||
|
||||
bitmask = BITMASK_AUDIO_PARAMETER_KEYS_SOURCE_TRACKING;
|
||||
|
||||
ret = get_soundfocus_sourcetracking_data(adev, bitmask,
|
||||
NULL, source_tracking_data);
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
void audio_extn_source_track_get_parameters(const struct audio_device *adev,
|
||||
struct str_parms *query,
|
||||
struct str_parms *reply)
|
||||
|
|
|
@ -48,6 +48,39 @@ uint64_t timestamp;
|
|||
};
|
||||
#endif
|
||||
|
||||
int qahwi_get_param_data(const struct audio_device *adev,
|
||||
qahw_param_id param_id, qahw_param_payload *payload)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (adev == NULL) {
|
||||
ALOGE("%s::INVALID PARAM\n",__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (payload == NULL) {
|
||||
ALOGE("%s::INVALID PAYLOAD VALUE\n",__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (param_id) {
|
||||
case QAHW_PARAM_SOUND_FOCUS:
|
||||
ret = audio_extn_get_soundfocus_data(adev,
|
||||
(struct qahw_sound_focus_param *)payload);
|
||||
break;
|
||||
case QAHW_PARAM_SOURCE_TRACK:
|
||||
ret = audio_extn_get_sourcetrack_data(adev,
|
||||
(struct qahw_source_tracking_param*)payload);
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s::INVALID PARAM ID:%d\n",__func__,param_id);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t qahwi_in_read_v2(struct audio_stream_in *stream, void* buffer,
|
||||
size_t bytes, uint64_t *timestamp)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue