diff options
author | Eric Laurent <elaurent@google.com> | 2011-06-17 18:54:16 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-07-11 12:00:53 -0700 |
commit | ba7b8f881a9b6b21803752326d2932a3bd42d7cf (patch) | |
tree | 3e6ac78f1dea2eb4bde64c598c21a9b8e87a9db2 /media/libeffects | |
parent | 9b88b72ee2c3fd01fb46e77b7e6d80f3bd52e958 (diff) | |
download | frameworks_av-ba7b8f881a9b6b21803752326d2932a3bd42d7cf.zip frameworks_av-ba7b8f881a9b6b21803752326d2932a3bd42d7cf.tar.gz frameworks_av-ba7b8f881a9b6b21803752326d2932a3bd42d7cf.tar.bz2 |
Audio Effect API: process reverse stream function
Added function to audio effect interface for processing of
a reverse stream.
This is necessary for audio pre processes like echo cancellation.
Change-Id: I6e12d79dbbed6376acdfc79304b8c0ab3f705eae
Diffstat (limited to 'media/libeffects')
-rw-r--r-- | media/libeffects/factory/EffectsFactory.c | 43 | ||||
-rw-r--r-- | media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp | 3 | ||||
-rwxr-xr-x | media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp | 3 | ||||
-rw-r--r-- | media/libeffects/testlibs/EffectEqualizer.cpp | 3 | ||||
-rw-r--r-- | media/libeffects/testlibs/EffectReverb.c | 3 | ||||
-rw-r--r-- | media/libeffects/visualizer/EffectVisualizer.cpp | 3 |
6 files changed, 51 insertions, 7 deletions
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c index a3e76d9..a9689bc 100644 --- a/media/libeffects/factory/EffectsFactory.c +++ b/media/libeffects/factory/EffectsFactory.c @@ -130,10 +130,43 @@ int Effect_GetDescriptor(effect_handle_t self, return ret; } +int Effect_ProcessReverse(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) +{ + int ret = init(); + if (ret < 0) { + return ret; + } + effect_entry_t *fx = (effect_entry_t *)self; + pthread_mutex_lock(&gLibLock); + if (fx->lib == NULL) { + pthread_mutex_unlock(&gLibLock); + return -EPIPE; + } + pthread_mutex_lock(&fx->lib->lock); + pthread_mutex_unlock(&gLibLock); + + if ((*fx->subItfe)->process_reverse != NULL) { + ret = (*fx->subItfe)->process_reverse(fx->subItfe, inBuffer, outBuffer); + } else { + ret = -ENOSYS; + } + pthread_mutex_unlock(&fx->lib->lock); + return ret; +} + + const struct effect_interface_s gInterface = { Effect_Process, Effect_Command, - Effect_GetDescriptor + Effect_GetDescriptor, + NULL +}; + +const struct effect_interface_s gInterfaceWithReverse = { + Effect_Process, + Effect_Command, + Effect_GetDescriptor, + Effect_ProcessReverse }; ///////////////////////////////////////////////// @@ -266,7 +299,13 @@ int EffectCreate(effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, effect_ha // add entry to effect list fx = (effect_entry_t *)malloc(sizeof(effect_entry_t)); fx->subItfe = itfe; - fx->itfe = (struct effect_interface_s *)&gInterface; + if ((*itfe)->process_reverse != NULL) { + fx->itfe = (struct effect_interface_s *)&gInterfaceWithReverse; + LOGV("EffectCreate() gInterfaceWithReverse"); + } else { + fx->itfe = (struct effect_interface_s *)&gInterface; + LOGV("EffectCreate() gInterface"); + } fx->lib = l; e = (list_elem_t *)malloc(sizeof(list_elem_t)); diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp index 21c451f..efa1c45 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp @@ -3231,7 +3231,8 @@ int Effect_getDescriptor(effect_handle_t self, const struct effect_interface_s gLvmEffectInterface = { Effect_process, Effect_command, - Effect_getDescriptor + Effect_getDescriptor, + NULL, }; /* end gLvmEffectInterface */ audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = { diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp index 2727375..663f8ff 100755 --- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp +++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp @@ -2134,7 +2134,8 @@ int Reverb_getDescriptor(effect_handle_t self, const struct effect_interface_s gReverbInterface = { Reverb_process, Reverb_command, - Reverb_getDescriptor + Reverb_getDescriptor, + NULL, }; /* end gReverbInterface */ audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = { diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp index c2ffce5..b22ebec 100644 --- a/media/libeffects/testlibs/EffectEqualizer.cpp +++ b/media/libeffects/testlibs/EffectEqualizer.cpp @@ -736,7 +736,8 @@ extern "C" int Equalizer_getDescriptor(effect_handle_t self, const struct effect_interface_s gEqualizerInterface = { Equalizer_process, Equalizer_command, - Equalizer_getDescriptor + Equalizer_getDescriptor, + NULL }; diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c index 02762c9..405f908 100644 --- a/media/libeffects/testlibs/EffectReverb.c +++ b/media/libeffects/testlibs/EffectReverb.c @@ -27,7 +27,8 @@ const struct effect_interface_s gReverbInterface = { Reverb_Process, Reverb_Command, - Reverb_GetDescriptor + Reverb_GetDescriptor, + NULL }; // Google auxiliary environmental reverb UUID: 1f0ae2e0-4ef7-11df-bc09-0002a5d5c51b diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp index aeebd4d..3c3af8f 100644 --- a/media/libeffects/visualizer/EffectVisualizer.cpp +++ b/media/libeffects/visualizer/EffectVisualizer.cpp @@ -450,7 +450,8 @@ int Visualizer_getDescriptor(effect_handle_t self, const struct effect_interface_s gVisualizerInterface = { Visualizer_process, Visualizer_command, - Visualizer_getDescriptor + Visualizer_getDescriptor, + NULL, }; |