summaryrefslogtreecommitdiff
path: root/codecs/codec_gsm.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_gsm.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_gsm.c')
-rw-r--r--codecs/codec_gsm.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/codecs/codec_gsm.c b/codecs/codec_gsm.c
index 1664632a4..03ea4bc21 100644
--- a/codecs/codec_gsm.c
+++ b/codecs/codec_gsm.c
@@ -47,15 +47,15 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "../formats/msgsm.h"
-/* Sample frame data */
-#include "slin_gsm_ex.h"
-#include "gsm_slin_ex.h"
-
#define BUFFER_SAMPLES 8000
#define GSM_SAMPLES 160
#define GSM_FRAME_LEN 33
#define MSGSM_FRAME_LEN 65
+/* Sample frame data */
+#include "asterisk/slin.h"
+#include "ex_gsm.h"
+
struct gsm_translator_pvt { /* both gsm2lin and lin2gsm */
gsm gsm;
int16_t buf[BUFFER_SAMPLES]; /* lin2gsm, temporary storage */
@@ -68,36 +68,6 @@ static int gsm_new(struct ast_trans_pvt *pvt)
return (tmp->gsm = gsm_create()) ? 0 : -1;
}
-static struct ast_frame *lintogsm_sample(void)
-{
- static struct ast_frame f;
- f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_SLINEAR;
- f.datalen = sizeof(slin_gsm_ex);
- /* Assume 8000 Hz */
- f.samples = sizeof(slin_gsm_ex)/2;
- f.mallocd = 0;
- f.offset = 0;
- f.src = __PRETTY_FUNCTION__;
- f.data.ptr = slin_gsm_ex;
- return &f;
-}
-
-static struct ast_frame *gsmtolin_sample(void)
-{
- static struct ast_frame f;
- f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_GSM;
- f.datalen = sizeof(gsm_slin_ex);
- /* All frames are 20 ms long */
- f.samples = GSM_SAMPLES;
- f.mallocd = 0;
- f.offset = 0;
- f.src = __PRETTY_FUNCTION__;
- f.data.ptr = gsm_slin_ex;
- return &f;
-}
-
/*! \brief decode and store in outbuf. */
static int gsmtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
@@ -203,7 +173,7 @@ static struct ast_translator gsmtolin = {
.newpvt = gsm_new,
.framein = gsmtolin_framein,
.destroy = gsm_destroy_stuff,
- .sample = gsmtolin_sample,
+ .sample = gsm_sample,
.buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES * 2,
.desc_size = sizeof (struct gsm_translator_pvt ),
@@ -218,7 +188,7 @@ static struct ast_translator lintogsm = {
.framein = lintogsm_framein,
.frameout = lintogsm_frameout,
.destroy = gsm_destroy_stuff,
- .sample = lintogsm_sample,
+ .sample = slin8_sample,
.desc_size = sizeof (struct gsm_translator_pvt ),
.buf_size = (BUFFER_SAMPLES * GSM_FRAME_LEN + GSM_SAMPLES - 1)/GSM_SAMPLES,
};