[svn-commits] dvossel: branch dvossel/fixtheworld_phase2 r307064 - in /team/dvossel/fixthew...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 8 15:09:54 CST 2011


Author: dvossel
Date: Tue Feb  8 15:09:49 2011
New Revision: 307064

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307064
Log:
Asterisk now supports, super, super, super wideband codecs with translation.

Introduction of 192khz, 96khz, 48khz, 44.1khz, 32khz, 24khz, 12khz
16-bit signed linear formats with translation using codec_resample.


Modified:
    team/dvossel/fixtheworld_phase2/codecs/codec_resample.c
    team/dvossel/fixtheworld_phase2/include/asterisk/format.h
    team/dvossel/fixtheworld_phase2/include/asterisk/frame.h
    team/dvossel/fixtheworld_phase2/include/asterisk/time.h
    team/dvossel/fixtheworld_phase2/include/asterisk/translate.h
    team/dvossel/fixtheworld_phase2/main/channel.c
    team/dvossel/fixtheworld_phase2/main/format.c
    team/dvossel/fixtheworld_phase2/main/translate.c
    team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c

Modified: team/dvossel/fixtheworld_phase2/codecs/codec_resample.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/codecs/codec_resample.c?view=diff&rev=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/codecs/codec_resample.c (original)
+++ team/dvossel/fixtheworld_phase2/codecs/codec_resample.c Tue Feb  8 15:09:49 2011
@@ -55,51 +55,42 @@
 
 #define OUTBUF_SIZE   8096
 
