Add framework for speech modules (asr/tts)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@457 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-01-27 16:43:57 +00:00
parent 48ae14726b
commit 17e06cf6bc
7 changed files with 225 additions and 6 deletions

View File

@@ -62,6 +62,7 @@ struct switch_loadable_module_container {
switch_hash *application_hash;
switch_hash *api_hash;
switch_hash *file_hash;
switch_hash *speech_hash;
switch_memory_pool *pool;
};
@@ -218,6 +219,7 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
switch_core_hash_init(&loadable_modules.application_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.api_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.file_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.speech_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.dialplan_hash, loadable_modules.pool);
while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
@@ -321,6 +323,15 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
}
}
if (new_module->interface->speech_interface) {
const switch_speech_interface *ptr;
for (ptr = new_module->interface->speech_interface; ptr; ptr = ptr->next) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding Speech interface '%s'\n", ptr->interface_name);
switch_core_hash_insert(loadable_modules.speech_hash, (char *) ptr->interface_name, (void *) ptr);
}
}
}
}
@@ -384,6 +395,11 @@ SWITCH_DECLARE(switch_file_interface *) switch_loadable_module_get_file_interfac
return switch_core_hash_find(loadable_modules.file_hash, name);
}
SWITCH_DECLARE(switch_speech_interface *) switch_loadable_module_get_speech_interface(char *name)
{
return switch_core_hash_find(loadable_modules.speech_hash, name);
}
SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array,
int arraylen)
{