Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Descriptor of a translator. More...
#include <translate.h>
Data Fields | |
int | active |
int | buf_size |
size of outbuf, in bytes. Mandatory. The wrapper code will also allocate an AST_FRIENDLY_OFFSET space before. More... | |
int | buffer_samples |
size of outbuf, in samples. Leave it 0 if you want the framein callback deal with the frame. Set it appropriately if you want the code to checks if the incoming frame fits the outbuf (this is e.g. required for plc). More... | |
int | comp_cost |
struct ast_codec * | core_dst_codec |
struct ast_codec * | core_src_codec |
int | desc_size |
void(* | destroy )(struct ast_trans_pvt *pvt) |
struct ast_codec | dst_codec |
int | dst_fmt_index |
void(* | feedback )(struct ast_trans_pvt *pvt, struct ast_frame *feedback) |
const char * | format |
int(* | framein )(struct ast_trans_pvt *pvt, struct ast_frame *in) |
struct ast_frame *(* | frameout )(struct ast_trans_pvt *pvt) |
struct { | |
struct ast_translator * next | |
} | list |
struct ast_module * | module |
char | name [80] |
int | native_plc |
int(* | newpvt )(struct ast_trans_pvt *) |
struct ast_frame *(* | sample )(void) |
struct ast_codec | src_codec |
int | src_fmt_index |
int | table_cost |
Descriptor of a translator.
Name, callbacks, and various options related to run-time operation (size of buffers, auxiliary descriptors, etc).
A codec registers itself by filling the relevant fields of a structure and passing it as an argument to ast_register_translator(). The structure should not be modified after a successful registration, and its address must be used as an argument to ast_unregister_translator().
As a minimum, a translator should supply name, srcfmt and dstfmt, the required buf_size (in bytes) and buffer_samples (in samples), and a few callbacks (framein, frameout, feedback, sample). The outbuf is automatically prepended by AST_FRIENDLY_OFFSET spare bytes so generic routines can place data in there.
Note, the translator is not supposed to do any memory allocation or deallocation, nor any locking, because all of this is done in the generic code.
Translators using generic plc (packet loss concealment) should supply a non-zero plc_samples indicating the size (in samples) of artificially generated frames and incoming data. Generic plc is only available for dstfmt = SLINEAR
Definition at line 137 of file translate.h.
int active |
Whether this translator should be used or not
Definition at line 189 of file translate.h.
Referenced by __ast_register_translator(), ast_translator_activate(), ast_translator_deactivate(), and matrix_rebuild().
int buf_size |
size of outbuf, in bytes. Mandatory. The wrapper code will also allocate an AST_FRIENDLY_OFFSET space before.
Definition at line 182 of file translate.h.
Referenced by __ast_register_translator(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), lintospeex_frameout(), newpvt(), and register_translator().
int buffer_samples |
size of outbuf, in samples. Leave it 0 if you want the framein callback deal with the frame. Set it appropriately if you want the code to checks if the incoming frame fits the outbuf (this is e.g. required for plc).
Definition at line 177 of file translate.h.
Referenced by framein(), and register_translator().
int comp_cost |
Cost value associated with this translator based on computation time. This cost value is computed based on the time required to translate sample data.
Definition at line 147 of file translate.h.
Referenced by __ast_register_translator(), generate_computational_cost(), and matrix_rebuild().
struct ast_codec* core_dst_codec |
Core registered destination codec
Definition at line 142 of file translate.h.
struct ast_codec* core_src_codec |
Core registered source codec
Definition at line 141 of file translate.h.
int desc_size |
size of private descriptor in pvt->pvt, if any
Definition at line 184 of file translate.h.
Referenced by newpvt(), and register_translator().
void(* destroy) (struct ast_trans_pvt *pvt) |
cleanup private data, if needed (often unnecessary).
Definition at line 166 of file translate.h.
Referenced by destroy(), and register_translator().
struct ast_codec dst_codec |
Destination codec
Definition at line 140 of file translate.h.
Referenced by __ast_register_translator(), ast_translate_path_to_str(), ast_translator_build_path(), ast_unregister_translator(), dahdi_translate(), framein(), generate_computational_cost(), ilbctolin_framein(), lintoilbc_frameout(), newpvt(), register_translator(), and resamp_new().
int dst_fmt_index |
index of the destination format in the matrix table
Definition at line 191 of file translate.h.
Referenced by __ast_register_translator(), ast_translator_build_path(), handle_show_translation_path(), and matrix_rebuild().
void(* feedback) (struct ast_trans_pvt *pvt, struct ast_frame *feedback) |
Feedback frame callback. Handle input frame.
Definition at line 162 of file translate.h.
Referenced by ast_translate().
const char* format |
Optional name of a cached format this translator produces
Definition at line 143 of file translate.h.
int(* framein) (struct ast_trans_pvt *pvt, struct ast_frame *in) |
Input frame callback. Store (and possibly convert) input frame.
Definition at line 154 of file translate.h.
Referenced by framein(), and register_translator().
struct ast_frame *(* frameout) (struct ast_trans_pvt *pvt) |
Output frame callback. Generate a frame with outbuf content.
Definition at line 154 of file translate.h.
Referenced by __ast_register_translator(), ast_translate(), generate_computational_cost(), and register_translator().
struct { ... } list |
link field
Referenced by ast_unregister_translator(), and matrix_rebuild().
struct ast_module* module |
opaque reference to the parent module
Definition at line 187 of file translate.h.
Referenced by __ast_register_translator(), destroy(), and newpvt().
char name[80] |
Name of translator
Definition at line 138 of file translate.h.
Referenced by __ast_register_translator(), ast_unregister_translator(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), framein(), generate_computational_cost(), PathSegment::get_child(), lintospeex_frameout(), Parameter::load(), Property::load(), SwaggerType::load(), and register_translator().
int native_plc |
true if the translator can do native plc
Definition at line 185 of file translate.h.
Referenced by framein(), and register_translator().
int(* newpvt) (struct ast_trans_pvt *) |
initialize private data associated with the translator
Definition at line 151 of file translate.h.
Referenced by newpvt(), and register_translator().
struct ast_translator* next |
Definition at line 192 of file translate.h.
struct ast_frame *(* sample) (void) |
Generate an example frame
Definition at line 166 of file translate.h.
Referenced by generate_computational_cost(), and register_translator().
struct ast_codec src_codec |
Source codec
Definition at line 139 of file translate.h.
Referenced by __ast_register_translator(), ast_translate_path_to_str(), ast_unregister_translator(), dahdi_translate(), framein(), handle_show_translation_path(), register_translator(), and resamp_new().
int src_fmt_index |
index of the source format in the matrix table
Definition at line 190 of file translate.h.
Referenced by __ast_register_translator(), and matrix_rebuild().
int table_cost |
Cost value associated with this translator based on translation cost table.
Definition at line 145 of file translate.h.
Referenced by __ast_register_translator(), and matrix_rebuild().