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)) {
414 if (!pref->
order[x]) {
415 pref->
order[x] = format_index;
435 int only_if_existing)
452 if (!pref->
order[x] || pref->
order[x] == format_index)
467 if (only_if_existing && !pref->
order[x]) {
479 pref->
order[0] = format_index;
486 uint64_t working_bitfield;
487 uint64_t best_bitfield;
491 memset(pref, 0,
sizeof(*pref));
493 working_bitfield = bitfield;
496 while (working_bitfield) {
498 if (!best_bitfield) {
504 working_bitfield &= ~best_bitfield;
514 if (working_bitfield) {
515 for (bit = 0; bit < 64; ++bit) {
516 uint64_t mask = (1ULL << bit);
518 if (mask & working_bitfield) {
Asterisk main include file. File version handling, generic pbx functions.
static void iax2_codec_pref_append_bitfield(struct iax2_codec_pref *pref, uint64_t bitfield, unsigned int framing)
uint64_t iax2_codec_pref_from_bitfield(struct iax2_codec_pref *pref, uint64_t bitfield)
Create codec preference list from the given bitfield formats.
static const uint64_t iax2_supported_formats[]
Formats supported by IAX2.
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_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_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.
uint64_t iax2_codec_pref_order_value_to_format_bitfield(int order_value)
Convert an iax2_codec_pref order value into a format bitfield.
int iax2_codec_pref_to_cap(struct iax2_codec_pref *pref, struct ast_format_cap *cap)
Convert a preference structure to a capabilities structure.
#define ao2_ref(o, delta)
int iax2_codec_pref_string(struct iax2_codec_pref *pref, char *buf, size_t size)
Dump audio codec preference list into a string.
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.
unsigned int framing[IAX2_CODEC_PREF_SIZE]
int iax2_codec_pref_format_bitfield_to_order_value(uint64_t bitfield)
Convert a format bitfield into an iax2_codec_pref order value.
Support for logging to various files, console and syslog Configuration in file logger.conf.
char order[IAX2_CODEC_PREF_SIZE]
Media Format Bitfield Compatibility API.
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...
static void codec_pref_remove_index(struct iax2_codec_pref *pref, int codec_pref_index)
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.
static snd_pcm_format_t format
static void codec_pref_remove(struct iax2_codec_pref *pref, int format_index)
Remove codec from pref list.