35 #include "asterisk/frame.h"
41 memset(sf, 0,
sizeof(*sf));
48 memset(sf, 0,
sizeof(*sf));
50 switch (sample_rate) {
79 struct ast_frame *begin_frame =
f, *duped_frame = NULL, *frame_ptr;
115 if (duped_frame != begin_frame) {
145 unsigned int sofar = 0, ineed, remain;
146 short *frame_data, *
offset = buf;
148 while (sofar < samples) {
149 ineed = samples - sofar;
160 memcpy(offset, sf->
offset, ineed *
sizeof(*offset));
169 frame_data = frame_ptr->
data.
ptr;
171 if (frame_ptr->
samples <= ineed) {
172 memcpy(offset, frame_data, frame_ptr->
samples *
sizeof(*offset));
176 remain = frame_ptr->
samples - ineed;
177 memcpy(offset, frame_data, ineed *
sizeof(*offset));
183 memcpy(sf->
hold, frame_data, remain *
sizeof(*offset));
union ast_frame_subclass subclass
Asterisk main include file. File version handling, generic pbx functions.
void ast_slinfactory_flush(struct ast_slinfactory *sf)
Flush the contents of a slinfactory.
Support for translation of data formats. translate.c.
short hold[AST_SLINFACTORY_MAX_HOLD]
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
Feed audio into a slinfactory.
struct ast_frame * ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, int consume)
translates one or more frames Apply an input frame into the translator and receive zero or one output...
struct ast_frame * ast_frisolate(struct ast_frame *fr)
Makes a frame independent of any static storage.
struct ast_trans_pvt * trans
unsigned int ast_slinfactory_available(const struct ast_slinfactory *sf)
Retrieve number of samples currently in a slinfactory.
struct ast_trans_pvt * ast_translator_build_path(format_t dest, format_t source)
Builds a translator path Build a path (possibly NULL) from source to dest.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_FORMAT_SLINEAR16
void ast_slinfactory_destroy(struct ast_slinfactory *sf)
Destroy the contents of a slinfactory.
int ast_slinfactory_init_rate(struct ast_slinfactory *sf, unsigned int sample_rate)
Initialize a slinfactory.
char * ast_getformatname(format_t format)
Get the name of a format.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
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...
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
A machine to gather up arbitrary frames and convert them to raw slinear on demand.
void ast_slinfactory_init(struct ast_slinfactory *sf)
Initialize a slinfactory.
#define AST_SLINFACTORY_MAX_HOLD
#define AST_FORMAT_SLINEAR
Data structure associated with a single frame of data.
int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
Read samples from a slinfactory.
union ast_frame::@172 data
struct ast_frame * ast_frdup(const struct ast_frame *fr)
Copies a frame.
void ast_translator_free_path(struct ast_trans_pvt *tr)
Frees a translator path Frees the given translator path structure.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.