Merged revisions 46154 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46154 | kpfleming | 2006-10-24 19:26:17 -0500 (Tue, 24 Oct 2006) | 2 lines

add passthrough and file format support for G.722 16KHz audio (issue #5084, original patch by andrew, updated by mithraen)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Kevin P. Fleming 19 years ago
parent 9178e4223e
commit 88efcea05e

@ -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:

@ -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 & \

@ -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");

@ -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 */

@ -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:

@ -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},

@ -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;

Loading…
Cancel
Save