mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Version 0.3.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -125,7 +125,7 @@ alawtoulaw_frameout (struct ast_translator_pvt *pvt)
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_ULAW;
|
||||
tmp->f.datalen = tmp->tail;
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -172,7 +172,7 @@ ulawtoalaw_frameout (struct ast_translator_pvt *pvt)
|
||||
if (tmp->tail) {
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_ALAW;
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -195,7 +195,7 @@ alawtoulaw_sample ()
|
||||
f.frametype = AST_FRAME_VOICE;
|
||||
f.subclass = AST_FORMAT_ALAW;
|
||||
f.datalen = sizeof (ulaw_slin_ex);
|
||||
f.timelen = sizeof(ulaw_slin_ex) / 8;
|
||||
f.samples = sizeof(ulaw_slin_ex);
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -210,7 +210,7 @@ ulawtoalaw_sample ()
|
||||
f.frametype = AST_FRAME_VOICE;
|
||||
f.subclass = AST_FORMAT_ULAW;
|
||||
f.datalen = sizeof (ulaw_slin_ex);
|
||||
f.timelen = sizeof(ulaw_slin_ex) / 8;
|
||||
f.samples = sizeof(ulaw_slin_ex);
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
|
@@ -290,7 +290,7 @@ adpcmtolin_framein (struct ast_translator_pvt *pvt, struct ast_frame *f)
|
||||
*
|
||||
* Results:
|
||||
* Converted signals are placed in tmp->f.data, tmp->f.datalen
|
||||
* and tmp->f.timelen are calculated.
|
||||
* and tmp->f.samples are calculated.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
@@ -307,7 +307,7 @@ adpcmtolin_frameout (struct ast_translator_pvt *pvt)
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_SLINEAR;
|
||||
tmp->f.datalen = tmp->tail *2;
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -383,7 +383,7 @@ lintoadpcm_frameout (struct ast_translator_pvt *pvt)
|
||||
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_ADPCM;
|
||||
tmp->f.timelen = i_max / 8;
|
||||
tmp->f.samples = i_max;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -417,7 +417,7 @@ adpcmtolin_sample ()
|
||||
f.frametype = AST_FRAME_VOICE;
|
||||
f.subclass = AST_FORMAT_ADPCM;
|
||||
f.datalen = sizeof (adpcm_slin_ex);
|
||||
f.timelen = sizeof(adpcm_slin_ex) / 4;
|
||||
f.samples = sizeof(adpcm_slin_ex) * 2;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -437,7 +437,7 @@ lintoadpcm_sample ()
|
||||
f.subclass = AST_FORMAT_SLINEAR;
|
||||
f.datalen = sizeof (slin_adpcm_ex);
|
||||
/* Assume 8000 Hz */
|
||||
f.timelen = sizeof (slin_adpcm_ex) / 16;
|
||||
f.samples = sizeof (slin_adpcm_ex) / 2;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
|
@@ -151,7 +151,7 @@ alawtolin_framein (struct ast_translator_pvt *pvt, struct ast_frame *f)
|
||||
*
|
||||
* Results:
|
||||
* Converted signals are placed in tmp->f.data, tmp->f.datalen
|
||||
* and tmp->f.timelen are calculated.
|
||||
* and tmp->f.samples are calculated.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
@@ -168,7 +168,7 @@ alawtolin_frameout (struct ast_translator_pvt *pvt)
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_SLINEAR;
|
||||
tmp->f.datalen = tmp->tail *2;
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -226,7 +226,7 @@ lintoalaw_frameout (struct ast_translator_pvt *pvt)
|
||||
if (tmp->tail) {
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_ALAW;
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -249,7 +249,7 @@ alawtolin_sample ()
|
||||
f.frametype = AST_FRAME_VOICE;
|
||||
f.subclass = AST_FORMAT_ALAW;
|
||||
f.datalen = sizeof (ulaw_slin_ex);
|
||||
f.timelen = sizeof(ulaw_slin_ex) / 8;
|
||||
f.samples = sizeof(ulaw_slin_ex);
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -269,7 +269,7 @@ lintoalaw_sample ()
|
||||
f.subclass = AST_FORMAT_SLINEAR;
|
||||
f.datalen = sizeof (slin_ulaw_ex);
|
||||
/* Assume 8000 Hz */
|
||||
f.timelen = sizeof (slin_ulaw_ex) / 16;
|
||||
f.samples = sizeof (slin_ulaw_ex) / 2;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
|
@@ -79,7 +79,7 @@ static struct ast_frame *lintogsm_sample()
|
||||
f.subclass = AST_FORMAT_SLINEAR;
|
||||
f.datalen = sizeof(slin_gsm_ex);
|
||||
/* Assume 8000 Hz */
|
||||
f.timelen = sizeof(slin_gsm_ex)/16;
|
||||
f.samples = sizeof(slin_gsm_ex)/2;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -94,7 +94,7 @@ static struct ast_frame *gsmtolin_sample()
|
||||
f.subclass = AST_FORMAT_GSM;
|
||||
f.datalen = sizeof(gsm_slin_ex);
|
||||
/* All frames are 20 ms long */
|
||||
f.timelen = 20;
|
||||
f.samples = 160;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -112,7 +112,7 @@ static struct ast_frame *gsmtolin_frameout(struct ast_translator_pvt *tmp)
|
||||
tmp->f.subclass = AST_FORMAT_SLINEAR;
|
||||
tmp->f.datalen = tmp->tail * 2;
|
||||
/* Assume 8000 Hz */
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -190,7 +190,7 @@ static struct ast_frame *lintogsm_frameout(struct ast_translator_pvt *tmp)
|
||||
x++;
|
||||
}
|
||||
tmp->f.datalen = x * 33;
|
||||
tmp->f.timelen = x * 20;
|
||||
tmp->f.samples = x * 160;
|
||||
return &tmp->f;
|
||||
}
|
||||
|
||||
|
@@ -100,14 +100,11 @@ static struct ast_translator_pvt *lpc10_dec_new()
|
||||
static struct ast_frame *lintolpc10_sample()
|
||||
{
|
||||
static struct ast_frame f;
|
||||
static int longer = 0;
|
||||
f.frametype = AST_FRAME_VOICE;
|
||||
f.subclass = AST_FORMAT_SLINEAR;
|
||||
f.datalen = sizeof(slin_lpc10_ex);
|
||||
/* Assume 8000 Hz */
|
||||
f.timelen = LPC10_SAMPLES_PER_FRAME/8;
|
||||
f.timelen += longer;
|
||||
longer = 1- longer;
|
||||
f.samples = LPC10_SAMPLES_PER_FRAME;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -123,7 +120,7 @@ static struct ast_frame *lpc10tolin_sample()
|
||||
f.datalen = sizeof(lpc10_slin_ex);
|
||||
/* All frames are 22 ms long (maybe a little more -- why did he choose
|
||||
LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
|
||||
f.timelen = LPC10_SAMPLES_PER_FRAME/8;
|
||||
f.samples = LPC10_SAMPLES_PER_FRAME;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -141,7 +138,7 @@ static struct ast_frame *lpc10tolin_frameout(struct ast_translator_pvt *tmp)
|
||||
tmp->f.subclass = AST_FORMAT_SLINEAR;
|
||||
tmp->f.datalen = tmp->tail * 2;
|
||||
/* Assume 8000 Hz */
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -254,7 +251,7 @@ static struct ast_frame *lintolpc10_frameout(struct ast_translator_pvt *tmp)
|
||||
if (tmp->tail < LPC10_SAMPLES_PER_FRAME)
|
||||
return NULL;
|
||||
/* Start with an empty frame */
|
||||
tmp->f.timelen = 0;
|
||||
tmp->f.samples = 0;
|
||||
tmp->f.datalen = 0;
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_LPC10;
|
||||
@@ -270,9 +267,7 @@ static struct ast_frame *lintolpc10_frameout(struct ast_translator_pvt *tmp)
|
||||
lpc10_encode(tmpbuf, bits, tmp->lpc10.enc);
|
||||
build_bits(((unsigned char *)tmp->outbuf) + tmp->f.datalen, bits);
|
||||
tmp->f.datalen += LPC10_BYTES_IN_COMPRESSED_FRAME;
|
||||
tmp->f.timelen += 22;
|
||||
/* We alternate between 22 and 23 ms to simulate 22.5 ms */
|
||||
tmp->f.timelen += tmp->longer;
|
||||
tmp->f.samples += LPC10_SAMPLES_PER_FRAME;
|
||||
/* Use one of the two left over bits to record if this is a 22 or 23 ms frame...
|
||||
important for IAX use */
|
||||
tmp->longer = 1 - tmp->longer;
|
||||
|
@@ -101,7 +101,7 @@ static struct ast_frame *mp3tolin_sample()
|
||||
f.data = mp3_slin_ex;
|
||||
f.datalen = sizeof(mp3_slin_ex);
|
||||
/* Dunno how long an mp3 frame is -- kinda irrelevant anyway */
|
||||
f.timelen = 30;
|
||||
f.samples = 240;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -118,7 +118,7 @@ static struct ast_frame *mp3tolin_frameout(struct ast_translator_pvt *tmp)
|
||||
tmp->f.subclass = AST_FORMAT_SLINEAR;
|
||||
tmp->f.datalen = tmp->tail * 2;
|
||||
/* Assume 8000 Hz */
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
|
@@ -151,7 +151,7 @@ ulawtolin_framein (struct ast_translator_pvt *pvt, struct ast_frame *f)
|
||||
*
|
||||
* Results:
|
||||
* Converted signals are placed in tmp->f.data, tmp->f.datalen
|
||||
* and tmp->f.timelen are calculated.
|
||||
* and tmp->f.samples are calculated.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
@@ -168,7 +168,7 @@ ulawtolin_frameout (struct ast_translator_pvt *pvt)
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_SLINEAR;
|
||||
tmp->f.datalen = tmp->tail *2;
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -226,7 +226,7 @@ lintoulaw_frameout (struct ast_translator_pvt *pvt)
|
||||
if (tmp->tail) {
|
||||
tmp->f.frametype = AST_FRAME_VOICE;
|
||||
tmp->f.subclass = AST_FORMAT_ULAW;
|
||||
tmp->f.timelen = tmp->tail / 8;
|
||||
tmp->f.samples = tmp->tail;
|
||||
tmp->f.mallocd = 0;
|
||||
tmp->f.offset = AST_FRIENDLY_OFFSET;
|
||||
tmp->f.src = __PRETTY_FUNCTION__;
|
||||
@@ -249,7 +249,7 @@ ulawtolin_sample ()
|
||||
f.frametype = AST_FRAME_VOICE;
|
||||
f.subclass = AST_FORMAT_ULAW;
|
||||
f.datalen = sizeof (ulaw_slin_ex);
|
||||
f.timelen = sizeof(ulaw_slin_ex) / 8;
|
||||
f.samples = sizeof(ulaw_slin_ex);
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
@@ -269,7 +269,7 @@ lintoulaw_sample ()
|
||||
f.subclass = AST_FORMAT_SLINEAR;
|
||||
f.datalen = sizeof (slin_ulaw_ex);
|
||||
/* Assume 8000 Hz */
|
||||
f.timelen = sizeof (slin_ulaw_ex) / 16;
|
||||
f.samples = sizeof (slin_ulaw_ex) / 2;
|
||||
f.mallocd = 0;
|
||||
f.offset = 0;
|
||||
f.src = __PRETTY_FUNCTION__;
|
||||
|
Reference in New Issue
Block a user