-struct slin16_to_slin8_pvt {
+struct ast_translator *translators;
+int trans_size;
+int id_list[] = {
+	AST_FORMAT_SLINEAR,
+	AST_FORMAT_SLINEAR12,
+	AST_FORMAT_SLINEAR16,
+	AST_FORMAT_SLINEAR24,
+	AST_FORMAT_SLINEAR32,
+	AST_FORMAT_SLINEAR44,
+	AST_FORMAT_SLINEAR48,
+	AST_FORMAT_SLINEAR96,
+	AST_FORMAT_SLINEAR192,
+};
+
+struct resamp_pvt {
 	void *resampler;
 	float resample_factor;
 };
 
-struct slin8_to_slin16_pvt {
-	void *resampler;
-	float resample_factor;
-};
-
-static int slin16_to_slin8_new(struct ast_trans_pvt *pvt)
-{
-	struct slin16_to_slin8_pvt *resamp_pvt = pvt->pvt;
-
-	resamp_pvt->resample_factor = 8000.0 / 16000.0;
-
-	if (!(resamp_pvt->resampler = resample_open(RESAMPLER_QUALITY, resamp_pvt->resample_factor, resamp_pvt->resample_factor)))
+static int resamp_new(struct ast_trans_pvt *pvt)
+{
+	struct resamp_pvt *resamp_pvt = pvt->pvt;
+
+	resamp_pvt->resample_factor = (float) ast_format_rate(&pvt->t->dst_format) / ast_format_rate(&pvt->t->src_format);
+
+	if (!(resamp_pvt->resampler = resample_open(RESAMPLER_QUALITY, resamp_pvt->resample_factor, resamp_pvt->resample_factor))) {
+		ast_log(LOG_WARNING, "Failed to create resample translator from %d to %d resamp factor %f\n", ast_format_rate(&pvt->t->dst_format), ast_format_rate(&pvt->t->src_format), resamp_pvt->resample_factor);
 		return -1;
+	}
 
 	return 0;
 }
 
-static int slin8_to_slin16_new(struct ast_trans_pvt *pvt)
-{
-	struct slin8_to_slin16_pvt *resamp_pvt = pvt->pvt;
-
-	resamp_pvt->resample_factor = 16000.0 / 8000.0;
-
-	if (!(resamp_pvt->resampler = resample_open(RESAMPLER_QUALITY, resamp_pvt->resample_factor, resamp_pvt->resample_factor)))
-		return -1;
-
-	return 0;
-}
-
-static void slin16_to_slin8_destroy(struct ast_trans_pvt *pvt)
-{
-	struct slin16_to_slin8_pvt *resamp_pvt = pvt->pvt;
-
-	if (resamp_pvt->resampler)
-		resample_close(resamp_pvt->resampler);
-}
-
-static void slin8_to_slin16_destroy(struct ast_trans_pvt *pvt)
-{
-	struct slin8_to_slin16_pvt *resamp_pvt = pvt->pvt;
+static void resamp_destroy(struct ast_trans_pvt *pvt)
+{
+	struct resamp_pvt *resamp_pvt = pvt->pvt;
 
 	if (resamp_pvt->resampler)
 		resample_close(resamp_pvt->resampler);
@@ -150,52 +141,24 @@
 	return res;
 }
 
-static int slin16_to_slin8_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
-{
-	struct slin16_to_slin8_pvt *resamp_pvt = pvt->pvt;
+static int resamp_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
+{
+	struct resamp_pvt *resamp_pvt = pvt->pvt;
 	void *resampler = resamp_pvt->resampler;
 	float resample_factor = resamp_pvt->resample_factor;
 
 	return resample_frame(pvt, resampler, resample_factor, f);
 }
 
-static int slin8_to_slin16_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
-{
-	struct slin8_to_slin16_pvt *resamp_pvt = pvt->pvt;
-	void *resampler = resamp_pvt->resampler;
-	float resample_factor = resamp_pvt->resample_factor;
-
-	return resample_frame(pvt, resampler, resample_factor, f);
-}
-
-static struct ast_translator slin16_to_slin8 = {
-	.name = "slin16_to_slin8",
-	.newpvt = slin16_to_slin8_new,
-	.destroy = slin16_to_slin8_destroy,
-	.framein = slin16_to_slin8_framein,
-	.sample = slin16_sample,
-	.desc_size = sizeof(struct slin16_to_slin8_pvt),
-	.buffer_samples = (OUTBUF_SIZE / sizeof(int16_t)),
-	.buf_size = OUTBUF_SIZE,
-};
-
-static struct ast_translator slin8_to_slin16 = {
-	.name = "slin8_to_slin16",
-	.newpvt = slin8_to_slin16_new,
-	.destroy = slin8_to_slin16_destroy,
-	.framein = slin8_to_slin16_framein,
-	.sample = slin8_sample,
-	.desc_size = sizeof(struct slin8_to_slin16_pvt),
-	.buffer_samples = (OUTBUF_SIZE / sizeof(int16_t)),
-	.buf_size = OUTBUF_SIZE,
-};
-
 static int unload_module(void)
 {
 	int res = 0;
-
-	res |= ast_unregister_translator(&slin16_to_slin8);
-	res |= ast_unregister_translator(&slin8_to_slin16);
+	int idx;
+
+	for (idx = 0; idx < ARRAY_LEN(translators); idx++) {
+		res |= ast_unregister_translator(&translators[idx]);
+	}
+	ast_free(translators);
 
 	return res;
 }
@@ -203,15 +166,33 @@
 static int load_module(void)
 {
 	int res = 0;
-
-	ast_format_set(&slin16_to_slin8.src_format, AST_FORMAT_SLINEAR16, 0);
-	ast_format_set(&slin16_to_slin8.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&slin8_to_slin16.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&slin8_to_slin16.dst_format, AST_FORMAT_SLINEAR16, 0);
-
-	res |= ast_register_translator(&slin16_to_slin8);
-	res |= ast_register_translator(&slin8_to_slin16);
+	int x, y, idx = 0;
+
+	trans_size = ARRAY_LEN(id_list) * ARRAY_LEN(id_list);
+	if (!(translators = ast_calloc(1, sizeof(struct ast_translator) * trans_size))) {
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
+	for (x = 0; x < ARRAY_LEN(id_list); x++) {
+		for (y = 0; y < ARRAY_LEN(id_list); y++) {
+			if (x == y) {
+				continue;
+			}
+			translators[idx].newpvt = resamp_new;
+			translators[idx].destroy = resamp_destroy;
+			translators[idx].framein = resamp_framein;
+			translators[idx].desc_size = sizeof(struct resamp_pvt);
+			translators[idx].buffer_samples = (OUTBUF_SIZE / sizeof(int16_t));
+			translators[idx].buf_size = OUTBUF_SIZE;
+			ast_format_set(&translators[idx].src_format, id_list[x], 0);
+			ast_format_set(&translators[idx].dst_format, id_list[y], 0);
+			snprintf(translators[idx].name, sizeof(translators[idx].name), "slin %dkhz -> %dkhz",
+				ast_format_rate(&translators[idx].src_format), ast_format_rate(&translators[idx].dst_format));
+			res |= ast_register_translator(&translators[idx]);
+			idx++;
+		}
+
+	}
 
 	return AST_MODULE_LOAD_SUCCESS;
 }

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=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/include/asterisk/format.h (original)
+++ team/dvossel/fixtheworld_phase2/include/asterisk/format.h Tue Feb  8 15:09:49 2011
@@ -55,34 +55,49 @@
 	AST_FORMAT_G726_AAL2        = 5 + AST_FORMAT_TYPE_AUDIO,
 	/*! ADPCM (IMA) */
 	AST_FORMAT_ADPCM            = 6 + AST_FORMAT_TYPE_AUDIO,
+	/*! LPC10, 180 samples/frame */
+	AST_FORMAT_LPC10            = 7 + AST_FORMAT_TYPE_AUDIO,
+	/*! G.729A audio */
+	AST_FORMAT_G729A            = 8 + AST_FORMAT_TYPE_AUDIO,
+	/*! SpeeX Free Compression */
+	AST_FORMAT_SPEEX            = 9 + AST_FORMAT_TYPE_AUDIO,
+	/*! iLBC Free Compression */
+	AST_FORMAT_ILBC             = 10 + AST_FORMAT_TYPE_AUDIO,
+	/*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
+	AST_FORMAT_G726             = 11 + AST_FORMAT_TYPE_AUDIO,
+	/*! G.722 */
+	AST_FORMAT_G722             = 12 + AST_FORMAT_TYPE_AUDIO,
+	/*! G.722.1 (also known as Siren7, 32kbps assumed) */
+	AST_FORMAT_SIREN7           = 13 + AST_FORMAT_TYPE_AUDIO,
+	/*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
+	AST_FORMAT_SIREN14          = 14 + AST_FORMAT_TYPE_AUDIO,
+	/*! G.719 (64 kbps assumed) */
+	AST_FORMAT_G719             = 15 + AST_FORMAT_TYPE_AUDIO,
+	/*! SpeeX Wideband (16kHz) Free Compression */
+	AST_FORMAT_SPEEX16          = 16 + AST_FORMAT_TYPE_AUDIO,
+	/*! Raw mu-law data (G.711) */
+	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          = 7 + AST_FORMAT_TYPE_AUDIO,
-	/*! LPC10, 180 samples/frame */
-	AST_FORMAT_LPC10            = 8 + AST_FORMAT_TYPE_AUDIO,
-	/*! G.729A audio */
-	AST_FORMAT_G729A            = 9 + AST_FORMAT_TYPE_AUDIO,
-	/*! SpeeX Free Compression */
-	AST_FORMAT_SPEEX            = 10 + AST_FORMAT_TYPE_AUDIO,
-	/*! iLBC Free Compression */
-	AST_FORMAT_ILBC             = 11 + AST_FORMAT_TYPE_AUDIO,
-	/*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
-	AST_FORMAT_G726             = 12 + AST_FORMAT_TYPE_AUDIO,
-	/*! G.722 */
-	AST_FORMAT_G722             = 13 + AST_FORMAT_TYPE_AUDIO,
-	/*! G.722.1 (also known as Siren7, 32kbps assumed) */
-	AST_FORMAT_SIREN7           = 14 + AST_FORMAT_TYPE_AUDIO,
-	/*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
-	AST_FORMAT_SIREN14          = 15 + AST_FORMAT_TYPE_AUDIO,
+	AST_FORMAT_SLINEAR          = 19 + AST_FORMAT_TYPE_AUDIO,
+	/*! Raw 16-bit Signed Linear (12000 Hz) PCM */
+	AST_FORMAT_SLINEAR12        = 20 + AST_FORMAT_TYPE_AUDIO,
 	/*! Raw 16-bit Signed Linear (16000 Hz) PCM */
-	AST_FORMAT_SLINEAR16        = 16 + AST_FORMAT_TYPE_AUDIO,
-	/*! G.719 (64 kbps assumed) */
-	AST_FORMAT_G719             = 17 + AST_FORMAT_TYPE_AUDIO,
-	/*! SpeeX Wideband (16kHz) Free Compression */
-	AST_FORMAT_SPEEX16          = 18 + AST_FORMAT_TYPE_AUDIO,
-	/*! Raw mu-law data (G.711) */
-	AST_FORMAT_TESTLAW          = 19 + AST_FORMAT_TYPE_AUDIO,
-	/*! SILK format */
-	AST_FORMAT_SILK             = 20 + AST_FORMAT_TYPE_AUDIO,
+	AST_FORMAT_SLINEAR16        = 21 + AST_FORMAT_TYPE_AUDIO,
+	/*! Raw 16-bit Signed Linear (24000 Hz) PCM */
+	AST_FORMAT_SLINEAR24        = 22 + AST_FORMAT_TYPE_AUDIO,
+	/*! Raw 16-bit Signed Linear (32000 Hz) PCM */
+	AST_FORMAT_SLINEAR32        = 23 + AST_FORMAT_TYPE_AUDIO,
+	/*! Raw 16-bit Signed Linear (44100 Hz) PCM just because we can. */
+	AST_FORMAT_SLINEAR44        = 24 + AST_FORMAT_TYPE_AUDIO,
+	/*! Raw 16-bit Signed Linear (48000 Hz) PCM */
+	AST_FORMAT_SLINEAR48        = 25 + AST_FORMAT_TYPE_AUDIO,
+	/*! Raw 16-bit Signed Linear (96000 Hz) PCM */
+	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,
 
 	/*! H.261 Video */
 	AST_FORMAT_H261             = 1 + AST_FORMAT_TYPE_VIDEO,
@@ -108,6 +123,7 @@
 
 /*! Determine what type of media a ast_format_id is. */
 #define AST_FORMAT_GET_TYPE(id) (((int) (id / AST_FORMAT_INC)) * AST_FORMAT_INC)
+
 
 /*! SILK format attribute key value pairs */
 enum silk_attr_keys {
@@ -374,4 +390,23 @@
  */
 int ast_format_list_init(void);
 
+/*!
+ * \brief Determine if a format is 16bit signed linear of any sample rate. 
+ */
+static force_inline int ast_format_is_slinear(const struct ast_format *format)
+{
+	if (format->id == AST_FORMAT_SLINEAR ||
+		format->id == AST_FORMAT_SLINEAR12 ||
+		format->id == AST_FORMAT_SLINEAR16 ||
+		format->id == AST_FORMAT_SLINEAR24 ||
+		format->id == AST_FORMAT_SLINEAR32 ||
+		format->id == AST_FORMAT_SLINEAR44 ||
+		format->id == AST_FORMAT_SLINEAR48 ||
+		format->id == AST_FORMAT_SLINEAR96 ||
+		format->id == AST_FORMAT_SLINEAR192) {
+		return 1;
+	}
+	return 0;
+}
+
 #endif /* _AST_FORMAT_H */

Modified: team/dvossel/fixtheworld_phase2/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/include/asterisk/frame.h?view=diff&rev=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/include/asterisk/frame.h (original)
+++ team/dvossel/fixtheworld_phase2/include/asterisk/frame.h Tue Feb  8 15:09:49 2011
@@ -577,6 +577,20 @@
 static force_inline int ast_format_rate(const struct ast_format *format)
 {
 	switch (format->id) {
+	case AST_FORMAT_SLINEAR12:
+		return 12000;
+	case AST_FORMAT_SLINEAR24:
+		return 24000;
+	case AST_FORMAT_SLINEAR32:
+		return 32000;
+	case AST_FORMAT_SLINEAR44:
+		return 44100;
+	case AST_FORMAT_SLINEAR48:
+		return 48000;
+	case AST_FORMAT_SLINEAR96:
+		return 96000;
+	case AST_FORMAT_SLINEAR192:
+		return 192000;
 	case AST_FORMAT_G722:
 	case AST_FORMAT_SLINEAR16:
 	case AST_FORMAT_SIREN7:

Modified: team/dvossel/fixtheworld_phase2/include/asterisk/time.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/include/asterisk/time.h?view=diff&rev=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/include/asterisk/time.h (original)
+++ team/dvossel/fixtheworld_phase2/include/asterisk/time.h Tue Feb  8 15:09:49 2011
@@ -171,7 +171,7 @@
 AST_INLINE_API(
 struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate),
 {
-	return ast_tv(_nsamp / _rate, ((_nsamp % _rate) * (4000000 / _rate)) / 4); /* this calculation is accurate up to 32000Hz. */
+	return ast_tv(_nsamp / _rate, (_nsamp % _rate) * (1000000 / (float) _rate));
 }
 )
 

Modified: team/dvossel/fixtheworld_phase2/include/asterisk/translate.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/include/asterisk/translate.h?view=diff&rev=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/include/asterisk/translate.h (original)
+++ team/dvossel/fixtheworld_phase2/include/asterisk/translate.h Tue Feb  8 15:09:49 2011
@@ -133,7 +133,7 @@
  * Generic plc is only available for dstfmt = SLINEAR
  */
 struct ast_translator {
-	const char name[80];                   /*!< Name of translator */
+	char name[80];                         /*!< Name of translator */
 	struct ast_format src_format;          /*!< Source format */
 	struct ast_format dst_format;          /*!< Destination format */
 

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=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/channel.c (original)
+++ team/dvossel/fixtheworld_phase2/main/channel.c Tue Feb  8 15:09:49 2011
@@ -1006,7 +1006,14 @@
 		/*! G.722 is better then all below, but not as common as the above... so give ulaw and alaw priority */
 		AST_FORMAT_G722,
 		/*! Okay, well, signed linear is easy to translate into other stuff */
+		AST_FORMAT_SLINEAR192,
+		AST_FORMAT_SLINEAR96,
+		AST_FORMAT_SLINEAR48,
+		AST_FORMAT_SLINEAR44,
+		AST_FORMAT_SLINEAR32,
+		AST_FORMAT_SLINEAR24,
 		AST_FORMAT_SLINEAR16,
+		AST_FORMAT_SLINEAR12,
 		AST_FORMAT_SLINEAR,
 		/*! G.726 is standard ADPCM, in RFC3551 packing order */
 		AST_FORMAT_G726,
@@ -5780,7 +5787,7 @@
 	 * no direct conversion available. If generic PLC is
 	 * desired, then transcoding via SLINEAR is a requirement
 	 */
-	use_slin = (best_src_fmt.id == AST_FORMAT_SLINEAR || best_dst_fmt.id == AST_FORMAT_SLINEAR);
+	use_slin = ast_format_is_slinear(&best_src_fmt) || ast_format_is_slinear(&best_dst_fmt) ? 1 : 0;
 	if ((ast_format_cmp(&best_src_fmt, &best_dst_fmt) == AST_FORMAT_CMP_NOT_EQUAL) &&
 		(ast_opt_generic_plc || ast_opt_transcode_via_slin) &&
 	    (ast_translate_path_steps(&best_dst_fmt, &best_src_fmt) != 1 || use_slin)) {
@@ -5789,8 +5796,22 @@
 			ast_format_rate(&best_src_fmt) : ast_format_rate(&best_dst_fmt);
 
 		/* pick the best signed linear format based upon what preserves the sample rate the best. */ 
-		if (best_sample_rate >= 16000) {
+		if (best_sample_rate >= 192000) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR192, 0);
+		} else if (best_sample_rate >= 96000) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR96, 0);
+		} else if (best_sample_rate >= 48000) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR48, 0);
+		} else if (best_sample_rate >= 44100) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR44, 0);
+		} else if (best_sample_rate >= 32000) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR32, 0);
+		} else if (best_sample_rate >= 24000) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR24, 0);
+		} else if (best_sample_rate >= 16000) {
 			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR16, 0);
