]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_sndfile can now record 16bit for the various rates including 48kHz
authorBrian West <brian@freeswitch.org>
Fri, 19 Dec 2008 21:39:59 +0000 (21:39 +0000)
committerBrian West <brian@freeswitch.org>
Fri, 19 Dec 2008 21:39:59 +0000 (21:39 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10886 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/formats/mod_sndfile/mod_sndfile.c

index 698dece9f99102c3d88784257a852af7408279f5..8cdad270d04ea26484a3b81eec21ba42ecc97e07 100644 (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;