aboutsummaryrefslogtreecommitdiffstats
path: root/codecs
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-11-29 02:14:13 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-11-29 02:14:13 +0000
commit69399315991bf7f9679e2d9b22f42415653cfc04 (patch)
treee3349bbc37c69394a11f4358e9af9f7a5d2a2329 /codecs
parent2d459a804c0512bbceafe63a934770c2aa3f5edd (diff)
Version 0.3.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@556 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs')
-rwxr-xr-xcodecs/codec_a_mu.c8
-rwxr-xr-xcodecs/codec_adpcm.c10
-rwxr-xr-xcodecs/codec_alaw.c10
-rwxr-xr-xcodecs/codec_gsm.c8
-rwxr-xr-xcodecs/codec_lpc10.c15
-rwxr-xr-xcodecs/codec_mp3_d.c4
-rwxr-xr-xcodecs/codec_ulaw.c10
7 files changed, 30 insertions, 35 deletions
diff --git a/codecs/codec_a_mu.c b/codecs/codec_a_mu.c
index c7d52b447..d7d6ff11e 100755
--- a/codecs/codec_a_mu.c
+++ b/codecs/codec_a_mu.c
@@ -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__;
diff --git a/codecs/codec_adpcm.c b/codecs/codec_adpcm.c
index c07aba538..fdd03675e 100755
--- a/codecs/codec_adpcm.c
+++ b/codecs/codec_adpcm.c
@@ -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__;
diff --git a/codecs/codec_alaw.c b/codecs/codec_alaw.c
index 833092365..54a464cfc 100755
--- a/codecs/codec_alaw.c
+++ b/codecs/codec_alaw.c
@@ -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__;
diff --git a/codecs/codec_gsm.c b/codecs/codec_gsm.c
index c84ee2897..6a3ff8054 100755
--- a/codecs/codec_gsm.c
+++ b/codecs/codec_gsm.c
@@ -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;
}
diff --git a/codecs/codec_lpc10.c b/codecs/codec_lpc10.c
index a2f6bd911..3ee94326c 100755
--- a/codecs/codec_lpc10.c
+++ b/codecs/codec_lpc10.c
@@ -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;
diff --git a/codecs/codec_mp3_d.c b/codecs/codec_mp3_d.c
index f417453ef..c056e1102 100755
--- a/codecs/codec_mp3_d.c
+++ b/codecs/codec_mp3_d.c
@@ -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__;
diff --git a/codecs/codec_ulaw.c b/codecs/codec_ulaw.c
index 175da76f5..2d0a06155 100755
--- a/codecs/codec_ulaw.c
+++ b/codecs/codec_ulaw.c
@@ -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__;