mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 03:04:19 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user