Yate
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
IAXFormat Class Reference

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

#include <yateiax.h>

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) , GSM_HR = (1 << 31) , 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 IAXFormatDescformatDesc (bool in) 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 const StringtypeNameStr (int type)
 

Static Public Attributes

static const TokenDict s_formats []
 
static const TokenDict s_types []
 
static const String s_typesList [TypeCount]
 

Protected Attributes

int m_type
 
IAXFormatDesc m_format
 
IAXFormatDesc m_formatIn
 
IAXFormatDesc 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

◆ Formats

enum Formats

Format enumeration types

◆ Media

enum Media

Media type enumeration

Constructor & Destructor Documentation

◆ IAXFormat()

IAXFormat ( int  type = Audio)
inline

Constructor. Build an audio format

Parameters
typeMedia type

Member Function Documentation

◆ clear()

static u_int32_t clear ( u_int32_t  value,
int  type 
)
inlinestatic

Clear formats by type

Parameters
valueInput format(s)
typeMedia type to clear
Returns
Cleared format(s) from input

◆ encode()

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

◆ format()

u_int32_t format ( ) const
inline

Get the format

Returns
The format

Referenced by IAXTransaction::format().

◆ formatDesc()

const IAXFormatDesc & formatDesc ( bool  in) const
inline

Get the incoming or outgoing format description

Parameters
inTrue to retrieve the incoming format, false to retrieve the outgoing one
Returns
Requested format desc

◆ formatList()

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

◆ formatName() [1/2]

const char * formatName ( ) const
inline

Get the text associated with the format

Returns
Format name

◆ formatName() [2/2]

static const char * formatName ( u_int32_t  fmt)
inlinestatic

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

◆ in()

u_int32_t in ( ) const
inline

Get the incoming format

Returns
The incoming format

Referenced by IAXTransaction::formatIn().

◆ mask()

static u_int32_t mask ( u_int32_t  value,
int  type 
)
inlinestatic

Mask formats by type

Parameters
valueInput format(s)
typeMedia type to retrieve
Returns
Media format(s) from input

◆ out()

u_int32_t out ( ) const
inline

Get the outgoing format

Returns
The outgoing format

Referenced by IAXTransaction::formatOut().

◆ pickFormat()

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

◆ set()

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

◆ type()

int type ( ) const
inline

Get the media type

Returns
Media type

◆ typeName() [1/2]

const char * typeName ( ) const
inline

Get the text associated with the media type

Returns
Media name

◆ typeName() [2/2]

static const char * typeName ( int  type)
inlinestatic

Get the text associated with a media type

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

◆ typeNameStr()

static const String & typeNameStr ( int  type)
inlinestatic

Get the text associated with a media type

Parameters
typeThe media type
Returns
A string associated with the media type

Member Data Documentation

◆ s_formats

const TokenDict s_formats[]
static

Keep the texts associated with the formats

◆ s_types

const TokenDict s_types[]
static

Keep the texts associated with type

◆ s_typesList

const String s_typesList[TypeCount]
static

Keep the texts associated with a type also as String


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