try this Vagabond

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16517 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2010-01-26 18:20:09 +00:00
parent 77ac925dc5
commit 3049cd5c8d
4 changed files with 48 additions and 24 deletions
@@ -60,6 +60,10 @@ typedef struct file_string_context file_string_context_t;
static int next_file(switch_file_handle_t *handle)
{
file_string_context_t *context = handle->private_info;
char *file;
const char *prefix = handle->prefix;
top:
context->index++;
@@ -71,12 +75,25 @@ static int next_file(switch_file_handle_t *handle)
return 0;
}
if (!prefix) {
if (!(prefix = switch_core_get_variable("sound_prefix"))) {
prefix = SWITCH_GLOBAL_dirs.sounds_dir;
}
}
if (!prefix || switch_is_file_path(context->argv[context->index])) {
file = context->argv[context->index];
} else {
file = switch_core_sprintf(handle->memory_pool, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, context->argv[context->index]);
}
if (switch_core_file_open(&context->fh,
context->argv[context->index],
file,
handle->channels,
handle->samplerate,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
return 0;
goto top;
}
handle->samples = context->fh.samples;