Revision
16026
Author
brian
Date
2009-12-22 15:24:15 -0600 (Tue, 22 Dec 2009)

Log Message

 adding 12kHz and 24kHz 

Modified Paths

Diff

Modified: freeswitch/trunk/src/include/switch_loadable_module.h (16025 => 16026)


--- freeswitch/trunk/src/include/switch_loadable_module.h	2009-12-22 20:52:46 UTC (rev 16025)
+++ freeswitch/trunk/src/include/switch_loadable_module.h	2009-12-22 21:24:15 UTC (rev 16026)
@@ -339,10 +339,14 @@
 		ptime_div = 2;
 		break;
 	case 32000:
+	case 24000:
 	case 16000:
 		max_ms = 60;
 		ptime_div = 2;
 		break;
+	case 12000:
+		max_ms = 100;
+		ptime_div = 2;
 	case 8000:
 		max_ms = 120;
 		ptime_div = 2;

Modified: freeswitch/trunk/src/include/switch_utils.h (16025 => 16026)


--- freeswitch/trunk/src/include/switch_utils.h	2009-12-22 20:52:46 UTC (rev 16025)
+++ freeswitch/trunk/src/include/switch_utils.h	2009-12-22 21:24:15 UTC (rev 16026)
@@ -92,7 +92,7 @@
 #define switch_arraylen(_a) (sizeof(_a) / sizeof(_a[0]))
 #define switch_split(_data, _delim, _array) switch_separate_string(_data, _delim, _array, switch_arraylen(_array))
 
-#define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 16000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
+#define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 12000 || _tmp == 16000 || _tmp == 24000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
 
 
 static inline int switch_string_has_escaped_data(const char *in)

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (16025 => 16026)


--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	2009-12-22 20:52:46 UTC (rev 16025)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	2009-12-22 21:24:15 UTC (rev 16026)
@@ -5761,7 +5761,7 @@
 
 		if (!strcasecmp(var, "rate") && !zstr(val)) {
 			uint32_t tmp = atoi(val);
-			if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
+			if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
 				rate = tmp;
 			}
 		} else if (!strcasecmp(var, "domain") && !zstr(val)) {

Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (16025 => 16026)


--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	2009-12-22 20:52:46 UTC (rev 16025)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	2009-12-22 21:24:15 UTC (rev 16026)
@@ -546,7 +546,7 @@
 
 			if (!strcasecmp(var, "rate")) {
 				int tmp = atoi(val);
-				if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
+				if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
 					source->rate = tmp;
 				}
 			} else if (!strcasecmp(var, "shuffle")) {

Modified: freeswitch/trunk/src/switch_pcm.c (16025 => 16026)


--- freeswitch/trunk/src/switch_pcm.c	2009-12-22 20:52:46 UTC (rev 16025)
+++ freeswitch/trunk/src/switch_pcm.c	2009-12-22 21:24:15 UTC (rev 16026)
@@ -388,6 +388,67 @@
 		bpf = bpf * 2;
 		ebpf = ebpf * 2;
 	}
+
+	samples_per_frame = 240;
+	bytes_per_frame = 480;
+	ms_per_frame = 20000;
+
+	for (x = 0; x < 5; x++) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10, 						/* the IANA code number */
+											 "L16",						/* the IANA code name */
+											 NULL,						/* default fmtp to send (can be overridden by the init function) */
+											 12000,						/* samples transferred per second */
+											 12000,						/* actual samples transferred per second */
+											 192000,					/* bits transferred per second */
+											 ms_per_frame,				/* number of microseconds per frame */
+											 samples_per_frame,			/* number of samples per frame */
+											 bytes_per_frame,			/* number of bytes per frame decompressed */
+											 bytes_per_frame,			/* number of bytes per frame compressed */
+											 1,							/* number of channels represented */
+											 1,							/* number of frames per network packet */
+											 switch_raw_init,			/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,			/* function to encode raw data into encoded data */
+											 switch_raw_decode,			/* function to decode encoded data into raw data */
+											 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
+		
+		samples_per_frame += 240;
+		bytes_per_frame += 480;
+		ms_per_frame += 20000;
+		
+	}
+
+	samples_per_frame = 480;
+	bytes_per_frame = 960;
+	ms_per_frame = 20000;
+
+	for (x = 0; x < 3; x++) {
+		switch_core_codec_add_implementation(pool, codec_interface,
+											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10, 						/* the IANA code number */
+											 "L16",						/* the IANA code name */
+											 NULL,						/* default fmtp to send (can be overridden by the init function) */
+											 24000,						/* samples transferred per second */
+											 24000,						/* actual samples transferred per second */
+											 384000,					/* bits transferred per second */
+											 ms_per_frame,				/* number of microseconds per frame */
+											 samples_per_frame,			/* number of samples per frame */
+											 bytes_per_frame,			/* number of bytes per frame decompressed */
+											 bytes_per_frame,			/* number of bytes per frame compressed */
+											 1,							/* number of channels represented */
+											 1,							/* number of frames per network packet */
+											 switch_raw_init,			/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,			/* function to encode raw data into encoded data */
+											 switch_raw_decode,			/* function to decode encoded data into raw data */
+											 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
+		
+		samples_per_frame += 480;
+		bytes_per_frame += 960;
+		ms_per_frame += 20000;
+		
+	}
+
 	/* these formats below are for file playing. */
 
 	samples_per_frame = 96;
@@ -451,8 +512,6 @@
 		
 	}
 
-
-
 	samples_per_frame = 32;
 	bytes_per_frame = 64;
 	ms_per_frame = 2000;