mod_sndfile can now record 16bit for the various rates including 48kHz

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10886 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2008-12-19 21:39:59 +00:00
parent 86567838c6
commit b4211dd39d
1 changed files with 8 additions and 7 deletions

View File

@ -95,12 +95,9 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
context->sfinfo.channels = handle->channels;
context->sfinfo.samplerate = handle->samplerate;
if (handle->samplerate == 8000 || handle->samplerate == 16000) {
if (handle->samplerate == 8000 || handle->samplerate == 16000 ||
handle->samplerate == 24000 || handle->samplerate == 32000 || handle->samplerate == 48000) {
context->sfinfo.format |= SF_FORMAT_PCM_16;
} else if (handle->samplerate == 24000) {
context->sfinfo.format |= SF_FORMAT_PCM_24;
} else if (handle->samplerate == 32000) {
context->sfinfo.format |= SF_FORMAT_PCM_32;
}
sf_command(context->handle, SFC_FILE_TRUNCATE, &frames, sizeof(frames));
@ -119,13 +116,17 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
context->sfinfo.channels = 1;
context->sfinfo.samplerate = 16000;
} else if (!strcmp(ext, "r24")) {
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_24;
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
context->sfinfo.channels = 1;
context->sfinfo.samplerate = 24000;
} else if (!strcmp(ext, "r32")) {
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_32;
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
context->sfinfo.channels = 1;
context->sfinfo.samplerate = 32000;
} else if (!strcmp(ext, "r48")) {
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
context->sfinfo.channels = 1;
context->sfinfo.samplerate = 48000;
} else if (!strcmp(ext, "gsm")) {
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_GSM610;
context->sfinfo.channels = 1;