Asterisk - The Open Source Telephony Project  21.4.1
Data Fields
ast_translator Struct Reference

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
 
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
 
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_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, 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.

Field Documentation

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

void(* destroy) (struct ast_trans_pvt *pvt)

cleanup private data, if needed (often unnecessary).

Definition at line 166 of file translate.h.

struct ast_codec dst_codec
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(), 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.

Referenced by newpvt().

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

struct ast_frame*(* frameout) (struct ast_trans_pvt *pvt)

Output frame callback. Generate a frame with outbuf content.

Definition at line 158 of file translate.h.

Referenced by __ast_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(), and newpvt().

char name[80]
int native_plc

true if the translator can do native plc

Definition at line 185 of file translate.h.

Referenced by framein().

int(* newpvt) (struct ast_trans_pvt *)

initialize private data associated with the translator

Definition at line 151 of file translate.h.

Referenced by newpvt().

struct ast_frame*(* sample) (void)

Generate an example frame

Definition at line 170 of file translate.h.

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(), and framein().

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


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