#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 | cost |
int | desc_size |
void(* | destroy )(struct ast_trans_pvt *pvt) |
int | dstfmt |
int(* | framein )(struct ast_trans_pvt *pvt, struct ast_frame *in) |
ast_frame *(* | frameout )(struct ast_trans_pvt *pvt) |
struct { | |
ast_translator * next | |
} | list |
ast_module * | module |
const char | name [80] |
int | native_plc |
int(* | newpvt )(struct ast_trans_pvt *) |
int | plc_samples |
ast_frame *(* | sample )(void) |
int | srcfmt |
int | useplc |
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 71 of file translate.h.
int active |
Whether this translator should be used or not
Definition at line 115 of file translate.h.
Referenced by __ast_register_translator(), ast_translator_activate(), ast_translator_deactivate(), and rebuild_matrix().
int buf_size |
size of outbuf, in bytes. Mandatory. The wrapper code will also allocate an AST_FRIENDLY_OFFSET space before.
Definition at line 105 of file translate.h.
Referenced by __ast_register_translator(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), and newpvt().
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 100 of file translate.h.
Referenced by __ast_register_translator(), and framein().
int cost |
Cost in milliseconds for encoding/decoding 1 second of sound
Definition at line 114 of file translate.h.
Referenced by __ast_register_translator(), ast_translator_best_choice(), calc_cost(), handle_cli_core_show_translation(), and rebuild_matrix().
int desc_size |
size of private descriptor in pvt->pvt, if any
Definition at line 107 of file translate.h.
Referenced by newpvt().
void(* destroy)(struct ast_trans_pvt *pvt) |
cleanup private data, if needed (often unnecessary).
Referenced by destroy().
int dstfmt |
Destination format (note: bit position, converted to index during registration)
Definition at line 75 of file translate.h.
Referenced by __ast_register_translator(), ast_trans_frameout(), ast_translator_build_path(), ast_unregister_translator(), calc_cost(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), dahdi_new(), drop_translator(), and rebuild_matrix().
int(* framein)(struct ast_trans_pvt *pvt, struct ast_frame *in) |
Input frame callback. Store (and possibly convert) input frame.
Referenced by framein().
struct ast_frame*(* frameout)(struct ast_trans_pvt *pvt) |
Output frame callback. Generate a frame with outbuf content.
Referenced by __ast_register_translator(), and calc_cost().
struct { ... } list |
link field
Referenced by ast_unregister_translator(), and rebuild_matrix().
struct ast_module* module |
Definition at line 112 of file translate.h.
Referenced by __ast_register_translator(), destroy(), and newpvt().
const char name[80] |
Name of translator
Definition at line 72 of file translate.h.
Referenced by __ast_register_translator(), ast_trans_frameout(), ast_unregister_translator(), calc_cost(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), and framein().
int native_plc |
true if the translator can do native plc
Definition at line 110 of file translate.h.
Referenced by framein().
int(* newpvt)(struct ast_trans_pvt *) |
initialize private data associated with the translator
Referenced by newpvt().
struct ast_translator* next |
Definition at line 116 of file translate.h.
int plc_samples |
set to the plc block size if used, 0 otherwise
Definition at line 108 of file translate.h.
Referenced by __ast_register_translator(), framein(), and newpvt().
Generate an example frame
Referenced by calc_cost().
int srcfmt |
Source format (note: bit position, converted to index during registration)
Definition at line 73 of file translate.h.
Referenced by __ast_register_translator(), ast_unregister_translator(), dahdi_new(), drop_translator(), is_encoder(), and rebuild_matrix().
int useplc |
current status of plc, changed at runtime
Definition at line 109 of file translate.h.
Referenced by newpvt(), parse_config(), and reload().