ast_translator Struct Reference

Descriptor of a translator. More...

#include <translate.h>

Collaboration diagram for ast_translator:

Collaboration graph
[legend]

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
struct ast_codeccore_dst_codec
struct ast_codeccore_src_codec
int desc_size
void(* destroy )(struct ast_trans_pvt *pvt)
struct ast_codec dst_codec
int dst_fmt_index
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_modulemodule
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

Detailed Description

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 137 of file translate.h.


Field Documentation

int active

Whether this translator should be used or not

Definition at line 185 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 178 of file translate.h.

Referenced by __ast_register_translator(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), lintospeex_frameout(), load_module(), newpvt(), and register_translator().

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 173 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 147 of file translate.h.

Referenced by __ast_register_translator(), generate_computational_cost(), and matrix_rebuild().

struct ast_codec* core_dst_codec [read]

Core registered destination codec

Definition at line 142 of file translate.h.

struct ast_codec* core_src_codec [read]

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 180 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).

Referenced by destroy(), load_module(), and register_translator().

struct ast_codec dst_codec [read]

index of the destination format in the matrix table

Definition at line 187 of file translate.h.

Referenced by __ast_register_translator(), ast_translator_build_path(), handle_show_translation_path(), and matrix_rebuild().

const char* format

Optional name of a cached format this translator produces

Definition at line 143 of file translate.h.

Referenced by newpvt().

int(* framein)(struct ast_trans_pvt *pvt, struct ast_frame *in)

Input frame callback. Store (and possibly convert) input frame.

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.

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 [read]

opaque reference to the parent module

Definition at line 183 of file translate.h.

Referenced by __ast_register_translator(), destroy(), and newpvt().

char name[80]

true if the translator can do native plc

Definition at line 181 of file translate.h.

Referenced by framein(), and register_translator().

int(* newpvt)(struct ast_trans_pvt *)

initialize private data associated with the translator

Referenced by load_module(), newpvt(), and register_translator().

struct ast_translator* next [read]

Definition at line 188 of file translate.h.

struct ast_frame*(* sample)(void) [read]

Generate an example frame

Referenced by generate_computational_cost(), and register_translator().

struct ast_codec src_codec [read]

index of the source format in the matrix table

Definition at line 186 of file translate.h.

Referenced by __ast_register_translator(), and matrix_rebuild().

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().


The documentation for this struct was generated from the following file:

Generated on Thu Apr 16 06:35:44 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6