Sat Aug 6 00:40:08 2011

Asterisk developer's documentation


ast_translator Struct Reference

Descriptor of a translator. Name, callbacks, and various options related to run-time operation (size of buffers, auxiliary descriptors, etc). 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 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_modulemodule
const char name [80]
int native_plc
int(* newpvt )(struct ast_trans_pvt *)
int plc_samples
ast_frame *(* sample )(void)
int srcfmt
int useplc


Detailed Description

Descriptor of a translator. Name, callbacks, and various options related to run-time operation (size of buffers, auxiliary descriptors, etc).

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.

Definition at line 64 of file translate.h.


Field Documentation

int active

Whether this translator should be used or not

Definition at line 108 of file translate.h.

int buf_size

size of outbuf, in bytes. Mandatory. The wrapper code will also allocate an AST_FRIENDLY_OFFSET space before.

Definition at line 98 of file translate.h.

Referenced by dahdi_decoder_frameout(), and dahdi_encoder_frameout().

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

Referenced by framein().

int cost

Cost in milliseconds for encoding/decoding 1 second of sound

Definition at line 107 of file translate.h.

Referenced by __ast_register_translator(), ast_translator_best_choice(), rebuild_matrix(), show_translation(), and show_translation_deprecated().

int desc_size

size of private descriptor in pvt->pvt, if any

Definition at line 100 of file translate.h.

void(* destroy)(struct ast_trans_pvt *pvt)

cleanup private data, if needed (often unnecessary).

int dstfmt

Destination format (note: bit position, converted to index during registration)

Definition at line 68 of file translate.h.

Referenced by __ast_register_translator(), ast_trans_frameout(), ast_translator_build_path(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), dahdi_new(), and drop_translator().

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.

struct { ... } list

link field

Referenced by ast_unregister_translator(), and rebuild_matrix().

struct ast_module* module

Definition at line 105 of file translate.h.

const char name[80]

Name of translator

Definition at line 65 of file translate.h.

Referenced by ast_trans_frameout(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), and framein().

int native_plc

true if the translator can do native plc

Definition at line 103 of file translate.h.

Referenced by framein().

int(* newpvt)(struct ast_trans_pvt *)

initialize private data associated with the translator

struct ast_translator* next

Definition at line 109 of file translate.h.

int plc_samples

Definition at line 101 of file translate.h.

struct ast_frame*(* sample)(void)

Generate an example frame

int srcfmt

Source format (note: bit position, converted to index during registration)

Definition at line 66 of file translate.h.

Referenced by __ast_register_translator(), dahdi_new(), drop_translator(), and is_encoder().

int useplc

Definition at line 102 of file translate.h.

Referenced by parse_config().


The documentation for this struct was generated from the following file:
Generated on Sat Aug 6 00:40:08 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7