A machine to gather up arbitrary frames and convert them to raw slinear on demand. More...
Go to the source code of this file.
Data Structures | |
struct | ast_slinfactory |
Macros | |
#define | AST_SLINFACTORY_MAX_HOLD 1280 |
Functions | |
unsigned int | ast_slinfactory_available (const struct ast_slinfactory *sf) |
Retrieve number of samples currently in a slinfactory. More... | |
void | ast_slinfactory_destroy (struct ast_slinfactory *sf) |
Destroy the contents of a slinfactory. More... | |
int | ast_slinfactory_feed (struct ast_slinfactory *sf, struct ast_frame *f) |
Feed audio into a slinfactory. More... | |
void | ast_slinfactory_flush (struct ast_slinfactory *sf) |
Flush the contents of a slinfactory. More... | |
void | ast_slinfactory_init (struct ast_slinfactory *sf) |
Initialize a slinfactory. More... | |
int | ast_slinfactory_init_rate (struct ast_slinfactory *sf, unsigned int sample_rate) |
Initialize a slinfactory. More... | |
int | ast_slinfactory_read (struct ast_slinfactory *sf, short *buf, size_t samples) |
Read samples from a slinfactory. More... | |
A machine to gather up arbitrary frames and convert them to raw slinear on demand.
Definition in file slinfactory.h.
#define AST_SLINFACTORY_MAX_HOLD 1280 |
Definition at line 31 of file slinfactory.h.
Referenced by ast_slinfactory_read().
unsigned int ast_slinfactory_available | ( | const struct ast_slinfactory * | sf | ) |
Retrieve number of samples currently in a slinfactory.
sf | The slinfactory to peek into |
Definition at line 196 of file slinfactory.c.
References ast_slinfactory::size.
Referenced by ast_audiohook_write_frame(), audio_audiohook_write_list(), audiohook_read_frame_both(), audiohook_read_frame_single(), and softmix_bridge_thread().
void ast_slinfactory_destroy | ( | struct ast_slinfactory * | sf | ) |
Destroy the contents of a slinfactory.
sf | The slinfactory that is no longer needed |
This function will free any memory allocated for the contents of the slinfactory. It does not free the slinfactory itself. If the sf is malloc'd, then it must be explicitly free'd after calling this function.
Definition at line 64 of file slinfactory.c.
References ast_frfree, AST_LIST_REMOVE_HEAD, ast_translator_free_path(), f, and ast_slinfactory::trans.
Referenced by ast_audiohook_destroy(), and softmix_bridge_leave().
int ast_slinfactory_feed | ( | struct ast_slinfactory * | sf, |
struct ast_frame * | f | ||
) |
Feed audio into a slinfactory.
sf | The slinfactory to feed into |
f | Frame containing audio to feed in |
Definition at line 77 of file slinfactory.c.
References ast_frdup(), ast_frfree, ast_frisolate(), ast_getformatname(), AST_LIST_INSERT_TAIL, AST_LIST_NEXT, AST_LIST_TRAVERSE, ast_log(), ast_translate(), ast_translator_build_path(), ast_translator_free_path(), ast_frame_subclass::codec, ast_frame::data, f, ast_slinfactory::format, LOG_WARNING, ast_slinfactory::output_format, ast_frame::ptr, ast_frame::samples, ast_slinfactory::size, ast_frame::subclass, and ast_slinfactory::trans.
Referenced by ast_audiohook_write_frame(), and softmix_bridge_write().
void ast_slinfactory_flush | ( | struct ast_slinfactory * | sf | ) |
Flush the contents of a slinfactory.
sf | The slinfactory to flush |
Definition at line 201 of file slinfactory.c.
References ast_frfree, AST_LIST_REMOVE_HEAD, ast_translator_free_path(), ast_slinfactory::hold, ast_slinfactory::holdlen, ast_slinfactory::offset, ast_slinfactory::size, and ast_slinfactory::trans.
Referenced by ast_audiohook_write_frame().
void ast_slinfactory_init | ( | struct ast_slinfactory * | sf | ) |
Initialize a slinfactory.
sf | The slinfactory to initialize |
Definition at line 39 of file slinfactory.c.
References AST_FORMAT_SLINEAR, ast_slinfactory::hold, ast_slinfactory::offset, and ast_slinfactory::output_format.
Referenced by ast_audiohook_init(), and softmix_bridge_join().
int ast_slinfactory_init_rate | ( | struct ast_slinfactory * | sf, |
unsigned int | sample_rate | ||
) |
Initialize a slinfactory.
sf | The slinfactory to initialize |
sample_rate | The output sample rate desired |
Definition at line 46 of file slinfactory.c.
References AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, ast_slinfactory::hold, ast_slinfactory::offset, and ast_slinfactory::output_format.
int ast_slinfactory_read | ( | struct ast_slinfactory * | sf, |
short * | buf, | ||
size_t | samples | ||
) |
Read samples from a slinfactory.
sf | The slinfactory to read from |
buf | Buffer to put samples into |
samples | Number of samples wanted |
Definition at line 142 of file slinfactory.c.
References ast_frfree, AST_LIST_REMOVE_HEAD, AST_SLINFACTORY_MAX_HOLD, ast_frame::data, ast_slinfactory::hold, ast_slinfactory::holdlen, ast_slinfactory::offset, ast_frame::offset, ast_frame::ptr, ast_frame::samples, and ast_slinfactory::size.
Referenced by audio_audiohook_write_list(), audiohook_read_frame_both(), audiohook_read_frame_single(), and softmix_bridge_thread().