[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase2 r307512 - in /team/dvossel/fixthew...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 10 13:04:49 CST 2011


Author: dvossel
Date: Thu Feb 10 13:04:45 2011
New Revision: 307512

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307512
Log:
Addition of speex32 with translation

Modified:
    team/dvossel/fixtheworld_phase2/CHANGES
    team/dvossel/fixtheworld_phase2/codecs/codec_speex.c
    team/dvossel/fixtheworld_phase2/include/asterisk/format.h
    team/dvossel/fixtheworld_phase2/main/channel.c
    team/dvossel/fixtheworld_phase2/main/format.c
    team/dvossel/fixtheworld_phase2/main/frame.c
    team/dvossel/fixtheworld_phase2/main/rtp_engine.c
    team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c

Modified: team/dvossel/fixtheworld_phase2/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/CHANGES?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/CHANGES (original)
+++ team/dvossel/fixtheworld_phase2/CHANGES Thu Feb 10 13:04:45 2011
@@ -39,6 +39,11 @@
 --------------------------
  * The filter option in cdr_adaptive_odbc now supports negating the argument,
    thus allowing records which do NOT match the specified filter.
+
+CODECS
+--------------------------
+ * Ability to define custom SILK formats in codecs.conf.
+ * Addition of speex32 audio format with translation.
 
 Dialplan Variables
 ------------------

Modified: team/dvossel/fixtheworld_phase2/codecs/codec_speex.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/codecs/codec_speex.c?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/codecs/codec_speex.c (original)
+++ team/dvossel/fixtheworld_phase2/codecs/codec_speex.c Thu Feb 10 13:04:45 2011
@@ -148,6 +148,11 @@
 	return speex_encoder_construct(pvt, &speex_wb_mode, 16000);
 }
 
+static int lin32tospeexuwb_new(struct ast_trans_pvt *pvt)
+{
+	return speex_encoder_construct(pvt, &speex_uwb_mode, 32000);
+}
+
 static int speex_decoder_construct(struct ast_trans_pvt *pvt, const SpeexMode *profile)
 {
 	struct speex_coder_pvt *tmp = pvt->pvt;
@@ -171,6 +176,11 @@
 static int speexwbtolin16_new(struct ast_trans_pvt *pvt)
 {
 	return speex_decoder_construct(pvt, &speex_wb_mode);
+}
+
+static int speexuwbtolin32_new(struct ast_trans_pvt *pvt)
+{
+	return speex_decoder_construct(pvt, &speex_uwb_mode);
 }
 
 /*! \brief convert and store into outbuf */
@@ -371,6 +381,28 @@
 	.frameout = lintospeex_frameout,
 	.destroy = lintospeex_destroy,
 	.sample = slin16_sample,
+	.desc_size = sizeof(struct speex_coder_pvt),
+	.buffer_samples = BUFFER_SAMPLES,
+	.buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */
+};
+
+static struct ast_translator speexuwbtospeexuwb = {
+	.name = "speexuwbtospeexuwb", 
+	.newpvt = speexuwbtolin32_new,
+	.framein = speextolin_framein,
+	.destroy = speextolin_destroy,
+	.desc_size = sizeof(struct speex_coder_pvt),
+	.buffer_samples = BUFFER_SAMPLES,
+	.buf_size = BUFFER_SAMPLES * 2,
+	.native_plc = 1,
+};
+
+static struct ast_translator lin32tospeexuwb = {
+	.name = "lin32tospeexwb", 
+	.newpvt = lin32tospeexuwb_new,
+	.framein = lintospeex_framein,
+	.frameout = lintospeex_frameout,
+	.destroy = lintospeex_destroy,
 	.desc_size = sizeof(struct speex_coder_pvt),
 	.buffer_samples = BUFFER_SAMPLES,
 	.buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */
@@ -486,6 +518,9 @@
 	res |= ast_unregister_translator(&lintospeex);
 	res |= ast_unregister_translator(&speexwbtolin16);
 	res |= ast_unregister_translator(&lin16tospeexwb);
+	res |= ast_unregister_translator(&speexuwbtospeexuwb);
+	res |= ast_unregister_translator(&lin32tospeexuwb);
+
 
 	return res;
 }
@@ -509,11 +544,20 @@
 
 	ast_format_set(&lin16tospeexwb.src_format, AST_FORMAT_SLINEAR16, 0);
 	ast_format_set(&lin16tospeexwb.dst_format, AST_FORMAT_SPEEX16, 0);
+
+	ast_format_set(&speexuwbtospeexuwb.src_format, AST_FORMAT_SPEEX32, 0);
+	ast_format_set(&speexuwbtospeexuwb.dst_format, AST_FORMAT_SLINEAR32, 0);
+
+	ast_format_set(&lin32tospeexuwb.src_format, AST_FORMAT_SLINEAR32, 0);
+	ast_format_set(&lin32tospeexuwb.dst_format, AST_FORMAT_SPEEX32, 0);
 
 	res |= ast_register_translator(&speextolin);
 	res |= ast_register_translator(&lintospeex);
 	res |= ast_register_translator(&speexwbtolin16);
 	res |= ast_register_translator(&lin16tospeexwb);
+	res |= ast_register_translator(&speexuwbtospeexuwb);
+	res |= ast_register_translator(&lin32tospeexuwb);
+
 
 	return res;
 }

