#include <translate.h>
Public Member Functions | |
AST_LIST_ENTRY (ast_translator) list | |
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) |
struct ast_frame *(* | frameout )(struct ast_trans_pvt *pvt) |
struct ast_module * | module |
const char | name [80] |
int | native_plc |
int(* | newpvt )(struct ast_trans_pvt *) |
int | plc_samples |
struct ast_frame *(* | sample )(void) |
int | srcfmt |
int | useplc |
A coded 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 68 of file translate.h.
AST_LIST_ENTRY | ( | ast_translator | ) |
link field
int active |
Whether this translator should be used or not
Definition at line 112 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 102 of file translate.h.
Referenced by __ast_register_translator(), 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 97 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 111 of file translate.h.
Referenced by __ast_register_translator(), ast_translator_best_choice(), calc_cost(), rebuild_matrix(), show_translation(), and show_translation_deprecated().
int desc_size |
size of private descriptor in pvt->pvt, if any
Definition at line 104 of file translate.h.
Referenced by newpvt(), and register_translator().
void(* destroy)(struct ast_trans_pvt *pvt) |
cleanup private data, if needed (often unnecessary).
Referenced by destroy(), and register_translator().
int dstfmt |
Destination format (note: bit position, converted to index during registration)
Definition at line 72 of file translate.h.
Referenced by __ast_register_translator(), ast_trans_frameout(), ast_translator_build_path(), ast_unregister_translator(), calc_cost(), drop_translator(), rebuild_matrix(), register_translator(), and zap_new().
int(* framein)(struct ast_trans_pvt *pvt, struct ast_frame *in) |
Input frame callback. Store (and possibly convert) input frame.
Referenced by framein(), and register_translator().
struct ast_frame*(* frameout)(struct ast_trans_pvt *pvt) [read] |
Output frame callback. Generate a frame with outbuf content.
Referenced by __ast_register_translator(), calc_cost(), and register_translator().
struct ast_module* module [read] |
Definition at line 109 of file translate.h.
Referenced by __ast_register_translator(), destroy(), and newpvt().
const char name[80] |
Name of translator
Definition at line 69 of file translate.h.
Referenced by __ast_register_translator(), ast_trans_frameout(), ast_unregister_translator(), calc_cost(), framein(), and register_translator().
int native_plc |
true if the translator can do native plc
Definition at line 107 of file translate.h.
Referenced by framein().
int(* newpvt)(struct ast_trans_pvt *) |
initialize private data associated with the translator
Referenced by newpvt(), and register_translator().
int plc_samples |
set to the plc block size if used, 0 otherwise
Definition at line 105 of file translate.h.
Referenced by __ast_register_translator(), framein(), and newpvt().
Generate an example frame
Referenced by calc_cost(), and register_translator().
int srcfmt |
Source format (note: bit position, converted to index during registration)
Definition at line 70 of file translate.h.
Referenced by __ast_register_translator(), ast_unregister_translator(), drop_translator(), rebuild_matrix(), register_translator(), and zap_new().
int useplc |
current status of plc, changed at runtime
Definition at line 106 of file translate.h.
Referenced by newpvt(), parse_config(), register_translator(), and reload().