aboutsummaryrefslogtreecommitdiffstats
path: root/codecs
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-11-04 14:05:12 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-11-04 14:05:12 +0000
commit3bacd4082e2d3a2dd5b8b13635df956aa4f415cd (patch)
treedd3bc244b8a45aacb932109dc8c12d1f21769d55 /codecs
parent1d3ce2ae5f81e30ec0704efe840bc2c9a24c7e8a (diff)
Expand codec bitfield from 32 bits to 64 bits.
Reviewboard: https://reviewboard.asterisk.org/r/416/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@227580 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs')
-rw-r--r--codecs/codec_dahdi.c12
-rw-r--r--codecs/codec_ulaw.c29
-rw-r--r--codecs/ex_adpcm.h2
-rw-r--r--codecs/ex_alaw.h2
-rw-r--r--codecs/ex_g722.h2
-rw-r--r--codecs/ex_g726.h2
-rw-r--r--codecs/ex_gsm.h2
-rw-r--r--codecs/ex_ilbc.h2
-rw-r--r--codecs/ex_lpc10.h2
-rw-r--r--codecs/ex_speex.h2
-rw-r--r--codecs/ex_ulaw.h2
11 files changed, 42 insertions, 17 deletions
diff --git a/codecs/codec_dahdi.c b/codecs/codec_dahdi.c
index eada4c2fd..506c038e4 100644
--- a/codecs/codec_dahdi.c
+++ b/codecs/codec_dahdi.c
@@ -181,7 +181,7 @@ static int dahdi_encoder_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
struct codec_dahdi_pvt *dahdip = pvt->pvt;
- if (!f->subclass) {
+ if (!f->subclass.codec) {
/* We're just faking a return for calculation purposes. */
dahdip->fake = 2;
pvt->samples = f->samples;
@@ -229,7 +229,7 @@ static struct ast_frame *dahdi_encoder_frameout(struct ast_trans_pvt *pvt)
if (2 == dahdip->fake) {
dahdip->fake = 1;
pvt->f.frametype = AST_FRAME_VOICE;
- pvt->f.subclass = 0;
+ pvt->f.subclass.codec = 0;
pvt->f.samples = dahdip->required_samples;
pvt->f.data.ptr = NULL;
pvt->f.offset = 0;
@@ -257,7 +257,7 @@ static struct ast_frame *dahdi_encoder_frameout(struct ast_trans_pvt *pvt)
pvt->f.datalen = res;
pvt->f.samples = dahdip->required_samples;
pvt->f.frametype = AST_FRAME_VOICE;
- pvt->f.subclass = 1 << (pvt->t->dstfmt);
+ pvt->f.subclass.codec = 1 << (pvt->t->dstfmt);
pvt->f.mallocd = 0;
pvt->f.offset = AST_FRIENDLY_OFFSET;
pvt->f.src = pvt->t->name;
@@ -276,7 +276,7 @@ static int dahdi_decoder_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
struct codec_dahdi_pvt *dahdip = pvt->pvt;
- if (!f->subclass) {
+ if (!f->subclass.codec) {
/* We're just faking a return for calculation purposes. */
dahdip->fake = 2;
pvt->samples = f->samples;
@@ -302,7 +302,7 @@ static struct ast_frame *dahdi_decoder_frameout(struct ast_trans_pvt *pvt)
if (2 == dahdip->fake) {
dahdip->fake = 1;
pvt->f.frametype = AST_FRAME_VOICE;
- pvt->f.subclass = 0;
+ pvt->f.subclass.codec = 0;
pvt->f.samples = dahdip->required_samples;
pvt->f.data.ptr = NULL;
pvt->f.offset = 0;
@@ -340,7 +340,7 @@ static struct ast_frame *dahdi_decoder_frameout(struct ast_trans_pvt *pvt)
}
pvt->datalen = 0;
pvt->f.frametype = AST_FRAME_VOICE;
- pvt->f.subclass = 1 << (pvt->t->dstfmt);
+ pvt->f.subclass.codec = 1 << (pvt->t->dstfmt);
pvt->f.mallocd = 0;
pvt->f.offset = AST_FRIENDLY_OFFSET;
pvt->f.src = pvt->t->name;
diff --git a/codecs/codec_ulaw.c b/codecs/codec_ulaw.c
index 4d1c8a1ae..9ed9d550d 100644
--- a/codecs/codec_ulaw.c
+++ b/codecs/codec_ulaw.c
@@ -87,6 +87,17 @@ static struct ast_translator ulawtolin = {
.plc_samples = 160,
};
+static struct ast_translator testlawtolin = {
+ .name = "testlawtolin",
+ .srcfmt = AST_FORMAT_TESTLAW,
+ .dstfmt = AST_FORMAT_SLINEAR,
+ .framein = ulawtolin_framein,
+ .sample = ulaw_sample,
+ .buffer_samples = BUFFER_SAMPLES,
+ .buf_size = BUFFER_SAMPLES * 2,
+ .plc_samples = 160,
+};
+
/*!
* \brief The complete translator for LinToulaw.
*/
@@ -101,6 +112,16 @@ static struct ast_translator lintoulaw = {
.buffer_samples = BUFFER_SAMPLES,
};
+static struct ast_translator lintotestlaw = {
+ .name = "lintotestlaw",
+ .srcfmt = AST_FORMAT_SLINEAR,
+ .dstfmt = AST_FORMAT_TESTLAW,
+ .framein = lintoulaw_framein,
+ .sample = slin8_sample,
+ .buf_size = BUFFER_SAMPLES,
+ .buffer_samples = BUFFER_SAMPLES,
+};
+
static int parse_config(int reload)
{
struct ast_variable *var;
@@ -131,6 +152,8 @@ static int unload_module(void)
res = ast_unregister_translator(&lintoulaw);
res |= ast_unregister_translator(&ulawtolin);
+ res |= ast_unregister_translator(&testlawtolin);
+ res |= ast_unregister_translator(&lintotestlaw);
return res;
}
@@ -142,9 +165,11 @@ static int load_module(void)
if (parse_config(0))
return AST_MODULE_LOAD_DECLINE;
res = ast_register_translator(&ulawtolin);
- if (!res)
+ if (!res) {
res = ast_register_translator(&lintoulaw);
- else
+ res |= ast_register_translator(&lintotestlaw);
+ res |= ast_register_translator(&testlawtolin);
+ } else
ast_unregister_translator(&ulawtolin);
if (res)
return AST_MODULE_LOAD_FAILURE;
diff --git a/codecs/ex_adpcm.h b/codecs/ex_adpcm.h
index e1db64c83..8a1a5eea9 100644
--- a/codecs/ex_adpcm.h
+++ b/codecs/ex_adpcm.h
@@ -19,7 +19,7 @@ static struct ast_frame *adpcm_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_ADPCM,
+ .subclass.codec = AST_FORMAT_ADPCM,
.datalen = sizeof(ex_adpcm),
.samples = ARRAY_LEN(ex_adpcm) * 2,
.mallocd = 0,
diff --git a/codecs/ex_alaw.h b/codecs/ex_alaw.h
index 66a904ca2..5a03111fa 100644
--- a/codecs/ex_alaw.h
+++ b/codecs/ex_alaw.h
@@ -24,7 +24,7 @@ static struct ast_frame *alaw_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_ALAW,
+ .subclass.codec = AST_FORMAT_ALAW,
.datalen = sizeof(ex_alaw),
.samples = ARRAY_LEN(ex_alaw),
.mallocd = 0,
diff --git a/codecs/ex_g722.h b/codecs/ex_g722.h
index 8b0b0ff92..61146909e 100644
--- a/codecs/ex_g722.h
+++ b/codecs/ex_g722.h
@@ -34,7 +34,7 @@ static struct ast_frame *g722_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_G722,
+ .subclass.codec = AST_FORMAT_G722,
.datalen = sizeof(ex_g722),
.samples = ARRAY_LEN(ex_g722),
.mallocd = 0,
diff --git a/codecs/ex_g726.h b/codecs/ex_g726.h
index d74844d0a..622418a27 100644
--- a/codecs/ex_g726.h
+++ b/codecs/ex_g726.h
@@ -19,7 +19,7 @@ static struct ast_frame *g726_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_G726,
+ .subclass.codec = AST_FORMAT_G726,
.datalen = sizeof(ex_g726),
.samples = ARRAY_LEN(ex_g726) * 2, /* 2 samples per byte */
.mallocd = 0,
diff --git a/codecs/ex_gsm.h b/codecs/ex_gsm.h
index c9180135e..0e4cffab0 100644
--- a/codecs/ex_gsm.h
+++ b/codecs/ex_gsm.h
@@ -18,7 +18,7 @@ static struct ast_frame *gsm_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_GSM,
+ .subclass.codec = AST_FORMAT_GSM,
.datalen = sizeof(ex_gsm),
/* All frames are 20 ms long */
.samples = GSM_SAMPLES,
diff --git a/codecs/ex_ilbc.h b/codecs/ex_ilbc.h
index c72b1f27f..376aa37ec 100644
--- a/codecs/ex_ilbc.h
+++ b/codecs/ex_ilbc.h
@@ -19,7 +19,7 @@ static struct ast_frame *ilbc_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_ILBC,
+ .subclass.codec = AST_FORMAT_ILBC,
.datalen = sizeof(ex_ilbc),
/* All frames are 30 ms long */
.samples = ILBC_SAMPLES,
diff --git a/codecs/ex_lpc10.h b/codecs/ex_lpc10.h
index a44791bb3..9c2ded88b 100644
--- a/codecs/ex_lpc10.h
+++ b/codecs/ex_lpc10.h
@@ -15,7 +15,7 @@ static struct ast_frame *lpc10_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_LPC10,
+ .subclass.codec = AST_FORMAT_LPC10,
.datalen = sizeof(ex_lpc10),
/* All frames are 22 ms long (maybe a little more -- why did he choose
LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
diff --git a/codecs/ex_speex.h b/codecs/ex_speex.h
index 61bd4ca4f..36c91ae4c 100644
--- a/codecs/ex_speex.h
+++ b/codecs/ex_speex.h
@@ -18,7 +18,7 @@ static struct ast_frame *speex_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_SPEEX,
+ .subclass.codec = AST_FORMAT_SPEEX,
.datalen = sizeof(ex_speex),
/* All frames are 20 ms long */
.samples = SPEEX_SAMPLES,
diff --git a/codecs/ex_ulaw.h b/codecs/ex_ulaw.h
index a34c2702b..b3970f5f8 100644
--- a/codecs/ex_ulaw.h
+++ b/codecs/ex_ulaw.h
@@ -24,7 +24,7 @@ static struct ast_frame *ulaw_sample(void)
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_ULAW,
+ .subclass.codec = AST_FORMAT_ULAW,
.datalen = sizeof(ex_ulaw),
.samples = ARRAY_LEN(ex_ulaw),
.mallocd = 0,