|
Asterisk - The Open Source Telephony Project GIT-master-590b490
|
Translate via the use of pseudo channels. More...
#include "asterisk.h"#include <sys/time.h>#include <sys/resource.h>#include <math.h>#include "asterisk/lock.h"#include "asterisk/channel.h"#include "asterisk/translate.h"#include "asterisk/module.h"#include "asterisk/frame.h"#include "asterisk/sched.h"#include "asterisk/cli.h"#include "asterisk/term.h"#include "asterisk/format.h"#include "asterisk/linkedlists.h"
Go to the source code of this file.
Data Structures | |
| struct | translator_path |
| struct | translators |
| the list of translators More... | |
Macros | |
| #define | format_sample_rate_absdiff(fmt1, fmt2) |
| #define | GROW_INDEX 16 |
| #define | INIT_INDEX 32 |
| #define | MAX_RECALC 1000 |
| #define | PRE_ENCODE_POOL_MAX 200 |
Enumerations | |
| enum | sample_type { SAMPLE_TYPE_CODEC = 0 , SAMPLE_TYPE_SINE , SAMPLE_TYPE_SILENCE , SAMPLE_TYPE_NOISE , SAMPLE_TYPE_SPEECH } |
Functions | |
| int | __ast_register_translator (struct ast_translator *t, struct ast_module *mod) |
| register codec translator | |
| static int | add_codec2index (struct ast_codec *codec) |
| struct ast_frame * | ast_trans_frameout (struct ast_trans_pvt *pvt, int datalen, int samples) |
| generic frameout routine. If samples and datalen are 0, take whatever is in pvt and reset them, otherwise take the values in the caller and leave alone the pvt values. | |
| struct ast_frame * | ast_translate (struct ast_trans_pvt *path, struct ast_frame *f, int consume) |
| do the actual translation | |
| void | ast_translate_available_formats (struct ast_format_cap *dest, struct ast_format_cap *src, struct ast_format_cap *result) |
| Find available formats. | |
| int | ast_translate_init (void) |
| Initialize the translation matrix and index to format conversion table. | |
| unsigned int | ast_translate_path_steps (struct ast_format *dst_format, struct ast_format *src_format) |
| Returns the number of steps required to convert from 'src' to 'dest'. | |
| const char * | ast_translate_path_to_str (struct ast_trans_pvt *p, struct ast_str **str) |
| Puts a string representation of the translation path into outbuf. | |
| void | ast_translator_activate (struct ast_translator *t) |
| Activate a previously deactivated translator. | |
| int | ast_translator_best_choice (struct ast_format_cap *dst_cap, struct ast_format_cap *src_cap, struct ast_format **dst_fmt_out, struct ast_format **src_fmt_out) |
| Calculate our best translator source format, given costs, and a desired destination. | |
| struct ast_trans_pvt * | ast_translator_build_path (struct ast_format *dst, struct ast_format *src) |
| Build a chain of translators based upon the given source and dest formats. | |
| void | ast_translator_deactivate (struct ast_translator *t) |
| Deactivate a translator. | |
| void | ast_translator_free_path (struct ast_trans_pvt *p) |
| Frees a translator path Frees the given translator path structure. | |
| int | ast_unregister_translator (struct ast_translator *t) |
| unregister codec translator | |
| static struct ast_trans_pvt * | build_slin_to_src_path (const struct ast_translator *t) |
| static void | check_translation_path (struct ast_format_cap *dest, struct ast_format_cap *src, struct ast_format_cap *result, struct ast_format *src_fmt, enum ast_media_type type) |
| static int | codec2index (struct ast_codec *codec) |
| static void | codec_append_name (const struct ast_codec *codec, struct ast_str **buf) |
| static int | codec_to_index (unsigned int id) |
| static char * | complete_trans_path_choice (const char *word) |
| static struct ast_frame * | default_frameout (struct ast_trans_pvt *pvt) |
| static void | destroy (struct ast_trans_pvt *pvt) |
| static int | format2index (struct ast_format *format) |
| static int | framein (struct ast_trans_pvt *pvt, struct ast_frame *f) |
| framein wrapper, deals with bound checks. | |
| static void | generate_computational_cost (struct ast_translator *t, int seconds) |
| static struct ast_frame * | generate_interpolated_slin (struct ast_trans_pvt *p, struct ast_frame *f) |
| static void | generate_samples (int16_t *buf, int samples, int offset) |
| Fill a buffer with samples of the selected type. | |
| static int | generate_table_cost (struct ast_codec *src, struct ast_codec *dst) |
| static char * | handle_cli_core_show_translation (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static void | handle_cli_recalc (struct ast_cli_args *a) |
| static char * | handle_cli_translate_sampletype (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static char * | handle_show_translation_path (struct ast_cli_args *a, const char *codec_name, unsigned int sample_rate) |
| static char * | handle_show_translation_table (struct ast_cli_args *a) |
| static struct ast_codec * | index2codec (int index) |
| static uint32_t | lcg_rand (void) |
| static void | matrix_clear (void) |
| static struct translator_path * | matrix_get (unsigned int x, unsigned int y) |
| static void | matrix_rebuild (int samples) |
| rebuild a translation matrix. | |
| static int | matrix_resize (int init) |
| static struct ast_trans_pvt * | newpvt (struct ast_translator *t, struct ast_format *explicit_dst) |
| Allocate the descriptor, required outbuf space, and possibly desc. | |
| static void | translate_shutdown (void) |
Variables | |
| static unsigned int * | __indextable |
| table for converting index to format values. | |
| static struct translator_path ** | __matrix |
| a matrix that, for any pair of supported formats, indicates the total cost of translation and the first step. The full path can be reconstructed iterating on the matrix until step->dstfmt == desired_format. | |
| static struct ast_cli_entry | cli_translate [] |
| static int | cur_max_index |
| static enum sample_type | current_sample_type = SAMPLE_TYPE_CODEC |
| static int | index_size |
| static uint32_t | lcg_state = 0xdeadbeef |
| static ast_rwlock_t | tablelock |
| static struct translators | translators = AST_RWLIST_HEAD_INIT_VALUE |
Translate via the use of pseudo channels.
Definition in file translate.c.
| #define format_sample_rate_absdiff | ( | fmt1, | |
| fmt2 | |||
| ) |
Calculate the absolute difference between sample rate of two formats.
Definition at line 1669 of file translate.c.
| #define GROW_INDEX 16 |
Definition at line 149 of file translate.c.
| #define INIT_INDEX 32 |
Definition at line 147 of file translate.c.
| #define MAX_RECALC 1000 |
max sample recalc
Definition at line 111 of file translate.c.
| #define PRE_ENCODE_POOL_MAX 200 |
Maximum number of pre-encoded frames cached for non-slin benchmark sources
Definition at line 740 of file translate.c.
| enum sample_type |
Definition at line 50 of file translate.c.
| int __ast_register_translator | ( | struct ast_translator * | t, |
| struct ast_module * | mod | ||
| ) |
register codec translator
Register a translator This registers a codec translator with asterisk.
Definition at line 1511 of file translate.c.
References a, ast_translator::active, add_codec2index(), ao2_cleanup, ast_assert, ast_codec_get(), ast_log, AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_HEAD, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, b, ast_translator::buf_size, codec2index(), COLOR_BLACK, COLOR_MAGENTA, ast_translator::comp_cost, cur_max_index, default_frameout(), ast_translator::dst_codec, ast_translator::dst_fmt_index, ast_translator::frameout, generate_computational_cost(), generate_table_cost(), LOG_WARNING, matrix_rebuild(), matrix_resize(), ast_codec::name, ast_translator::name, NULL, RAII_VAR, ast_codec::sample_rate, ast_translator::src_codec, ast_translator::src_fmt_index, ast_translator::table_cost, term_color(), and ast_codec::type.
|
static |
Definition at line 205 of file translate.c.
References __indextable, ast_rwlock_unlock, ast_rwlock_wrlock, codec2index(), cur_max_index, ast_codec::id, index_size, and tablelock.
Referenced by __ast_register_translator().
| struct ast_frame * ast_trans_frameout | ( | struct ast_trans_pvt * | pvt, |
| int | datalen, | ||
| int | samples | ||
| ) |
generic frameout routine. If samples and datalen are 0, take whatever is in pvt and reset them, otherwise take the values in the caller and leave alone the pvt values.
generic frameout function
Definition at line 496 of file translate.c.
References ast_frisolate, ast_trans_pvt::c, ast_frame::data, ast_frame::datalen, ast_trans_pvt::datalen, ast_trans_pvt::f, NULL, ast_trans_pvt::outbuf, ast_frame::ptr, ast_frame::samples, and ast_trans_pvt::samples.
Referenced by default_frameout(), lintoadpcm_frameout(), lintocodec2_frameout(), lintogsm_frameout(), lintoilbc_frameout(), lintolpc10_frameout(), and lintospeex_frameout().
| struct ast_frame * ast_translate | ( | struct ast_trans_pvt * | path, |
| struct ast_frame * | f, | ||
| int | consume | ||
| ) |
do the actual translation
translates one or more frames Apply an input frame into the translator and receive zero or one output frames. Consume determines whether the original frame should be freed. In case the frame type is AST_FRAME_RTCP, the frame is not translated but passed to the translator codecs via the feedback callback, and a pointer to ast_null_frame is returned after that.
Definition at line 623 of file translate.c.
References ast_clear_flag, ast_debug, ast_format_get_sample_rate(), AST_FRAME_CNG, AST_FRAME_RTCP, AST_FRFLAG_HAS_TIMING_INFO, ast_frfree, AST_LIST_NEXT, ast_null_frame, ast_samp2tv(), ast_set2_flag, ast_test_flag, ast_tv(), ast_tvadd(), ast_tveq(), ast_tvnow(), ast_tvsub(), ast_tvzero(), current, ast_frame::delivery, ast_trans_pvt::f, ast_translator::feedback, ast_frame_subclass::format, framein(), ast_translator::frameout, ast_frame::frametype, generate_interpolated_slin(), len(), ast_frame::len, ast_trans_pvt::next, ast_trans_pvt::nextin, ast_trans_pvt::nextout, out, ast_frame::samples, ast_frame::seqno, ast_frame::subclass, ast_trans_pvt::t, and ast_frame::ts.
Referenced by __ast_read(), ast_slinfactory_feed(), ast_write_stream(), ast_writestream(), audiohook_list_translate_to_native(), audiohook_list_translate_to_slin(), audiohook_read_frame_helper(), conf_run(), fax_gateway_framehook(), and softmix_process_write_audio().
| void ast_translate_available_formats | ( | struct ast_format_cap * | dest, |
| struct ast_format_cap * | src, | ||
| struct ast_format_cap * | result | ||
| ) |
Find available formats.
| dest | possible destination formats | |
| src | source formats | |
| [out] | result | capabilities structure to store available formats in returns the destination formats that are available in the source or translatable |
The result will include all formats from 'dest' that are either present in 'src' or translatable from a format present in 'src'.
Definition at line 1890 of file translate.c.
References ao2_ref, ast_format_cap_append, ast_format_cap_count(), ast_format_cap_get_compatible_format(), ast_format_cap_get_format(), AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_VIDEO, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, check_translation_path(), and result.
Referenced by ast_rtp_instance_available_formats().
| int ast_translate_init | ( | void | ) |
Initialize the translation matrix and index to format conversion table.
| 0 | on success |
| -1 | on failure |
Definition at line 1949 of file translate.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), ast_rwlock_init, cli_translate, matrix_resize(), tablelock, and translate_shutdown().
Referenced by asterisk_daemon().
| unsigned int ast_translate_path_steps | ( | struct ast_format * | dest, |
| struct ast_format * | src | ||
| ) |
Returns the number of steps required to convert from 'src' to 'dest'.
| dest | destination format |
| src | source format |
| -1 | if no path is available |
Definition at line 1810 of file translate.c.
References ast_log, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, format2index(), LOG_WARNING, matrix_get(), and translator_path::multistep.
Referenced by ast_channel_make_compatible_helper().
| const char * ast_translate_path_to_str | ( | struct ast_trans_pvt * | t, |
| struct ast_str ** | str | ||
| ) |
Puts a string representation of the translation path into outbuf.
| t | translator structure containing the translation path |
| str | ast_str output buffer |
| "" | on failure |
Definition at line 1145 of file translate.c.
References ast_str_append(), ast_str_buffer(), ast_str_reset(), codec_append_name(), ast_translator::dst_codec, ast_trans_pvt::next, ast_translator::src_codec, str, and ast_trans_pvt::t.
Referenced by chan_pjsip_write_stream(), generate_status(), handle_showchan(), and serialize_showchan().
| void ast_translator_activate | ( | struct ast_translator * | t | ) |
Activate a previously deactivated translator.
| t | translator to activate |
Enables the specified translator for use.
Definition at line 1652 of file translate.c.
References ast_translator::active, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and matrix_rebuild().
| int ast_translator_best_choice | ( | struct ast_format_cap * | dst_cap, |
| struct ast_format_cap * | src_cap, | ||
| struct ast_format ** | dst_fmt_out, | ||
| struct ast_format ** | src_fmt_out | ||
| ) |
Calculate our best translator source format, given costs, and a desired destination.
Chooses the best translation path.
Definition at line 1676 of file translate.c.
References ao2_cleanup, ao2_ref, ao2_replace, ast_debug, ast_format_cap_alloc, ast_format_cap_count(), ast_format_cap_empty(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_compatible(), ast_format_cap_get_format(), ast_format_get_codec(), ast_format_get_name(), ast_format_get_sample_rate(), ast_format_get_type(), ast_log, AST_MEDIA_TYPE_AUDIO, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, format2index(), format_sample_rate_absdiff, LOG_ERROR, matrix_get(), translator_path::multistep, NULL, ast_codec::quality, RAII_VAR, replace(), and translator_path::table_cost.
Referenced by ast_channel_make_compatible_helper(), ast_speech_new(), iax2_request(), local_request_with_stream_topology(), request_channel(), and set_format().
| struct ast_trans_pvt * ast_translator_build_path | ( | struct ast_format * | dst, |
| struct ast_format * | src | ||
| ) |
Build a chain of translators based upon the given source and dest formats.
Builds a translator path Build a path (possibly NULL) from source to dest.
Definition at line 543 of file translate.c.
References ast_format_get_name(), ast_format_get_sample_rate(), ast_format_get_type(), ast_log, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_translator_free_path(), ast_tv(), ast_translator::dst_codec, ast_translator::dst_fmt_index, format2index(), LOG_WARNING, matrix_get(), newpvt(), ast_trans_pvt::next, ast_trans_pvt::nextin, ast_trans_pvt::nextout, NULL, ast_codec::sample_rate, translator_path::step, ast_trans_pvt::t, and ast_codec::type.
Referenced by ast_set_read_format_path(), ast_set_write_format_path(), ast_slinfactory_feed(), ast_writestream(), audiohook_list_translate_to_native(), audiohook_list_translate_to_slin(), audiohook_read_frame_helper(), conf_run(), set_format(), softmix_process_write_audio(), and softmix_translate_helper_change_rate().
| void ast_translator_deactivate | ( | struct ast_translator * | t | ) |
Deactivate a translator.
| t | translator to deactivate |
Disables the specified translator from being used.
Definition at line 1660 of file translate.c.
References ast_translator::active, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and matrix_rebuild().
| void ast_translator_free_path | ( | struct ast_trans_pvt * | tr | ) |
Frees a translator path Frees the given translator path structure.
| tr | translator path to get rid of |
Definition at line 533 of file translate.c.
References destroy(), and ast_trans_pvt::next.
Referenced by ast_audiohook_destroy(), ast_audiohook_detach_list(), ast_channel_destructor(), ast_set_read_format_path(), ast_set_write_format_path(), ast_slinfactory_destroy(), ast_slinfactory_feed(), ast_slinfactory_flush(), ast_translator_build_path(), ast_writestream(), audiohook_list_translate_to_native(), audiohook_list_translate_to_slin(), audiohook_read_frame_helper(), build_slin_to_src_path(), conf_free(), filestream_destructor(), free_translation(), generate_computational_cost(), set_format(), softmix_translate_helper_change_rate(), softmix_translate_helper_cleanup(), and softmix_translate_helper_free_entry().
| int ast_unregister_translator | ( | struct ast_translator * | t | ) |
unregister codec translator
Unregister a translator Unregisters the given translator.
Definition at line 1624 of file translate.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_shutting_down(), ast_verb, COLOR_BLACK, COLOR_MAGENTA, ast_translator::dst_codec, ast_translator::list, matrix_rebuild(), ast_codec::name, ast_translator::name, ast_translator::src_codec, and term_color().
Referenced by unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), and unregister_translators().
|
static |
Definition at line 751 of file translate.c.
References ao2_ref, ast_codec_get(), AST_MEDIA_TYPE_AUDIO, ast_translator_free_path(), ast_tv(), codec2index(), ast_translator::dst_fmt_index, matrix_get(), ast_codec::name, newpvt(), ast_trans_pvt::next, ast_trans_pvt::nextin, ast_trans_pvt::nextout, NULL, ast_translator::src_codec, ast_translator::src_fmt_index, translator_path::step, and ast_trans_pvt::t.
Referenced by generate_computational_cost().
|
static |
Definition at line 1832 of file translate.c.
References ao2_cleanup, ast_format_cap_count(), ast_format_cap_get_format(), ast_format_cap_iscompatible_format(), ast_format_cap_remove(), AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_type(), format2index(), matrix_get(), RAII_VAR, result, and type.
Referenced by ast_translate_available_formats().
|
static |
Definition at line 182 of file translate.c.
References codec_to_index(), and ast_codec::id.
Referenced by __ast_register_translator(), add_codec2index(), build_slin_to_src_path(), handle_show_translation_path(), and handle_show_translation_table().
Definition at line 1136 of file translate.c.
References ast_str_append(), buf, ast_codec::name, and ast_codec::sample_rate.
Referenced by ast_translate_path_to_str(), and handle_show_translation_path().
|
static |
Definition at line 162 of file translate.c.
References __indextable, ast_rwlock_rdlock, ast_rwlock_unlock, cur_max_index, and tablelock.
Referenced by codec2index(), and format2index().
|
static |
Definition at line 1162 of file translate.c.
References ao2_ref, ast_cli_completion_add(), ast_codec_get_by_id(), AST_MEDIA_TYPE_AUDIO, ast_strdup, ast_codec::name, NULL, and ast_codec::type.
Referenced by handle_cli_core_show_translation().
|
static |
Definition at line 526 of file translate.c.
References ast_trans_frameout().
Referenced by __ast_register_translator().
|
static |
Definition at line 349 of file translate.c.
References ao2_cleanup, ao2_ref, ast_free, ast_module_unref, ast_translator::destroy, ast_trans_pvt::explicit_dst, ast_trans_pvt::f, ast_frame_subclass::format, NULL, ast_frame::subclass, and ast_trans_pvt::t.
Referenced by ast_translator_free_path(), generate_computational_cost(), and newpvt().
|
static |
Definition at line 191 of file translate.c.
References ast_format_get_codec_id(), and codec_to_index().
Referenced by ast_translate_path_steps(), ast_translator_best_choice(), ast_translator_build_path(), and check_translation_path().
|
static |
framein wrapper, deals with bound checks.
Definition at line 454 of file translate.c.
References ast_assert, ast_copy_flags, AST_FRFLAG_HAS_TIMING_INFO, ast_log, ast_translator::buffer_samples, ast_frame::datalen, ast_translator::dst_codec, ast_trans_pvt::f, ast_translator::framein, ast_frame::len, LOG_WARNING, ast_translator::name, ast_translator::native_plc, ast_codec::sample_rate, ast_frame::samples, ast_trans_pvt::samples, ast_frame::seqno, ast_frame::src, ast_translator::src_codec, ast_trans_pvt::t, and ast_frame::ts.
Referenced by ast_translate(), and generate_computational_cost().
|
static |
Definition at line 812 of file translate.c.
References ARRAY_LEN, ast_debug, ast_format_slin, AST_FRAME_VOICE, ast_free, ast_frfree, ast_frisolate, ast_log, ast_malloc, ast_translator_free_path(), build_slin_to_src_path(), cleanup(), ast_translator::comp_cost, current_sample_type, destroy(), ast_translator::dst_codec, end, ast_format_def::format, framein(), ast_translator::frameout, generate_samples(), LOG_WARNING, ast_codec::name, ast_translator::name, newpvt(), ast_trans_pvt::next, NULL, out, PRE_ENCODE_POOL_MAX, ast_trans_pvt::pvt, ast_translator::sample, ast_codec::sample_rate, SAMPLE_TYPE_CODEC, ast_frame::samples, slin_f, ast_translator::src_codec, and ast_trans_pvt::t.
Referenced by __ast_register_translator(), and matrix_rebuild().
|
static |
Definition at line 594 of file translate.c.
References ast_format_cache_get_slin_by_rate(), ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_slin, AST_FRAME_VOICE, ast_frdup, AST_FRIENDLY_OFFSET, ast_opt_generic_plc, ast_frame::data, ast_frame::datalen, ast_trans_pvt::explicit_dst, ast_frame_subclass::format, NULL, ast_frame::offset, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
Referenced by ast_translate().
|
static |
Fill a buffer with samples of the selected type.
| buf | Output sample buffer (int16_t) |
| samples | Number of samples to generate |
| offset | Running sample offset (for continuous sample types) |
Definition at line 74 of file translate.c.
References buf, current_sample_type, lcg_rand(), M_PI, SAMPLE_TYPE_NOISE, SAMPLE_TYPE_SILENCE, SAMPLE_TYPE_SINE, and SAMPLE_TYPE_SPEECH.
Referenced by generate_computational_cost().
Definition at line 984 of file translate.c.
References AST_MEDIA_TYPE_AUDIO, AST_TRANS_COST_LL_LL_DOWNSAMP, AST_TRANS_COST_LL_LL_ORIGSAMP, AST_TRANS_COST_LL_LL_UPSAMP, AST_TRANS_COST_LL_LY_DOWNSAMP, AST_TRANS_COST_LL_LY_ORIGSAMP, AST_TRANS_COST_LL_LY_UPSAMP, AST_TRANS_COST_LL_UNKNOWN, AST_TRANS_COST_LY_LL_DOWNSAMP, AST_TRANS_COST_LY_LL_ORIGSAMP, AST_TRANS_COST_LY_LL_UPSAMP, AST_TRANS_COST_LY_LY_DOWNSAMP, AST_TRANS_COST_LY_LY_ORIGSAMP, AST_TRANS_COST_LY_LY_UPSAMP, AST_TRANS_COST_LY_UNKNOWN, ast_codec::name, ast_codec::sample_rate, ast_frame::src, and ast_codec::type.
Referenced by __ast_register_translator().
|
static |
Definition at line 1390 of file translate.c.
References a, ast_cli(), ast_cli_complete(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, ast_cli_entry::command, complete_trans_path_choice(), handle_cli_recalc(), handle_show_translation_path(), handle_show_translation_table(), NULL, ast_codec::sample_rate, and ast_cli_entry::usage.
|
static |
Definition at line 1186 of file translate.c.
References a, ast_cli(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, matrix_rebuild(), and MAX_RECALC.
Referenced by handle_cli_core_show_translation().
|
static |
Definition at line 1447 of file translate.c.
References a, ast_cli(), ast_cli_complete(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, current_sample_type, matrix_rebuild(), NULL, SAMPLE_TYPE_CODEC, SAMPLE_TYPE_NOISE, SAMPLE_TYPE_SILENCE, SAMPLE_TYPE_SINE, SAMPLE_TYPE_SPEECH, and ast_cli_entry::usage.
|
static |
Definition at line 1325 of file translate.c.
References a, ao2_ref, ast_cli(), ast_codec_get(), ast_codec_get_by_id(), AST_MEDIA_TYPE_AUDIO, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_str_reset(), ast_str_set(), CLI_FAILURE, CLI_SUCCESS, codec2index(), codec_append_name(), ast_translator::dst_fmt_index, matrix_get(), ast_codec::name, ast_codec::sample_rate, ast_translator::src_codec, translator_path::step, str, and ast_codec::type.
Referenced by handle_cli_core_show_translation().
|
static |
Definition at line 1205 of file translate.c.
References a, ao2_cleanup, ao2_ref, ast_cli(), ast_codec_get_by_id(), ast_free, AST_MEDIA_TYPE_AUDIO, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), CLI_SUCCESS, codec2index(), translator_path::comp_cost, matrix_get(), ast_codec::name, NULL, out, ast_codec::sample_rate, and ast_codec::type.
Referenced by handle_cli_core_show_translation().
|
static |
Definition at line 228 of file translate.c.
References __indextable, ast_codec_get_by_id(), ast_rwlock_rdlock, ast_rwlock_unlock, cur_max_index, and tablelock.
Referenced by matrix_rebuild().
|
static |
Definition at line 62 of file translate.c.
References lcg_state.
Referenced by generate_samples().
|
static |
Definition at line 326 of file translate.c.
References __matrix, and index_size.
Referenced by matrix_rebuild().
|
static |
Definition at line 340 of file translate.c.
References __matrix.
Referenced by ast_translate_path_steps(), ast_translator_best_choice(), ast_translator_build_path(), build_slin_to_src_path(), check_translation_path(), handle_show_translation_path(), handle_show_translation_table(), and matrix_rebuild().
|
static |
rebuild a translation matrix.
Definition at line 1040 of file translate.c.
References ast_translator::active, ao2_ref, ast_debug, ast_log, AST_RWLIST_TRAVERSE, ast_translator::comp_cost, translator_path::comp_cost, cur_max_index, DEBUG_ATLEAST, ast_translator::dst_fmt_index, generate_computational_cost(), index2codec(), ast_translator::list, LOG_DEBUG, matrix_clear(), matrix_get(), translator_path::multistep, ast_codec::name, ast_translator::src_fmt_index, translator_path::step, ast_translator::table_cost, and translator_path::table_cost.
Referenced by __ast_register_translator(), ast_translator_activate(), ast_translator_deactivate(), ast_unregister_translator(), handle_cli_recalc(), handle_cli_translate_sampletype(), and matrix_resize().
|
static |
Definition at line 252 of file translate.c.
References __indextable, __matrix, ast_calloc, ast_free, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_rwlock_unlock, ast_rwlock_wrlock, GROW_INDEX, index_size, INIT_INDEX, matrix_rebuild(), NULL, and tablelock.
Referenced by __ast_register_translator(), and ast_translate_init().
|
static |
Allocate the descriptor, required outbuf space, and possibly desc.
Definition at line 369 of file translate.c.
References ao2_bump, ao2_ref, ast_calloc, ast_codec_get(), ast_format_cache_get, ast_format_create(), AST_FRAME_VOICE, ast_free, AST_FRIENDLY_OFFSET, ast_log, ast_module_ref, ast_module_unref, ast_strlen_zero(), ast_translator::buf_size, ast_translator::desc_size, destroy(), ast_translator::dst_codec, ast_trans_pvt::explicit_dst, ast_trans_pvt::f, ast_frame_subclass::format, len(), LOG_ERROR, ast_codec::name, ast_translator::newpvt, NULL, ast_trans_pvt::pvt, ast_codec::sample_rate, ast_frame::subclass, ast_trans_pvt::t, and ast_codec::type.
Referenced by ast_translator_build_path(), build_slin_to_src_path(), and generate_computational_cost().
|
static |
Definition at line 1932 of file translate.c.
References __indextable, __matrix, ARRAY_LEN, ast_cli_unregister_multiple(), ast_free, ast_rwlock_destroy, ast_rwlock_unlock, ast_rwlock_wrlock, cli_translate, index_size, NULL, and tablelock.
Referenced by ast_translate_init().
|
static |
table for converting index to format values.
Definition at line 141 of file translate.c.
Referenced by add_codec2index(), codec_to_index(), index2codec(), matrix_resize(), and translate_shutdown().
|
static |
a matrix that, for any pair of supported formats, indicates the total cost of translation and the first step. The full path can be reconstructed iterating on the matrix until step->dstfmt == desired_format.
Array indexes are 'src' and 'dest', in that order.
Note: the lock in the 'translators' list is also used to protect this structure.
Definition at line 134 of file translate.c.
Referenced by matrix_clear(), matrix_get(), matrix_resize(), and translate_shutdown().
|
static |
Definition at line 1505 of file translate.c.
Referenced by ast_translate_init(), and translate_shutdown().
|
static |
the current largest index used by the __matrix and __indextable arrays
Definition at line 152 of file translate.c.
Referenced by __ast_register_translator(), add_codec2index(), codec_to_index(), index2codec(), and matrix_rebuild().
|
static |
Definition at line 58 of file translate.c.
Referenced by generate_computational_cost(), generate_samples(), and handle_cli_translate_sampletype().
|
static |
the largest index that can be used in either the __indextable or __matrix before resize must occur
Definition at line 154 of file translate.c.
Referenced by add_codec2index(), matrix_clear(), matrix_resize(), and translate_shutdown().
|
static |
Simple LCG state for reproducible pseudo-random noise
Definition at line 61 of file translate.c.
Referenced by lcg_rand().
|
static |
protects the __indextable for resizing
Definition at line 144 of file translate.c.
Referenced by add_codec2index(), ast_translate_init(), codec_to_index(), index2codec(), matrix_resize(), and translate_shutdown().
|
static |