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. | |
| 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). | |
| int | comp_cost |
| int | desc_size |
| void(* | destroy )(struct ast_trans_pvt *pvt) |
| int | dst_fmt_index |
| struct ast_format | dst_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) |
| int | src_fmt_index |
| struct ast_format | src_format |
| 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, 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 135 of file translate.h.
| int active |
Whether this translator should be used or not
Definition at line 180 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 173 of file translate.h.
Referenced by __ast_register_translator(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), lintospeex_frameout(), load_module(), 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 168 of file translate.h.
Referenced by framein(), load_module(), 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 142 of file translate.h.
Referenced by __ast_register_translator(), generate_computational_cost(), and matrix_rebuild().
| int desc_size |
size of private descriptor in pvt->pvt, if any
Definition at line 175 of file translate.h.
Referenced by load_module(), newpvt(), and register_translator().
| void(* destroy)(struct ast_trans_pvt *pvt) |
cleanup private data, if needed (often unnecessary).
Definition at line 157 of file translate.h.
Referenced by destroy(), load_module(), and register_translator().
| int dst_fmt_index |
index of the destination format in the matrix table
Definition at line 182 of file translate.h.
Referenced by __ast_register_translator(), ast_translator_build_path(), handle_show_translation_path(), and matrix_rebuild().
| struct ast_format dst_format |
Destination format
Definition at line 138 of file translate.h.
Referenced by __ast_register_translator(), ast_trans_frameout(), ast_translate_path_to_str(), ast_unregister_translator(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), dahdi_new(), drop_translator(), generate_computational_cost(), handle_show_translation_path(), load_module(), register_translator(), and resamp_new().
| int(* framein)(struct ast_trans_pvt *pvt, struct ast_frame *in) |
Input frame callback. Store (and possibly convert) input frame.
Definition at line 149 of file translate.h.
Referenced by framein(), load_module(), and register_translator().
struct ast_frame*(* frameout)(struct ast_trans_pvt *pvt) [read] |
Output frame callback. Generate a frame with outbuf content.
Definition at line 153 of file translate.h.
Referenced by __ast_register_translator(), 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 178 of file translate.h.
Referenced by __ast_register_translator(), destroy(), and newpvt().
| char name[80] |
Name of translator
Definition at line 136 of file translate.h.
Referenced by __ast_register_translator(), ast_trans_frameout(), ast_unregister_translator(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), framein(), generate_computational_cost(), and register_translator().
| int native_plc |
true if the translator can do native plc
Definition at line 176 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 146 of file translate.h.
Referenced by load_module(), newpvt(), and register_translator().
| struct ast_translator* next |
Definition at line 183 of file translate.h.
Generate an example frame
Definition at line 161 of file translate.h.
Referenced by generate_computational_cost(), and register_translator().
| int src_fmt_index |
index of the source format in the matrix table
Definition at line 181 of file translate.h.
Referenced by __ast_register_translator(), and matrix_rebuild().
| struct ast_format src_format |
Source format
Definition at line 137 of file translate.h.
Referenced by __ast_register_translator(), ast_translate_path_to_str(), ast_unregister_translator(), dahdi_new(), drop_translator(), handle_show_translation_path(), is_encoder(), load_module(), register_translator(), and resamp_new().
| int table_cost |
Cost value associated with this translator based on translation cost table.
Definition at line 140 of file translate.h.
Referenced by __ast_register_translator(), and matrix_rebuild().