aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_h323.c2
-rw-r--r--channels/chan_iax2.c3
-rw-r--r--formats/format_pcm.c26
-rw-r--r--include/asterisk/frame.h2
-rw-r--r--main/frame.c8
-rw-r--r--main/rtp.c2
-rw-r--r--main/translate.c2
7 files changed, 35 insertions, 10 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 5cc7cddb0..ffb86b0d7 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -3122,6 +3122,8 @@ static char *convertcap(int cap)
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:
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index dfefcea9c..108846d6b 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -183,7 +183,8 @@ int (*iax2_regfunk)(const char *username, int onoff) = NULL;
#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 & \
diff --git a/formats/format_pcm.c b/formats/format_pcm.c
index 9ae1398e6..a3a40b7d4 100644
--- a/formats/format_pcm.c
+++ b/formats/format_pcm.c
@@ -443,6 +443,18 @@ static const struct ast_format pcm_f = {
.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 @@ static int load_module(void)
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");
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index bcc533a95..fa1c12891 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -240,6 +240,8 @@ extern struct ast_frame ast_null_frame;
#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 */
diff --git a/main/frame.c b/main/frame.c
index f797f55fa..1b18a611d 100644
--- a/main/frame.c
+++ b/main/frame.c
@@ -106,14 +106,15 @@ static struct ast_format_list AST_FORMAT_LIST[] = { /*!< Bit number: comment
{ 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" },
@@ -1356,6 +1357,7 @@ int ast_codec_get_samples(struct ast_frame *f)
break;
case AST_FORMAT_ULAW:
case AST_FORMAT_ALAW:
+ case AST_FORMAT_G722:
samples = f->datalen;
break;
case AST_FORMAT_ADPCM:
diff --git a/main/rtp.c b/main/rtp.c
index 589584dee..c34f56b11 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -1330,6 +1330,7 @@ static struct {
{{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"},
@@ -1356,6 +1357,7 @@ static struct rtpPayloadType static_RTP_PT[MAX_RTP_PT] = {
[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},
diff --git a/main/translate.c b/main/translate.c
index 7845a24f1..d130a38de 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -476,7 +476,7 @@ static void rebuild_matrix(int samples)
static int show_translation(int fd, int argc, char *argv[])
{
-#define SHOW_TRANS 12
+#define SHOW_TRANS 13
int x, y, z;
int curlen = 0, longest = 0;