[asterisk-commits] kpfleming: branch 1.4 r46154 - in /branches/1.4:
channels/ formats/ include/a...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Oct 24 17:26:17 MST 2006
Author: kpfleming
Date: Tue Oct 24 19:26:17 2006
New Revision: 46154
URL: http://svn.digium.com/view/asterisk?rev=46154&view=rev
Log:
add passthrough and file format support for G.722 16KHz audio (issue #5084, original patch by andrew, updated by mithraen)
Modified:
branches/1.4/channels/chan_h323.c
branches/1.4/channels/chan_iax2.c
branches/1.4/formats/format_pcm.c
branches/1.4/include/asterisk/frame.h
branches/1.4/main/frame.c
branches/1.4/main/rtp.c
branches/1.4/main/translate.c
Modified: branches/1.4/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_h323.c?rev=46154&r1=46153&r2=46154&view=diff
==============================================================================
--- branches/1.4/channels/chan_h323.c (original)
+++ branches/1.4/channels/chan_h323.c Tue Oct 24 19:26:17 2006
@@ -2995,6 +2995,8 @@
return "ULAW";
case AST_FORMAT_ALAW:
return "ALAW";
+ case AST_FORMAT_G722:
+ return "G.722";
case AST_FORMAT_ADPCM:
return "G.728";
case AST_FORMAT_G729A:
Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?rev=46154&r1=46153&r2=46154&view=diff
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Tue Oct 24 19:26:17 2006
@@ -183,7 +183,8 @@
#define IAX_CAPABILITY_MEDBANDWIDTH (IAX_CAPABILITY_FULLBANDWIDTH & \
~AST_FORMAT_SLINEAR & \
~AST_FORMAT_ULAW & \
- ~AST_FORMAT_ALAW)
+ ~AST_FORMAT_ALAW & \
+ ~AST_FORMAT_G722)
/* A modem */
#define IAX_CAPABILITY_LOWBANDWIDTH (IAX_CAPABILITY_MEDBANDWIDTH & \
~AST_FORMAT_G726 & \
Modified: branches/1.4/formats/format_pcm.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/formats/format_pcm.c?rev=46154&r1=46153&r2=46154&view=diff
==============================================================================
--- branches/1.4/formats/format_pcm.c (original)
+++ branches/1.4/formats/format_pcm.c Tue Oct 24 19:26:17 2006
@@ -443,6 +443,18 @@
.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
};
+static const struct ast_format g722_f = {
+ .name = "g722",
+ .exts = "g722",
+ .format = AST_FORMAT_G722,
+ .write = pcm_write,
+ .seek = pcm_seek,
+ .trunc = pcm_trunc,
+ .tell = pcm_tell,
+ .read = pcm_read,
+ .buf_size = (BUF_SIZE * 2) + AST_FRIENDLY_OFFSET,
+};
+
static const struct ast_format au_f = {
.name = "au",
.exts = "au",
@@ -467,14 +479,18 @@
for (index = 0; index < (sizeof(alaw_silence) / sizeof(alaw_silence[0])); index++)
alaw_silence[index] = AST_LIN2A(0);
- return ast_format_register(&pcm_f) || ast_format_register(&alaw_f)
- || ast_format_register(&au_f);
+ return ast_format_register(&pcm_f)
+ || ast_format_register(&alaw_f)
+ || ast_format_register(&au_f)
+ || ast_format_register(&g722_f);
}
static int unload_module(void)
{
- return ast_format_unregister(pcm_f.name) || ast_format_unregister(alaw_f.name)
- || ast_format_unregister(au_f.name);
+ return ast_format_unregister(pcm_f.name)
+ || ast_format_unregister(alaw_f.name)
+ || ast_format_unregister(au_f.name)
+ || ast_format_unregister(g722_f.name);
}
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw/Sun uLaw/ALaw 8khz Audio support (PCM,PCMA,AU)");
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw/Sun uLaw/ALaw 8KHz Audio support (PCM,PCMA,AU) and G.722 16Khz Audio Support");
Modified: branches/1.4/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/frame.h?rev=46154&r1=46153&r2=46154&view=diff
==============================================================================
--- branches/1.4/include/asterisk/frame.h (original)
+++ branches/1.4/include/asterisk/frame.h Tue Oct 24 19:26:17 2006
@@ -240,6 +240,8 @@
#define AST_FORMAT_ILBC (1 << 10)
/*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
#define AST_FORMAT_G726 (1 << 11)
+/*! G.722 */
+#define AST_FORMAT_G722 (1 << 12)
/*! Maximum audio format */
#define AST_FORMAT_MAX_AUDIO (1 << 15)
/*! Maximum audio mask */
Modified: branches/1.4/main/frame.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/frame.c?rev=46154&r1=46153&r2=46154&view=diff
==============================================================================
--- branches/1.4/main/frame.c (original)
+++ branches/1.4/main/frame.c Tue Oct 24 19:26:17 2006
@@ -106,14 +106,15 @@
{ 1, AST_FORMAT_GSM, "gsm" , "GSM", 33, 20, 300, 20, 20 }, /*!< 2: codec_gsm.c */
{ 1, AST_FORMAT_ULAW, "ulaw", "G.711 u-law", 80, 10, 150, 10, 20 }, /*!< 3: codec_ulaw.c */
{ 1, AST_FORMAT_ALAW, "alaw", "G.711 A-law", 80, 10, 150, 10, 20 }, /*!< 4: codec_alaw.c */
- { 1, AST_FORMAT_G726, "g726", "G.726 RFC3551", 40, 10, 300, 10, 20 },/*!< 5: codec_g726.c */
+ { 1, AST_FORMAT_G726, "g726", "G.726 RFC3551", 40, 10, 300, 10, 20 }, /*!< 5: codec_g726.c */
{ 1, AST_FORMAT_ADPCM, "adpcm" , "ADPCM", 40, 10, 300, 10, 20 }, /*!< 6: codec_adpcm.c */
{ 1, AST_FORMAT_SLINEAR, "slin", "16 bit Signed Linear PCM", 160, 10, 70, 10, 20, AST_SMOOTHER_FLAG_BE }, /*!< 7 */
- { 1, AST_FORMAT_LPC10, "lpc10", "LPC10", 7, 20, 20, 20, 20 }, /*!< 8: codec_lpc10.c */
+ { 1, AST_FORMAT_LPC10, "lpc10", "LPC10", 7, 20, 20, 20, 20 }, /*!< 8: codec_lpc10.c */
{ 1, AST_FORMAT_G729A, "g729", "G.729A", 10, 10, 230, 10, 20, AST_SMOOTHER_FLAG_G729 }, /*!< 9: Binary commercial distribution */
- { 1, AST_FORMAT_SPEEX, "speex", "SpeeX", 10, 10, 60, 10, 20 }, /*!< 10: codec_speex.c */
+ { 1, AST_FORMAT_SPEEX, "speex", "SpeeX", 10, 10, 60, 10, 20 }, /*!< 10: codec_speex.c */
{ 1, AST_FORMAT_ILBC, "ilbc", "iLBC", 50, 30, 30, 30, 30 }, /*!< 11: codec_ilbc.c */ /* inc=30ms - workaround */
{ 1, AST_FORMAT_G726_AAL2, "g726aal2", "G.726 AAL2", 40, 10, 300, 10, 20 }, /*!< 12: codec_g726.c */
+ { 1, AST_FORMAT_G722, "g722", "G722"}, /*!< 13 */
{ 0, 0, "nothing", "undefined" },
{ 0, 0, "nothing", "undefined" },
{ 0, 0, "nothing", "undefined" },
@@ -611,7 +612,7 @@
ast_cli(fd, "--------------------------------------------------------------------------------\n");
if ((argc == 2) || (!strcasecmp(argv[1],"audio"))) {
found = 1;
- for (i=0;i<12;i++) {
+ for (i=0;i<13;i++) {
snprintf(hex,25,"(0x%x)",1<<i);
ast_cli(fd, "%11u (1 << %2d) %10s audio %8s (%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
}
@@ -1471,6 +1472,7 @@
break;
case AST_FORMAT_ULAW:
case AST_FORMAT_ALAW:
+ case AST_FORMAT_G722:
samples = f->datalen;
break;
case AST_FORMAT_ADPCM:
Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?rev=46154&r1=46153&r2=46154&view=diff
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Tue Oct 24 19:26:17 2006
@@ -1273,6 +1273,7 @@
{{1, AST_FORMAT_G729A}, "audio", "G729"},
{{1, AST_FORMAT_SPEEX}, "audio", "speex"},
{{1, AST_FORMAT_ILBC}, "audio", "iLBC"},
+ {{1, AST_FORMAT_G722}, "audio", "G722"},
{{1, AST_FORMAT_G726_AAL2}, "audio", "AAL2-G726-32"},
{{0, AST_RTP_DTMF}, "audio", "telephone-event"},
{{0, AST_RTP_CISCO_DTMF}, "audio", "cisco-telephone-event"},
@@ -1299,6 +1300,7 @@
[6] = {1, AST_FORMAT_ADPCM}, /* 16 kHz */
[7] = {1, AST_FORMAT_LPC10},
[8] = {1, AST_FORMAT_ALAW},
+ [9] = {1, AST_FORMAT_G722},
[10] = {1, AST_FORMAT_SLINEAR}, /* 2 channels */
[11] = {1, AST_FORMAT_SLINEAR}, /* 1 channel */
[13] = {0, AST_RTP_CN},
Modified: branches/1.4/main/translate.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/translate.c?rev=46154&r1=46153&r2=46154&view=diff
==============================================================================
--- branches/1.4/main/translate.c (original)
+++ branches/1.4/main/translate.c Tue Oct 24 19:26:17 2006
@@ -486,7 +486,7 @@
/*! \brief CLI "show translation" command handler */
static int show_translation_deprecated(int fd, int argc, char *argv[])
{
-#define SHOW_TRANS 12
+#define SHOW_TRANS 13
int x, y, z;
int curlen = 0, longest = 0;
@@ -555,7 +555,6 @@
static int show_translation(int fd, int argc, char *argv[])
{
-#define SHOW_TRANS 12
int x, y, z;
int curlen = 0, longest = 0;
More information about the asterisk-commits
mailing list