--- include/asterisk/frame.h (svn) +++ include/asterisk/frame.h (working copy) @@ -228,6 +228,8 @@ #define AST_FORMAT_SPEEX (1 << 9) /*! iLBC Free Compression */ #define AST_FORMAT_ILBC (1 << 10) +/*! G.722 */ +#define AST_FORMAT_G722 (1 << 11) /*! Maximum audio format */ #define AST_FORMAT_MAX_AUDIO (1 << 15) /*! Maximum audio mask */ --- translate.c (svn) +++ translate.c (working copy) @@ -480,7 +480,7 @@ /*! \brief CLI "show translation" command handler */ static int show_translation(int fd, int argc, char *argv[]) { -#define SHOW_TRANS 11 +#define SHOW_TRANS 12 int x, y, z; if (argc > 4) --- formats/format_pcm.c (svn) +++ formats/format_pcm.c (working copy) @@ -445,6 +445,19 @@ .module = &mod_data, /* XXX */ }; +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, + .module = &mod_data, /* XXX */ +}; + static const struct ast_format au_f = { .name = "au", .exts = "au", @@ -470,14 +483,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 *mod) { - 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); } static const char *description(void) --- channels/chan_iax2.c (svn) +++ channels/chan_iax2.c (working copy) @@ -191,7 +191,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 & \ --- channels/chan_h323.c (svn) +++ channels/chan_h323.c (working copy) @@ -2296,6 +2296,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: --- rtp.c (svn) +++ rtp.c (working copy) @@ -1182,6 +1182,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"}, {{0, AST_RTP_DTMF}, "audio", "telephone-event"}, {{0, AST_RTP_CISCO_DTMF}, "audio", "cisco-telephone-event"}, {{0, AST_RTP_CN}, "audio", "CN"}, @@ -1207,6 +1208,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}, @@ -2358,6 +2360,7 @@ break; case AST_FORMAT_ULAW: case AST_FORMAT_ALAW: + case AST_FORMAT_G722: if (!rtp->smoother) { rtp->smoother = ast_smoother_new(160); } --- frame.c (svn) +++ frame.c (working copy) @@ -92,6 +92,7 @@ { 1, AST_FORMAT_G729A, "g729", "G.729A" }, /*!< Binary commercial distribution */ { 1, AST_FORMAT_SPEEX, "speex", "SpeeX" }, /*!< codec_speex.c */ { 1, AST_FORMAT_ILBC, "ilbc", "iLBC"}, /*!< codec_ilbc.c */ + { 1, AST_FORMAT_G722, "g722", "G722"}, /*!< codec_g722.c */ { 0, 0, "nothing", "undefined" }, { 0, 0, "nothing", "undefined" }, { 0, 0, "nothing", "undefined" }, @@ -619,7 +620,7 @@ ast_cli(fd, "--------------------------------------------------------------------------------\n"); if ((argc == 2) || (!strcasecmp(argv[1],"audio"))) { found = 1; - for (i=0;i<11;i++) { + for (i=0; i < 12; i++) { snprintf(hex,25,"(0x%x)",1<datalen; break; case AST_FORMAT_ADPCM: --- channel.c (svn) +++ channel.c (working copy) @@ -553,6 +553,8 @@ AST_FORMAT_ALAW, /*! Okay, well, signed linear is easy to translate into other stuff */ AST_FORMAT_SLINEAR, + /*! Best quality, but can't transcode */ + AST_FORMAT_G722, /*! G.726 is standard ADPCM */ AST_FORMAT_G726, /*! ADPCM has great sound quality and is still pretty easy to translate */