Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
A machine to gather up arbitrary frames and convert them to raw slinear on demand. More...
#include "asterisk.h"
#include "asterisk/frame.h"
#include "asterisk/format_cache.h"
#include "asterisk/slinfactory.h"
#include "asterisk/translate.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
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.c.
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(), audio_audiohook_write_list(), audiohook_read_frame_both(), audiohook_read_frame_single(), softmix_bridge_write_voice(), and softmix_process_read_audio().
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 ao2_cleanup, ast_frfree, AST_LIST_REMOVE_HEAD, ast_translator_free_path(), ast_slinfactory::format, NULL, ast_slinfactory::output_format, and ast_slinfactory::trans.
Referenced by ast_audiohook_destroy(), audiohook_set_internal_rate(), set_softmix_bridge_data(), 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_frfree, ast_frisolate, AST_LIST_INSERT_TAIL, AST_LIST_NEXT, AST_LIST_TRAVERSE, ast_log, ast_translate(), ast_translator_build_path(), ast_translator_free_path(), ast_frame::data, ast_frame_subclass::format, ast_slinfactory::format, LOG_WARNING, NULL, 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_voice().
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_frfree, AST_LIST_REMOVE_HEAD, ast_translator_free_path(), ast_slinfactory::hold, ast_slinfactory::holdlen, NULL, ast_slinfactory::offset, ast_slinfactory::size, and ast_slinfactory::trans.
Referenced by ast_audiohook_write_frame(), clear_talking(), and softmix_bridge_write_voice().
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.
Referenced by audiohook_set_internal_rate(), and set_softmix_bridge_data().
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_frfree, AST_LIST_REMOVE_HEAD, AST_SLINFACTORY_MAX_HOLD, buf, ast_frame::data, ast_slinfactory::hold, ast_slinfactory::holdlen, ast_frame::offset, ast_slinfactory::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_process_read_audio().