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

@@ -44,9 +44,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define BUFFER_SAMPLES 8096 /* size for the translation buffers */
/* Sample frame data */
#include "slin_adpcm_ex.h"
#include "adpcm_slin_ex.h"
#include "asterisk/slin.h"
#include "ex_adpcm.h"
/*
* Step size index shift table
@@ -285,43 +284,12 @@ static struct ast_frame *lintoadpcm_frameout(struct ast_trans_pvt *pvt)
}
/*! \brief AdpcmToLin_Sample */
static struct ast_frame *adpcmtolin_sample(void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_ADPCM;
f.datalen = sizeof(adpcm_slin_ex);
f.samples = sizeof(adpcm_slin_ex) * 2;
f.mallocd = 0;
f.offset = 0;
f.src = __PRETTY_FUNCTION__;
f.data.ptr = adpcm_slin_ex;
return &f;
}
/*! \brief LinToAdpcm_Sample */
static struct ast_frame *lintoadpcm_sample(void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_SLINEAR;
f.datalen = sizeof(slin_adpcm_ex);
/* Assume 8000 Hz */
f.samples = sizeof(slin_adpcm_ex) / 2;
f.mallocd = 0;
f.offset = 0;
f.src = __PRETTY_FUNCTION__;
f.data.ptr = slin_adpcm_ex;
return &f;
}
static struct ast_translator adpcmtolin = {
.name = "adpcmtolin",
.srcfmt = AST_FORMAT_ADPCM,
.dstfmt = AST_FORMAT_SLINEAR,
.framein = adpcmtolin_framein,
.sample = adpcmtolin_sample,
.sample = adpcm_sample,
.desc_size = sizeof(struct adpcm_decoder_pvt),
.buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES * 2,
@@ -334,7 +302,7 @@ static struct ast_translator lintoadpcm = {
.dstfmt = AST_FORMAT_ADPCM,
.framein = lintoadpcm_framein,
.frameout = lintoadpcm_frameout,
.sample = lintoadpcm_sample,
.sample = slin8_sample,
.desc_size = sizeof (struct adpcm_encoder_pvt),
.buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES/ 2, /* 2 samples per byte */