Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Media Format Bitfield Compatibility API. More...
#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/astobj2.h"
#include "asterisk/codec.h"
#include "asterisk/format.h"
#include "asterisk/format_compatibility.h"
#include "asterisk/format_cache.h"
#include "asterisk/format_cap.h"
#include "asterisk/utils.h"
#include "include/format_compatibility.h"
Go to the source code of this file.
Functions | |
uint64_t | iax2_format_compatibility_best (uint64_t formats) |
Pick the best format from the given bitfield formats. More... | |
int | iax2_format_compatibility_bitfield2cap (uint64_t bitfield, struct ast_format_cap *cap) |
Convert a bitfield to a format capabilities structure. More... | |
uint64_t | iax2_format_compatibility_cap2bitfield (const struct ast_format_cap *cap) |
Convert a format capabilities structure to a bitfield. More... | |
Media Format Bitfield Compatibility API.
Definition in file channels/iax2/format_compatibility.c.
uint64_t iax2_format_compatibility_best | ( | uint64_t | formats | ) |
Pick the best format from the given bitfield formats.
formats | The bitfield for the media formats |
non-zero | Best format out of the given formats. |
zero | No formats present or no formats considered best. |
Okay, ulaw is used by all telephony equipment, so start with it
Unless of course, you're a silly European, so then prefer ALAW
G.722 is better then all below, but not as common as the above... so give ulaw and alaw priority
Okay, well, signed linear is easy to translate into other stuff
G.726 is standard ADPCM, in RFC3551 packing order
G.726 is standard ADPCM, in AAL2 packing order
ADPCM has great sound quality and is still pretty easy to translate
Okay, we're down to vocoders now, so pick GSM because it's small and easier to translate and sounds pretty good
iLBC is not too bad
Speex is free, but computationally more expensive than GSM
Opus
Ick, LPC10 sounds terrible, but at least we have code for it, if you're tacky enough to use it
G.729a is faster than 723 and slightly less expensive
Down to G.723.1 which is proprietary but at least designed for voice
Definition at line 79 of file channels/iax2/format_compatibility.c.
References ARRAY_LEN, AST_FORMAT_ADPCM, AST_FORMAT_ALAW, AST_FORMAT_G719, AST_FORMAT_G722, AST_FORMAT_G723, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, AST_FORMAT_G729, AST_FORMAT_GSM, AST_FORMAT_ILBC, AST_FORMAT_LPC10, AST_FORMAT_OPUS, AST_FORMAT_SIREN14, AST_FORMAT_SIREN7, AST_FORMAT_SLIN, AST_FORMAT_SLIN16, AST_FORMAT_SPEEX, AST_FORMAT_SPEEX16, and AST_FORMAT_ULAW.
Referenced by iax2_codec_pref_best_bitfield2cap(), iax2_codec_pref_from_bitfield(), and socket_process_helper().
int iax2_format_compatibility_bitfield2cap | ( | uint64_t | bitfield, |
struct ast_format_cap * | cap | ||
) |
Convert a bitfield to a format capabilities structure.
bitfield | The bitfield for the media formats |
cap | Capabilities structure to place formats into |
0 | on success. |
-1 | on error. |
Definition at line 59 of file channels/iax2/format_compatibility.c.
References ast_format_cap_append, and ast_format_compatibility_bitfield2format().
Referenced by iax2_codec_choose(), and iax2_getformatname_multiple().
uint64_t iax2_format_compatibility_cap2bitfield | ( | const struct ast_format_cap * | cap | ) |
Convert a format capabilities structure to a bitfield.
cap | Capabilities structure containing formats |
non-zero | success |
zero | no formats present or no formats supported |
Definition at line 43 of file channels/iax2/format_compatibility.c.
References ao2_ref, ast_format_cap_count(), ast_format_cap_get_format(), and ast_format_compatibility_format2bitfield().
Referenced by iax2_call(), iax2_parse_allow_disallow(), and socket_process_helper().