+		} else if (best_sample_rate >= 12000) {
+			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR12, 0);
 		} else {
 			ast_format_set(&best_dst_fmt, AST_FORMAT_SLINEAR, 0);
 		}

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=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/format.c (original)
+++ team/dvossel/fixtheworld_phase2/main/format.c Tue Feb  8 15:09:49 2011
@@ -409,7 +409,7 @@
 	/*! T.140 Text format - ITU T.140, RFC 4103 */
 	case AST_FORMAT_T140:
 		return (1ULL << 27);
-	case AST_FORMAT_SILK:
+	default:
 		return 0; /* SILK IS NOT SUPPORTED BY OLD BITFIELD */
 	}
 
@@ -905,6 +905,15 @@
 	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_TESTLAW, 0), "testlaw", 8000, "G.711 test-law", 80, 10, 150, 10, 20, 0, 0);    /*!< codec_ulaw.c */
 	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_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) */
+	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR44, 0), "slin44", 44100, "16 bit Signed Linear PCM (44kHz)", 882, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE, 0);/*!< Signed linear (44.1kHz) */
+	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR48, 0), "slin48", 48000, "16 bit Signed Linear PCM (48kHz)", 960, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE, 0);/*!< Signed linear (48kHz) */
+	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR96, 0), "slin96", 96000, "16 bit Signed Linear PCM (96kHz)", 1920, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE, 0);/*!< Signed linear (96kHz) */
+	format_list_add_static(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR192, 0), "slin192", 192000, "16 bit Signed Linear PCM (192kHz)", 3840, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE, 0);/*!< Signed linear (192kHz) */
+
 	return 0;
 }
 

