Asterisk - The Open Source Telephony Project
21.4.1
|
A machine to gather up arbitrary frames and convert them to raw slinear on demand. More...
#include "asterisk/format.h"
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_with_format (struct ast_slinfactory *sf, struct ast_format *slin_out) |
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.
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 199 of file slinfactory.c.
References ast_slinfactory::size.
Referenced by ast_audiohook_write_frame(), and audio_audiohook_write_list().
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 58 of file slinfactory.c.
References AST_LIST_REMOVE_HEAD, ast_translator_free_path(), ast_slinfactory::format, ast_slinfactory::output_format, 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 ao2_replace, ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_codec_id(), ast_format_get_name(), ast_frdup, ast_frisolate, AST_LIST_INSERT_TAIL, AST_LIST_NEXT, AST_LIST_TRAVERSE, ast_translate(), ast_translator_build_path(), ast_translator_free_path(), ast_frame::data, ast_slinfactory::format, ast_frame_subclass::format, ast_slinfactory::output_format, ast_frame::samples, ast_slinfactory::size, ast_frame::subclass, and ast_slinfactory::trans.
Referenced by ast_audiohook_write_frame().
void ast_slinfactory_flush | ( | struct ast_slinfactory * | sf | ) |
Flush the contents of a slinfactory.
sf | The slinfactory to flush |
Definition at line 204 of file slinfactory.c.
References 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 ao2_bump, ast_format_slin, ast_slinfactory::hold, ast_slinfactory::offset, and ast_slinfactory::output_format.
int ast_slinfactory_init_with_format | ( | struct ast_slinfactory * | sf, |
struct ast_format * | slin_out | ||
) |
Initialize a slinfactory.
sf | The slinfactory to initialize |
slin_out | the slinear output format desired. |
0 | on success |
non-zero | on failure |
Definition at line 46 of file slinfactory.c.
References ao2_bump, ast_format_cache_is_slinear(), 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 145 of file slinfactory.c.
References AST_LIST_REMOVE_HEAD, ast_frame::data, ast_slinfactory::hold, ast_slinfactory::holdlen, ast_slinfactory::offset, ast_frame::offset, ast_frame::samples, and ast_slinfactory::size.
Referenced by audio_audiohook_write_list().