summaryrefslogtreecommitdiff
path: root/codecs/codec_alaw.c
diff options
context:
space:
mode:
authorJason Parker <jparker@digium.com>2008-10-17 21:35:23 +0000
committerJason Parker <jparker@digium.com>2008-10-17 21:35:23 +0000
commitae0a736353433856d8e9eacf2a57dd23825d6005 (patch)
treec905fae44bb51b0871baf6bea17f10d715963052 /codecs/codec_alaw.c
parent805556773fe8812d7a3e5f1012bcc2d9cb98842b (diff)
Merge codec_consistency branch. This should make sample usage much happier.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@150729 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'codecs/codec_alaw.c')
-rw-r--r--codecs/codec_alaw.c41
1 files changed, 5 insertions, 36 deletions
diff --git a/codecs/codec_alaw.c b/codecs/codec_alaw.c
index 04d4048b8..4ca897820 100644
--- a/codecs/codec_alaw.c
+++ b/codecs/codec_alaw.c
@@ -35,10 +35,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define BUFFER_SAMPLES 8096 /* size for the translation buffers */
-/* Sample frame data (Mu data is okay) */
-
-#include "slin_ulaw_ex.h"
-#include "ulaw_slin_ex.h"
+/* Sample frame data */
+#include "asterisk/slin.h"
+#include "ex_alaw.h"
/*! \brief decode frame into lin and fill output buffer. */
static int alawtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
@@ -72,42 +71,12 @@ static int lintoalaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
return 0;
}
-/*! \brief alawToLin_Sample */
-static struct ast_frame *alawtolin_sample(void)
-{
- static struct ast_frame f;
- f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_ALAW;
- f.datalen = sizeof(ulaw_slin_ex);
- f.samples = sizeof(ulaw_slin_ex);
- f.mallocd = 0;
- f.offset = 0;
- f.src = __PRETTY_FUNCTION__;
- f.data.ptr = ulaw_slin_ex;
- return &f;
-}
-
-/*! \brief LinToalaw_Sample */
-static struct ast_frame *lintoalaw_sample(void)
-{
- static struct ast_frame f;
- f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_SLINEAR;
- f.datalen = sizeof(slin_ulaw_ex);
- f.samples = sizeof(slin_ulaw_ex) / 2;
- f.mallocd = 0;
- f.offset = 0;
- f.src = __PRETTY_FUNCTION__;
- f.data.ptr = slin_ulaw_ex;
- return &f;
-}
-
static struct ast_translator alawtolin = {
.name = "alawtolin",
.srcfmt = AST_FORMAT_ALAW,
.dstfmt = AST_FORMAT_SLINEAR,
.framein = alawtolin_framein,
- .sample = alawtolin_sample,
+ .sample = alaw_sample,
.buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES * 2,
.plc_samples = 160,
@@ -118,7 +87,7 @@ static struct ast_translator lintoalaw = {
.srcfmt = AST_FORMAT_SLINEAR,
.dstfmt = AST_FORMAT_ALAW,
.framein = lintoalaw_framein,
- .sample = lintoalaw_sample,
+ .sample = slin8_sample,
.buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES,
};