From ba0313e902c8570c0f164892b591197ddc91b4c0 Mon Sep 17 00:00:00 2001 From: qwell Date: Fri, 17 Oct 2008 21:35:23 +0000 Subject: Merge codec_consistency branch. This should make sample usage much happier. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@150729 f38db490-d61c-443f-a65b-d21fe96a405b --- codecs/codec_a_mu.c | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'codecs/codec_a_mu.c') diff --git a/codecs/codec_a_mu.c b/codecs/codec_a_mu.c index cf0354720..9b2e40850 100644 --- a/codecs/codec_a_mu.c +++ b/codecs/codec_a_mu.c @@ -38,9 +38,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static unsigned char mu2a[256]; static unsigned char a2mu[256]; -/* Sample frame data (Mu data is okay) */ - -#include "ulaw_slin_ex.h" +/* Sample frame data */ +#include "ex_ulaw.h" +#include "ex_alaw.h" /*! \brief convert frame data and store into the buffer */ static int alawtoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) @@ -74,43 +74,12 @@ static int ulawtoalaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) return 0; } -/* - * alawToLin_Sample. Just random data, somehow... - */ -static struct ast_frame *alawtoulaw_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; /* XXX what ? */ - return &f; -} - -static struct ast_frame *ulawtoalaw_sample(void) -{ - static struct ast_frame f; - f.frametype = AST_FRAME_VOICE; - f.subclass = AST_FORMAT_ULAW; - 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; -} - static struct ast_translator alawtoulaw = { .name = "alawtoulaw", .srcfmt = AST_FORMAT_ALAW, .dstfmt = AST_FORMAT_ULAW, .framein = alawtoulaw_framein, - .sample = alawtoulaw_sample, + .sample = alaw_sample, .buffer_samples = BUFFER_SAMPLES, .buf_size = BUFFER_SAMPLES, }; @@ -120,7 +89,7 @@ static struct ast_translator ulawtoalaw = { .srcfmt = AST_FORMAT_ULAW, .dstfmt = AST_FORMAT_ALAW, .framein = ulawtoalaw_framein, - .sample = ulawtoalaw_sample, + .sample = ulaw_sample, .buffer_samples = BUFFER_SAMPLES, .buf_size = BUFFER_SAMPLES, }; -- cgit v1.2.3