Yate
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes
IAXFormat Class Reference

Wrapper class for audio and video formats. More...

#include <yateiax.h>

List of all members.

Public Types

enum  Formats {
  G723_1 = (1 << 0), GSM = (1 << 1), ULAW = (1 << 2), ALAW = (1 << 3),
  G726 = (1 << 4), ADPCM = (1 << 5), SLIN = (1 << 6), LPC10 = (1 << 7),
  G729 = (1 << 8), SPEEX = (1 << 9), ILBC = (1 << 10), G726AAL2 = (1 << 11),
  G722 = (1 << 12), AMR = (1 << 13), AudioMask, JPEG = (1 << 16),
  PNG = (1 << 17), ImageMask = JPEG | PNG, H261 = (1 << 18), H263 = (1 << 19),
  H263p = (1 << 20), H264 = (1 << 21), VideoMask = H261 | H263 | H263p | H264
}
enum  Media { Audio = 0, Video, Image, TypeCount }

Public Member Functions

 IAXFormat (int type=Audio)
int type () const
u_int32_t format () const
u_int32_t in () const
u_int32_t out () const
const char * formatName () const
const char * typeName () const
void set (u_int32_t *fmt, u_int32_t *fmtIn, u_int32_t *fmtOut)

Static Public Member Functions

static void formatList (String &dest, u_int32_t formats, const TokenDict *dict=0, const char *sep=",")
static u_int32_t pickFormat (u_int32_t formats, u_int32_t format=0)
static u_int32_t encode (const String &formats, const TokenDict *dict, char sep= ',')
static u_int32_t mask (u_int32_t value, int type)
static u_int32_t clear (u_int32_t value, int type)
static const char * formatName (u_int32_t fmt)
static const char * typeName (int type)

Static Public Attributes

static const TokenDict s_formats []
static const TokenDict s_types []

Protected Attributes

int m_type
u_int32_t m_format
u_int32_t m_formatIn
u_int32_t m_formatOut

Detailed Description

Wrapper class for audio and video formats.

This class holds the enumeration values for audio and video formats


Member Enumeration Documentation

enum Formats

Format enumeration types

enum Media

Media type enumeration


Constructor & Destructor Documentation

IAXFormat ( int  type = Audio) [inline]

Constructor. Build an audio format

Parameters:
typeMedia type

Member Function Documentation

static u_int32_t clear ( u_int32_t  value,
int  type 
) [inline, static]

Clear formats by type

Parameters:
valueInput format(s)
typeMedia type to clear
Returns:
Cleared format(s) from input
static u_int32_t encode ( const String formats,
const TokenDict dict,
char  sep = ',' 
) [static]

Encode a formats list

Parameters:
formatsFormats list
dictDictionary to use
sepFormats list separator
Returns:
Encoded formats
u_int32_t format ( ) const [inline]

Get the format

Returns:
The format

Referenced by IAXTransaction::format().

static void formatList ( String dest,
u_int32_t  formats,
const TokenDict dict = 0,
const char *  sep = "," 
) [static]

Create a string list from formats

Parameters:
destThe destination
formatsThe formats
dictOptional dictionary to use, 0 to use s_formats
sepThe separator to use
const char* formatName ( ) const [inline]

Get the text associated with the format

Returns:
Format name

References IAXFormat::formatName().

Referenced by IAXFormat::formatName().

static const char* formatName ( u_int32_t  fmt) [inline, static]

Get the text associated with a format

Parameters:
fmtThe desired format
Returns:
A pointer to the text associated with the format or 0 if the format doesn't exist

References TelEngine::lookup().

u_int32_t in ( ) const [inline]

Get the incoming format

Returns:
The incoming format

Referenced by IAXTransaction::formatIn().

static u_int32_t mask ( u_int32_t  value,
int  type 
) [inline, static]

Mask formats by type

Parameters:
valueInput format(s)
typeMedia type to retrieve
Returns:
Media format(s) from input
u_int32_t out ( ) const [inline]

Get the outgoing format

Returns:
The outgoing format

Referenced by IAXTransaction::formatOut().

static u_int32_t pickFormat ( u_int32_t  formats,
u_int32_t  format = 0 
) [static]

Pick a format from a list of capabilities

Parameters:
formatsCapabilities list
formatOptional format to pick
Returns:
IAX format, 0 if not found
void set ( u_int32_t *  fmt,
u_int32_t *  fmtIn,
u_int32_t *  fmtOut 
)

Set format

Parameters:
fmtOptional pointer to format to set
fmtInOptional pointer to incoming format to set
fmtOutOptional pointer to outgoing format to set
int type ( ) const [inline]

Get the media type

Returns:
Media type
const char* typeName ( ) const [inline]

Get the text associated with the media type

Returns:
Media name

References IAXFormat::typeName().

Referenced by IAXFormat::typeName().

static const char* typeName ( int  type) [inline, static]

Get the text associated with a media type

Parameters:
typeThe media type
Returns:
A pointer to the text associated with the media type

References TelEngine::lookup().


Member Data Documentation

const TokenDict s_formats[] [static]

Keep the texts associated with the formats

const TokenDict s_types[] [static]

Keep the texts associated with type


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