let codecs and timers be init with an existing pool

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@209 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2005-12-26 21:01:22 +00:00
parent 8c964a5c85
commit a0d199af73
12 changed files with 148 additions and 43 deletions

View File

@@ -61,6 +61,7 @@ struct switch_loadable_module_container {
switch_hash *timer_hash;
switch_hash *application_hash;
switch_hash *api_hash;
switch_hash *file_hash;
switch_memory_pool *pool;
};
@@ -214,6 +215,7 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
switch_core_hash_init(&loadable_modules.timer_hash, loadable_modules.pool);
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.dialplan_hash, loadable_modules.pool);
while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
@@ -317,6 +319,20 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
}
}
if (new_module->interface->file_interface) {
const switch_file_interface *ptr;
for(ptr = new_module->interface->file_interface; ptr; ptr = ptr->next) {
int i;
for (i = 0 ; ptr->extens[i]; i++) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding File Format '%s'\n", ptr->extens[i]);
switch_core_hash_insert(loadable_modules.api_hash,
(char *) ptr->extens[i],
(void *) ptr);
}
}
}
}
}
@@ -375,6 +391,11 @@ SWITCH_DECLARE(switch_api_interface *) loadable_module_get_api_interface(char *n
return switch_core_hash_find(loadable_modules.api_hash, name);
}
SWITCH_DECLARE(switch_api_interface *) loadable_module_get_file_interface(char *name)
{
return switch_core_hash_find(loadable_modules.file_hash, name);
}
SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array, int arraylen)
{
switch_hash_index_t* hi;