aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/codec_g722.c
diff options
context:
space:
mode:
Diffstat (limited to 'codecs/codec_g722.c')
-rw-r--r--codecs/codec_g722.c72
1 files changed, 8 insertions, 64 deletions
diff --git a/codecs/codec_g722.c b/codecs/codec_g722.c
index 41e17807f..bdd175e57 100644
--- a/codecs/codec_g722.c
+++ b/codecs/codec_g722.c
@@ -46,11 +46,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define BUFFER_SAMPLES 8096 /* size for the translation buffers */
#define BUF_SHIFT 5
-/* Sample frame data */
-
#include "g722/g722.h"
-#include "slin_g722_ex.h"
-#include "g722_slin_ex.h"
+
+/* Sample frame data */
+#include "asterisk/slin.h"
+#include "ex_g722.h"
struct g722_encoder_pvt {
g722_encode_state_t g722;
@@ -132,69 +132,13 @@ static int lintog722_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
return 0;
}
-static struct ast_frame *g722tolin_sample(void)
-{
- static struct ast_frame f = {
- .frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_G722,
- .datalen = sizeof(g722_slin_ex),
- .samples = sizeof(g722_slin_ex) * 2,
- .src = __PRETTY_FUNCTION__,
- .data.ptr = g722_slin_ex,
- };
-
- return &f;
-}
-
-static struct ast_frame *g722tolin16_sample(void)
-{
- static struct ast_frame f = {
- .frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_G722,
- .datalen = sizeof(g722_slin_ex),
- .samples = sizeof(g722_slin_ex) * 2,
- .src = __PRETTY_FUNCTION__,
- .data.ptr = g722_slin_ex,
- };
-
- return &f;
-}
-
-static struct ast_frame *lintog722_sample (void)
-{
- static struct ast_frame f = {
- .frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_SLINEAR,
- .datalen = sizeof(slin_g722_ex),
- .samples = ARRAY_LEN(slin_g722_ex),
- .src = __PRETTY_FUNCTION__,
- .data.ptr = slin_g722_ex,
- };
-
- return &f;
-}
-
-static struct ast_frame *lin16tog722_sample (void)
-{
- static struct ast_frame f = {
- .frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_SLINEAR16,
- .datalen = sizeof(slin_g722_ex),
- .samples = ARRAY_LEN(slin_g722_ex),
- .src = __PRETTY_FUNCTION__,
- .data.ptr = slin_g722_ex,
- };
-
- return &f;
-}
-
static struct ast_translator g722tolin = {
.name = "g722tolin",
.srcfmt = AST_FORMAT_G722,
.dstfmt = AST_FORMAT_SLINEAR,
.newpvt = g722tolin_new, /* same for both directions */
.framein = g722tolin_framein,
- .sample = g722tolin_sample,
+ .sample = g722_sample,
.desc_size = sizeof(struct g722_decoder_pvt),
.buffer_samples = BUFFER_SAMPLES / sizeof(int16_t),
.buf_size = BUFFER_SAMPLES,
@@ -207,7 +151,7 @@ static struct ast_translator lintog722 = {
.dstfmt = AST_FORMAT_G722,
.newpvt = lintog722_new, /* same for both directions */
.framein = lintog722_framein,
- .sample = lintog722_sample,
+ .sample = slin8_sample,
.desc_size = sizeof(struct g722_encoder_pvt),
.buffer_samples = BUFFER_SAMPLES * 2,
.buf_size = BUFFER_SAMPLES,
@@ -219,7 +163,7 @@ static struct ast_translator g722tolin16 = {
.dstfmt = AST_FORMAT_SLINEAR16,
.newpvt = g722tolin16_new, /* same for both directions */
.framein = g722tolin_framein,
- .sample = g722tolin16_sample,
+ .sample = g722_sample,
.desc_size = sizeof(struct g722_decoder_pvt),
.buffer_samples = BUFFER_SAMPLES / sizeof(int16_t),
.buf_size = BUFFER_SAMPLES,
@@ -232,7 +176,7 @@ static struct ast_translator lin16tog722 = {
.dstfmt = AST_FORMAT_G722,
.newpvt = lin16tog722_new, /* same for both directions */
.framein = lintog722_framein,
- .sample = lin16tog722_sample,
+ .sample = slin16_sample,
.desc_size = sizeof(struct g722_encoder_pvt),
.buffer_samples = BUFFER_SAMPLES * 2,
.buf_size = BUFFER_SAMPLES,