[asterisk-commits] dvossel: trunk r271625 - in /trunk: codecs/ contrib/editors/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 21 16:58:39 CDT 2010


Author: dvossel
Date: Mon Jun 21 16:58:33 2010
New Revision: 271625

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=271625
Log:
add speex 16khz sample frame so codec cost can be calculated

(closes issue #17534)
Reported by: fabled
Patches:
      speex-wb-sample.diff uploaded by fabled (license 448)

Modified:
    trunk/codecs/codec_speex.c
    trunk/codecs/ex_speex.h
    trunk/contrib/editors/asterisk.vim

Modified: trunk/codecs/codec_speex.c
URL: http://svnview.digium.com/svn/asterisk/trunk/codecs/codec_speex.c?view=diff&rev=271625&r1=271624&r2=271625
==============================================================================
--- trunk/codecs/codec_speex.c (original)
+++ trunk/codecs/codec_speex.c Mon Jun 21 16:58:33 2010
@@ -363,7 +363,7 @@
 	.newpvt = speexwbtolin16_new,
 	.framein = speextolin_framein,
 	.destroy = speextolin_destroy,
-	.sample = speex_sample,
+	.sample = speex16_sample,
 	.desc_size = sizeof(struct speex_coder_pvt),
 	.buffer_samples = BUFFER_SAMPLES,
 	.buf_size = BUFFER_SAMPLES * 2,
@@ -378,7 +378,7 @@
 	.framein = lintospeex_framein,
 	.frameout = lintospeex_frameout,
 	.destroy = lintospeex_destroy,
-	.sample = slin8_sample,
+	.sample = slin16_sample,
 	.desc_size = sizeof(struct speex_coder_pvt),
 	.buffer_samples = BUFFER_SAMPLES,
 	.buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */

Modified: trunk/codecs/ex_speex.h
URL: http://svnview.digium.com/svn/asterisk/trunk/codecs/ex_speex.h?view=diff&rev=271625&r1=271624&r2=271625
==============================================================================
--- trunk/codecs/ex_speex.h (original)
+++ trunk/codecs/ex_speex.h Mon Jun 21 16:58:33 2010
@@ -8,9 +8,9 @@
  */
 
 static uint8_t ex_speex[] = {
-	0x2e, 0x8e, 0x0f, 0x9a, 0x20, 0000, 0x01, 0x7f, 0xff, 0xff, 
-	0xff, 0xff, 0xff, 0x91, 0000, 0xbf, 0xff, 0xff, 0xff, 0xff, 
-	0xff, 0xdc, 0x80, 0x5f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
+	0x2e, 0x8e, 0x0f, 0x9a, 0x20, 0000, 0x01, 0x7f, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0x91, 0000, 0xbf, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xdc, 0x80, 0x5f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
 	0x98, 0x7f, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xf7, 0x80,
 };
 
@@ -30,3 +30,34 @@
 
 	return &f;
 }
+
+static uint8_t ex_speex16[] = {
+	0x3f, 0x78, 0x89, 0x14, 0x4a, 0x00, 0x00, 0x7f, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x92,
+	0x06, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xc0, 0x30, 0x5f, 0xff, 0xfd, 0xbb, 0xee,
+	0x30, 0x56, 0xff, 0xf8, 0x74, 0x54, 0x31, 0xe6, 0xfe, 0x71,
+	0xdc, 0xca, 0x44, 0x6a, 0x43, 0x75, 0xae, 0x31, 0x7a, 0x50,
+	0xd9, 0xfc, 0x93, 0x13, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+	0xab, 0xab, 0xab, 0xab, 0x3a, 0xba, 0xba, 0xba, 0xba, 0xba,
+	0xba, 0xba, 0xba, 0xba, 0xb0, 0xab, 0xab, 0xab, 0xd9, 0x37,
+	0xab, 0xab, 0xb4, 0x34, 0xe9, 0x0b, 0xd4, 0x2f, 0x13, 0x4c,
+	0xf0, 0xef, 0x8d, 0xdd, 0x99, 0xc7
+};
+
+static struct ast_frame *speex16_sample(void)
+{
+	static struct ast_frame f = {
+		.frametype = AST_FRAME_VOICE,
+		.subclass.codec = AST_FORMAT_SPEEX16,
+		.datalen = sizeof(ex_speex16),
+		/* All frames are 20 ms long */
+		.samples = SPEEX_SAMPLES,
+		.mallocd = 0,
+		.offset = 0,
+		.src = __PRETTY_FUNCTION__,
+		.data.ptr = ex_speex16,
+	};
+
+	return &f;
+}

Modified: trunk/contrib/editors/asterisk.vim
URL: http://svnview.digium.com/svn/asterisk/trunk/contrib/editors/asterisk.vim?view=diff&rev=271625&r1=271624&r2=271625
==============================================================================
--- trunk/contrib/editors/asterisk.vim (original)
+++ trunk/contrib/editors/asterisk.vim Mon Jun 21 16:58:33 2010
@@ -37,7 +37,7 @@
 syn match       asteriskFunction        "(\zs[[:alpha:]][[:alnum:]_]*(.\{-})\ze=" contains=asteriskVar,asteriskFunction,asteriskExp
 syn region      asteriskExp             matchgroup=asteriskExpStart start="\$\[" end="]" contains=asteriskVar,asteriskFunction,asteriskExp
 syn match       asteriskCodecsPermit    "^\s*\(allow\|disallow\)\s*=\s*.*$" contains=asteriskCodecs
-syn match       asteriskCodecs          "\(g723\|gsm\|ulaw\|alaw\|g726\|adpcm\|slin\|lpc10\|g729\|speex\|ilbc\|all\s*$\)"
+syn match       asteriskCodecs          "\(g723\|gsm\|ulaw\|alaw\|g726\|adpcm\|slin\|lpc10\|g729\|speex\|speex16\|ilbc\|all\s*$\)"
 syn match       asteriskError           "^\(type\|auth\|permit\|deny\|bindaddr\|host\)\s*=.*$"
 syn match       asteriskType            "^\zstype=\ze\<\(peer\|user\|friend\)\>$" contains=asteriskTypeType
 syn match       asteriskTypeType        "\<\(peer\|user\|friend\)\>" contained




More information about the asterisk-commits mailing list