diff options
author | Eric Laurent <elaurent@google.com> | 2011-12-16 15:30:36 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-12-19 17:08:31 -0800 |
commit | 3d5188bd6abe55898f10a0edf3c05aff8aa2ef67 (patch) | |
tree | 7dd2eba6d9a65d42628ffe55d12e640776285035 /media/libeffects/preprocessing | |
parent | 42968939dfce0954d6540011199045ec4ed7de80 (diff) | |
download | frameworks_av-3d5188bd6abe55898f10a0edf3c05aff8aa2ef67.zip frameworks_av-3d5188bd6abe55898f10a0edf3c05aff8aa2ef67.tar.gz frameworks_av-3d5188bd6abe55898f10a0edf3c05aff8aa2ef67.tar.bz2 |
audio effects: rename configure command
Renamed audio effect library interface command for audio format
configuration from EFFECT_CMD_CONFIGURE to EFFECT_CMD_SET_CONFIG.
This makes the naming more consistent with other exixsting commands
and allow adding a new command to get the configuration (EFFECT_CMD_GET_CONFIG).
Same change for reverse channel configuration renamed from
EFFECT_CMD_CONFIGURE_REVERSE to EFFECT_CMD_SET_CONFIG_REVERSE.
Implemented EFFECT_CMD_GET_CONFIG in exisitng effect libraries.
Change-Id: Ia7b1c620f13797fe5aceb3b0b4acbacce09fb067
Diffstat (limited to 'media/libeffects/preprocessing')
-rwxr-xr-x | media/libeffects/preprocessing/PreProcessing.cpp | 61 |
1 files changed, 53 insertions, 8 deletions
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp index b15614a..c99552b 100755 --- a/media/libeffects/preprocessing/PreProcessing.cpp +++ b/media/libeffects/preprocessing/PreProcessing.cpp @@ -940,6 +940,19 @@ int Session_SetConfig(preproc_session_t *session, effect_config_t *config) return 0; } +void Session_GetConfig(preproc_session_t *session, effect_config_t *config) +{ + memset(config, 0, sizeof(effect_config_t)); + config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate; + config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT; + config->inputCfg.channels = session->inChannelCount == 1 ? + AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO; + config->outputCfg.channels = session->outChannelCount == 1 ? + AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO; + config->inputCfg.mask = config->outputCfg.mask = + (EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT); +} + int Session_SetReverseConfig(preproc_session_t *session, effect_config_t *config) { if (config->inputCfg.samplingRate != config->outputCfg.samplingRate || @@ -969,6 +982,17 @@ int Session_SetReverseConfig(preproc_session_t *session, effect_config_t *config return 0; } +void Session_GetReverseConfig(preproc_session_t *session, effect_config_t *config) +{ + memset(config, 0, sizeof(effect_config_t)); + config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate; + config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT; + config->inputCfg.channels = config->outputCfg.channels = + session->revChannelCount == 1 ? AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO; + config->inputCfg.mask = config->outputCfg.mask = + (EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT); +} + void Session_SetProcEnabled(preproc_session_t *session, uint32_t procId, bool enabled) { if (enabled) { @@ -1250,13 +1274,13 @@ int PreProcessingFx_Command(effect_handle_t self, *(int *)pReplyData = 0; break; - case EFFECT_CMD_CONFIGURE: + case EFFECT_CMD_SET_CONFIG: if (pCmdData == NULL|| cmdSize != sizeof(effect_config_t)|| pReplyData == NULL|| *replySize != sizeof(int)){ ALOGV("PreProcessingFx_Command cmdCode Case: " - "EFFECT_CMD_CONFIGURE: ERROR"); + "EFFECT_CMD_SET_CONFIG: ERROR"); return -EINVAL; } *(int *)pReplyData = Session_SetConfig(effect->session, (effect_config_t *)pCmdData); @@ -1266,13 +1290,24 @@ int PreProcessingFx_Command(effect_handle_t self, *(int *)pReplyData = Effect_SetState(effect, PREPROC_EFFECT_STATE_CONFIG); break; - case EFFECT_CMD_CONFIGURE_REVERSE: - if (pCmdData == NULL|| - cmdSize != sizeof(effect_config_t)|| - pReplyData == NULL|| - *replySize != sizeof(int)){ + case EFFECT_CMD_GET_CONFIG: + if (pReplyData == NULL || + *replySize != sizeof(effect_config_t)) { + ALOGV("\tLVM_ERROR : PreProcessingFx_Command cmdCode Case: " + "EFFECT_CMD_GET_CONFIG: ERROR"); + return -EINVAL; + } + + Session_GetConfig(effect->session, (effect_config_t *)pCmdData); + break; + + case EFFECT_CMD_SET_CONFIG_REVERSE: + if (pCmdData == NULL || + cmdSize != sizeof(effect_config_t) || + pReplyData == NULL || + *replySize != sizeof(int)) { ALOGV("PreProcessingFx_Command cmdCode Case: " - "EFFECT_CMD_CONFIGURE_REVERSE: ERROR"); + "EFFECT_CMD_SET_CONFIG_REVERSE: ERROR"); return -EINVAL; } *(int *)pReplyData = Session_SetReverseConfig(effect->session, @@ -1282,6 +1317,16 @@ int PreProcessingFx_Command(effect_handle_t self, } break; + case EFFECT_CMD_GET_CONFIG_REVERSE: + if (pReplyData == NULL || + *replySize != sizeof(effect_config_t)){ + ALOGV("PreProcessingFx_Command cmdCode Case: " + "EFFECT_CMD_GET_CONFIG_REVERSE: ERROR"); + return -EINVAL; + } + Session_GetReverseConfig(effect->session, (effect_config_t *)pCmdData); + break; + case EFFECT_CMD_RESET: if (effect->ops->reset) { effect->ops->reset(effect); |