40 #if defined(__Darwin__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__)
48 #include <libresample.h>
55 #define RESAMPLER_QUALITY 1
57 #define OUTBUF_SIZE 8096
112 int total_in_buf_used = 0;
113 int total_out_buf_used = 0;
114 int16_t *in_buf = (int16_t *) f->
data.
ptr;
117 float out_buf_f[2048];
122 in_buf_f[i] = in_buf[i] * (FLT_MAX / SHRT_MAX);
124 while (total_in_buf_used < f->samples) {
125 int in_buf_used, out_buf_used;
127 out_buf_used = resample_process(resampler, resample_factor,
128 &in_buf_f[total_in_buf_used], f->
samples - total_in_buf_used,
130 &out_buf_f[total_out_buf_used],
ARRAY_LEN(out_buf_f) - total_out_buf_used);
132 if (out_buf_used < 0)
135 total_out_buf_used += out_buf_used;
136 total_in_buf_used += in_buf_used;
138 if (total_out_buf_used ==
ARRAY_LEN(out_buf_f)) {
145 for (i = 0; i < total_out_buf_used; i++)
146 out_buf[i] = out_buf_f[i] * (SHRT_MAX / FLT_MAX);
148 pvt->
samples += total_out_buf_used;
149 pvt->
datalen += (total_out_buf_used *
sizeof(int16_t));
173 .
name =
"slin16_to_slin8",
186 .
name =
"slin8_to_slin16",
int datalen
actual space used in outbuf
#define AST_MODULE_INFO_STANDARD(keystr, desc)
static int slin8_to_slin16_new(struct ast_trans_pvt *pvt)
Asterisk main include file. File version handling, generic pbx functions.
union ast_trans_pvt::@213 outbuf
Descriptor of a translator.
Support for translation of data formats. translate.c.
static void slin8_to_slin16_destroy(struct ast_trans_pvt *pvt)
static struct ast_frame * slin8_sample(void)
static int slin8_to_slin16_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
static int load_module(void)
static struct ast_frame * slin16_sample(void)
#define RESAMPLER_QUALITY
static int slin16_to_slin8_new(struct ast_trans_pvt *pvt)
#define ast_register_translator(t)
See __ast_register_translator()
int ast_unregister_translator(struct ast_translator *t)
Unregister a translator Unregisters the given tranlator.
#define AST_FORMAT_SLINEAR16
static struct ast_translator slin8_to_slin16
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
static int slin16_to_slin8_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static struct ast_translator slin16_to_slin8
static int resample_frame(struct ast_trans_pvt *pvt, void *resampler, float resample_factor, struct ast_frame *f)
static void slin16_to_slin8_destroy(struct ast_trans_pvt *pvt)
#define AST_FORMAT_SLINEAR
static int unload_module(void)
Data structure associated with a single frame of data.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
union ast_frame::@172 data
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.