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
This commit is contained in:
Jason Parker
2008-10-17 21:35:23 +00:00
parent 805556773f
commit ae0a736353
37 changed files with 473 additions and 1052 deletions

View File

@@ -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,