提交 0f7d9e2c authored 作者: Anthony Minessale's avatar Anthony Minessale

MODFORM-23

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12051 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 52cebca1
...@@ -67,11 +67,10 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha ...@@ -67,11 +67,10 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
int rates[4] = {8000, 16000, 32000, 48000}; int rates[4] = {8000, 16000, 32000, 48000};
int i; int i;
#ifdef WIN32 #ifdef WIN32
char ps[2] = {'\\', '/'}; char ps = '\\';
#else #else
char ps[2] = {'/', '\\'}; char ps = '/';
#endif #endif
int x;
if ((ext = strrchr(path, '.')) == 0) { if ((ext = strrchr(path, '.')) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n");
...@@ -158,9 +157,18 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha ...@@ -158,9 +157,18 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
switch_copy_string(alt_path, path, alt_len); switch_copy_string(alt_path, path, alt_len);
for (x = 0; x < 2; x++) { /* This block attempts to add the sample rate to the path
if ((last = strrchr(alt_path, ps[x]))) { if the sample rate is already present in the path it does nothing
and reverts to the original file name.
*/
if ((last = strrchr(alt_path, ps))) {
last++;
#ifdef WIN32
if (strrchr(last, '/')) {
last = strrchr(alt_path, '/'); /* do not swallow a forward slash if they are intermixed under windows*/
last++; last++;
}
#endif
ldup = strdup(last); ldup = strdup(last);
switch_assert(ldup); switch_assert(ldup);
switch_snprintf(last, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup); switch_snprintf(last, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup);
...@@ -179,7 +187,6 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha ...@@ -179,7 +187,6 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
} }
} }
} }
}
if (!context->handle) { if (!context->handle) {
if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) { if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论