Modified: team/dvossel/fixtheworld_phase2/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/include/asterisk/format.h?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/include/asterisk/format.h (original)
+++ team/dvossel/fixtheworld_phase2/include/asterisk/format.h Thu Feb 10 13:04:45 2011
@@ -80,7 +80,6 @@
 	AST_FORMAT_TESTLAW          = 17 + AST_FORMAT_TYPE_AUDIO,
 	/*! SILK format */
 	AST_FORMAT_SILK             = 18 + AST_FORMAT_TYPE_AUDIO,
-
 	/*! Raw 16-bit Signed Linear (8000 Hz) PCM */
 	AST_FORMAT_SLINEAR          = 19 + AST_FORMAT_TYPE_AUDIO,
 	/*! Raw 16-bit Signed Linear (12000 Hz) PCM */
@@ -99,6 +98,7 @@
 	AST_FORMAT_SLINEAR96        = 26 + AST_FORMAT_TYPE_AUDIO,
 	/*! Raw 16-bit Signed Linear (192000 Hz) PCM.  maybe we're taking this too far. */
 	AST_FORMAT_SLINEAR192       = 27 + AST_FORMAT_TYPE_AUDIO,
+	AST_FORMAT_SPEEX32          = 28 + AST_FORMAT_TYPE_AUDIO,
 
 	/*! H.261 Video */
 	AST_FORMAT_H261             = 1 + AST_FORMAT_TYPE_VIDEO,

Modified: team/dvossel/fixtheworld_phase2/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/channel.c?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/channel.c (original)
+++ team/dvossel/fixtheworld_phase2/main/channel.c Thu Feb 10 13:04:45 2011
@@ -1027,6 +1027,7 @@
 		/*! iLBC is not too bad */
 		AST_FORMAT_ILBC,
 		/*! Speex is free, but computationally more expensive than GSM */
+		AST_FORMAT_SPEEX32,
 		AST_FORMAT_SPEEX16,
 		AST_FORMAT_SPEEX,
 		/*! SILK is just had to go somewhere */

Modified: team/dvossel/fixtheworld_phase2/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/format.c?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/format.c (original)
+++ team/dvossel/fixtheworld_phase2/main/format.c Thu Feb 10 13:04:45 2011
@@ -687,6 +687,7 @@
 	case AST_FORMAT_SPEEX16:
 		return 16000;
 	case AST_FORMAT_SIREN14:
+	case AST_FORMAT_SPEEX32:
 		return 32000;
 	case AST_FORMAT_G719:
 		return 48000;
@@ -984,6 +985,7 @@
 	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), "g719", 48000, "ITU G.719", 160, 20, 80, 20, 20, 0, 0);
 
 	/* ORDER MAY CHANGE AFTER THIS POINT IN THE LIST */
+	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), "speex32", 32000, "SpeeX 32khz", 10, 10, 60, 10, 20, 0, 0);   /*!< codec_speex.c */
 	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR12, 0), "slin12", 12000, "16 bit Signed Linear PCM (12kHz)", 240, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE, 0);/*!< Signed linear (12kHz) */
 	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR24, 0), "slin24", 24000, "16 bit Signed Linear PCM (24kHz)", 480, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE, 0);/*!< Signed linear (24kHz) */
 	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR32, 0), "slin32", 32000, "16 bit Signed Linear PCM (32kHz)", 640, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE, 0);/*!< Signed linear (32kHz) */

Modified: team/dvossel/fixtheworld_phase2/main/frame.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/frame.c?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/frame.c (original)
+++ team/dvossel/fixtheworld_phase2/main/frame.c Thu Feb 10 13:04:45 2011
@@ -945,6 +945,9 @@
 	case AST_FORMAT_SPEEX16:
 		samples = 2 * speex_samples(f->data.ptr, f->datalen);
 		break;
+	case AST_FORMAT_SPEEX32:
+		samples = 4 * speex_samples(f->data.ptr, f->datalen);
+		break;
 	case AST_FORMAT_G723_1:
 		samples = g723_samples(f->data.ptr, f->datalen);
 		break;

Modified: team/dvossel/fixtheworld_phase2/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/rtp_engine.c?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/rtp_engine.c (original)
+++ team/dvossel/fixtheworld_phase2/main/rtp_engine.c Thu Feb 10 13:04:45 2011
@@ -1961,6 +1961,7 @@
 	set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G.729", 8000);
 	set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX, 0), 0, "audio", "speex", 8000);
 	set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0,  "audio", "speex", 16000);
+	set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0,  "audio", "speex", 32000);
 	set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ILBC, 0), 0, "audio", "iLBC", 8000);
 	/* this is the sample rate listed in the RTP profile for the G.722 codec, *NOT* the actual sample rate of the media stream */
 	set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G722, 0), 0, "audio", "G722", 8000);
@@ -2019,6 +2020,7 @@
 	add_static_payload(116, ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), 0);
 	add_static_payload(117, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0);
 	add_static_payload(118, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0); /* 16 Khz signed linear */
+	add_static_payload(119, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0);
 	add_static_payload(121, NULL, AST_RTP_CISCO_DTMF);   /* Must be type 121 */
 
 	return 0;

Modified: team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c?view=diff&rev=307512&r1=307511&r2=307512
==============================================================================
--- team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c (original)
+++ team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c Thu Feb 10 13:04:45 2011
@@ -1250,6 +1250,7 @@
 		switch (subclass.id) {
 		case AST_FORMAT_SPEEX:
 		case AST_FORMAT_SPEEX16:
+		case AST_FORMAT_SPEEX32:
 		case AST_FORMAT_SILK:
 		case AST_FORMAT_G723_1:
 		case AST_FORMAT_SIREN7:




More information about the asterisk-commits mailing list