46 static int differential = (int)
'A';
52 if (!pref->
order[x]) {
56 buf[x] = pref->
order[x] + differential;
66 pref->
order[x] =
buf[x] - differential;
80 uint64_t pref_bitfield;
96 uint64_t pref_bitfield;
100 if (!pref_bitfield) {
114 uint64_t best_bitfield;
123 if (!best_bitfield) {
127 if (best_bitfield & bitfield) {
134 bitfield &= ~best_bitfield;
142 if (!best_bitfield) {
156 bitfield &= ~best_bitfield;
163 for (bit = 0; bit < 64; ++bit) {
164 uint64_t mask = (1ULL << bit);
166 if (mask & bitfield) {
194 strcpy(
buf,
"(...)");
200 total_len = size - 3;
212 name_len = strlen(
name);
231 sprintf(cur,
"%s%s", x ?
"|" :
"",
name);
233 total_len -= name_len;
243 return size - total_len;
250 idx = codec_pref_index;
253 pref->
order[idx] = 0;
261 if (!pref->
order[idx]) {
272 if (!pref->
order[0]) {
277 if (!pref->
order[x]) {
281 if (pref->
order[x] == format_index) {
292 if (!pref->
order[0]) {
301 uint64_t pref_bitfield;
304 if (!pref_bitfield) {
309 if (!(pref_bitfield & bitfield)) {
412 if (!pref->
order[x]) {
413 pref->
order[x] = format_index;
433 int only_if_existing)
450 if (!pref->
order[x] || pref->
order[x] == format_index)
465 if (only_if_existing && !pref->
order[x]) {
477 pref->
order[0] = format_index;
484 uint64_t working_bitfield;
485 uint64_t best_bitfield;
489 memset(pref, 0,
sizeof(*pref));
491 working_bitfield = bitfield;
494 while (working_bitfield) {
496 if (!best_bitfield) {
502 working_bitfield &= ~best_bitfield;
512 if (working_bitfield) {
513 for (bit = 0; bit < 64; ++bit) {
514 uint64_t mask = (1ULL << bit);
516 if (mask & working_bitfield) {
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
int iax2_codec_pref_string(struct iax2_codec_pref *pref, char *buf, size_t size)
Dump audio codec preference list into a string.
static void iax2_codec_pref_append_bitfield(struct iax2_codec_pref *pref, uint64_t bitfield, unsigned int framing)
void iax2_codec_pref_prepend(struct iax2_codec_pref *pref, struct ast_format *format, unsigned int framing, int only_if_existing)
Prepend an audio codec to a preference list, removing it first if it was already there.
int iax2_codec_pref_format_bitfield_to_order_value(uint64_t bitfield)
Convert a format bitfield into an iax2_codec_pref order value.
uint64_t iax2_codec_pref_order_value_to_format_bitfield(int order_value)
Convert an iax2_codec_pref order value into a format bitfield.
uint64_t iax2_codec_pref_from_bitfield(struct iax2_codec_pref *pref, uint64_t bitfield)
Create codec preference list from the given bitfield formats.
struct ast_format * iax2_codec_pref_index(struct iax2_codec_pref *pref, int idx, struct ast_format **result)
Codec located at a particular place in the preference index.
void iax2_codec_pref_convert(struct iax2_codec_pref *pref, char *buf, size_t size, int right)
Shift an audio codec preference list up or down 65 bytes so that it becomes an ASCII string.
void iax2_codec_pref_remove_missing(struct iax2_codec_pref *pref, uint64_t bitfield)
Removes format from the pref list that aren't in the bitfield.
void iax2_codec_pref_append(struct iax2_codec_pref *pref, struct ast_format *format, unsigned int framing)
Append a audio codec to a preference list, removing it first if it was already there.
static void codec_pref_remove_index(struct iax2_codec_pref *pref, int codec_pref_index)
static void codec_pref_remove(struct iax2_codec_pref *pref, int format_index)
Remove codec from pref list.
static const uint64_t iax2_supported_formats[]
Formats supported by IAX2.
int iax2_codec_pref_to_cap(struct iax2_codec_pref *pref, struct ast_format_cap *cap)
Convert a preference structure to a capabilities structure.
int iax2_codec_pref_best_bitfield2cap(uint64_t bitfield, struct iax2_codec_pref *prefs, struct ast_format_cap *cap)
Convert a bitfield to a format capabilities structure in the "best" order.
Media Format Bitfield Compatibility API.
Support for logging to various files, console and syslog Configuration in file logger....
unsigned int framing[IAX2_CODEC_PREF_SIZE]
char order[IAX2_CODEC_PREF_SIZE]