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

@@ -39,8 +39,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "lpc10/lpc10.h"
/* Sample frame data */
#include "slin_lpc10_ex.h"
#include "lpc10_slin_ex.h"
#include "asterisk/slin.h"
#include "ex_lpc10.h"
/* We use a very strange format here... I have no idea why... The frames are 180
samples long, which isn't even an even number of milliseconds... Not only that
@@ -75,37 +75,6 @@ static int lpc10_dec_new(struct ast_trans_pvt *pvt)
return (tmp->lpc10.dec = create_lpc10_decoder_state()) ? 0 : -1;
}
static struct ast_frame *lintolpc10_sample(void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_SLINEAR;
f.datalen = sizeof(slin_lpc10_ex);
/* Assume 8000 Hz */
f.samples = LPC10_SAMPLES_PER_FRAME;
f.mallocd = 0;
f.offset = 0;
f.src = __PRETTY_FUNCTION__;
f.data.ptr = slin_lpc10_ex;
return &f;
}
static struct ast_frame *lpc10tolin_sample(void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_LPC10;
f.datalen = sizeof(lpc10_slin_ex);
/* All frames are 22 ms long (maybe a little more -- why did he choose
LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
f.samples = LPC10_SAMPLES_PER_FRAME;
f.mallocd = 0;
f.offset = 0;
f.src = __PRETTY_FUNCTION__;
f.data.ptr = lpc10_slin_ex;
return &f;
}
static void extract_bits(INT32 *bits, unsigned char *c)
{
int x;
@@ -229,7 +198,7 @@ static struct ast_translator lpc10tolin = {
.newpvt = lpc10_dec_new,
.framein = lpc10tolin_framein,
.destroy = lpc10_destroy,
.sample = lpc10tolin_sample,
.sample = lpc10_sample,
.desc_size = sizeof(struct lpc10_coder_pvt),
.buffer_samples = BUFFER_SAMPLES,
.plc_samples = LPC10_SAMPLES_PER_FRAME,
@@ -244,7 +213,7 @@ static struct ast_translator lintolpc10 = {
.framein = lintolpc10_framein,
.frameout = lintolpc10_frameout,
.destroy = lpc10_destroy,
.sample = lintolpc10_sample,
.sample = slin8_sample,
.desc_size = sizeof(struct lpc10_coder_pvt),
.buffer_samples = BUFFER_SAMPLES,
.buf_size = LPC10_BYTES_IN_COMPRESSED_FRAME * (1 + BUFFER_SAMPLES / LPC10_SAMPLES_PER_FRAME),