diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-10-17 21:35:23 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-10-17 21:35:23 +0000 |
commit | ba0313e902c8570c0f164892b591197ddc91b4c0 (patch) | |
tree | c905fae44bb51b0871baf6bea17f10d715963052 /codecs/codec_speex.c | |
parent | 236e62078c388457c14a6bbc1c007b1c83a3edd7 (diff) |
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
Diffstat (limited to 'codecs/codec_speex.c')
-rw-r--r-- | codecs/codec_speex.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c index 961aaa649..844feed2c 100644 --- a/codecs/codec_speex.c +++ b/codecs/codec_speex.c @@ -53,10 +53,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/config.h" #include "asterisk/utils.h" -/* Sample frame data */ -#include "slin_speex_ex.h" -#include "speex_slin_ex.h" - /* codec variables */ static int quality = 3; static int complexity = 2; @@ -84,6 +80,10 @@ static float pp_dereverb_level = 0.3; #define BUFFER_SAMPLES 8000 #define SPEEX_SAMPLES 160 +/* Sample frame data */ +#include "asterisk/slin.h" +#include "ex_speex.h" + struct speex_coder_pvt { void *speex; SpeexBits bits; @@ -154,36 +154,6 @@ static int speextolin_new(struct ast_trans_pvt *pvt) return 0; } -static struct ast_frame *lintospeex_sample(void) -{ - static struct ast_frame f; - f.frametype = AST_FRAME_VOICE; - f.subclass = AST_FORMAT_SLINEAR; - f.datalen = sizeof(slin_speex_ex); - /* Assume 8000 Hz */ - f.samples = sizeof(slin_speex_ex)/2; - f.mallocd = 0; - f.offset = 0; - f.src = __PRETTY_FUNCTION__; - f.data.ptr = slin_speex_ex; - return &f; -} - -static struct ast_frame *speextolin_sample(void) -{ - static struct ast_frame f; - f.frametype = AST_FRAME_VOICE; - f.subclass = AST_FORMAT_SPEEX; - f.datalen = sizeof(speex_slin_ex); - /* All frames are 20 ms long */ - f.samples = SPEEX_SAMPLES; - f.mallocd = 0; - f.offset = 0; - f.src = __PRETTY_FUNCTION__; - f.data.ptr = speex_slin_ex; - return &f; -} - /*! \brief convert and store into outbuf */ static int speextolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { @@ -346,7 +316,7 @@ static struct ast_translator speextolin = { .newpvt = speextolin_new, .framein = speextolin_framein, .destroy = speextolin_destroy, - .sample = speextolin_sample, + .sample = speex_sample, .desc_size = sizeof(struct speex_coder_pvt), .buffer_samples = BUFFER_SAMPLES, .buf_size = BUFFER_SAMPLES * 2, @@ -361,7 +331,7 @@ static struct ast_translator lintospeex = { .framein = lintospeex_framein, .frameout = lintospeex_frameout, .destroy = lintospeex_destroy, - .sample = lintospeex_sample, + .sample = slin8_sample, .desc_size = sizeof(struct speex_coder_pvt), .buffer_samples = BUFFER_SAMPLES, .buf_size = BUFFER_SAMPLES * 2, /* XXX maybe a lot less ? */ |