[Freeswitch-svn] [commit] r10886 - freeswitch/trunk/src/mod/formats/mod_sndfile

FreeSWITCH SVN brian at freeswitch.org
Fri Dec 19 13:40:03 PST 2008


Author: brian
Date: Fri Dec 19 16:39:59 2008
New Revision: 10886

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

Modified:
   freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c

Modified: freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.c	Fri Dec 19 16:39:59 2008
@@ -95,12 +95,9 @@
 
 		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 @@
 		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;



More information about the Freeswitch-svn mailing list