Modified: team/dvossel/fixtheworld_phase2/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/translate.c?view=diff&rev=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/translate.c (original)
+++ team/dvossel/fixtheworld_phase2/main/translate.c Tue Feb  8 15:09:49 2011
@@ -652,13 +652,8 @@
 		 * table cost. */
 		return 0;
 	}
-	if ((src->id == AST_FORMAT_SLINEAR) || (src->id == AST_FORMAT_SLINEAR16)) {
-		src_ll = 1;
-	}
-	if ((dst->id == AST_FORMAT_SLINEAR) || (dst->id == AST_FORMAT_SLINEAR16)) {
-		dst_ll = 1;
-	}
-
+	src_ll = ast_format_is_slinear(src);
+	dst_ll = ast_format_is_slinear(dst);
 	if (src_ll) {
 		if (dst_ll && (src_rate == dst_rate)) {
 			return AST_TRANS_COST_LL_LL_ORIGSAMP;

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=307064&r1=307063&r2=307064
==============================================================================
--- team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c (original)
+++ team/dvossel/fixtheworld_phase2/res/res_rtp_asterisk.c Tue Feb  8 15:09:49 2011
@@ -2293,7 +2293,7 @@
 
 	if (AST_FORMAT_GET_TYPE(rtp->f.subclass.format.id) == AST_FORMAT_TYPE_AUDIO) {
 		rtp->f.samples = ast_codec_get_samples(&rtp->f);
-		if ((rtp->f.subclass.format.id == AST_FORMAT_SLINEAR) || (rtp->f.subclass.format.id == AST_FORMAT_SLINEAR16)) {
+		if (ast_format_is_slinear(&rtp->f.subclass.format)) {
 			ast_frame_byteswap_be(&rtp->f);
 		}
 		calc_rxstamp(&rtp->f.delivery, rtp, timestamp, mark);




More information about the svn-commits mailing list