Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Media Format Bitfield Compatibility API. More...
Go to the source code of this file.
Data Structures | |
struct | iax2_codec_pref |
Macros | |
#define | IAX2_CODEC_PREF_SIZE 64 |
Functions | |
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. More... | |
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. More... | |
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. More... | |
int | iax2_codec_pref_format_bitfield_to_order_value (uint64_t bitfield) |
Convert a format bitfield into an iax2_codec_pref order value. More... | |
uint64_t | iax2_codec_pref_from_bitfield (struct iax2_codec_pref *pref, uint64_t bitfield) |
Create codec preference list from the given bitfield formats. More... | |
struct ast_format * | iax2_codec_pref_index (struct iax2_codec_pref *pref, int index, struct ast_format **result) |
Codec located at a particular place in the preference index. More... | |
uint64_t | iax2_codec_pref_order_value_to_format_bitfield (int order_value) |
Convert an iax2_codec_pref order value into a format bitfield. More... | |
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. More... | |
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. More... | |
int | iax2_codec_pref_string (struct iax2_codec_pref *pref, char *buf, size_t size) |
Dump audio codec preference list into a string. More... | |
int | iax2_codec_pref_to_cap (struct iax2_codec_pref *pref, struct ast_format_cap *cap) |
Convert a preference structure to a capabilities structure. More... | |
Media Format Bitfield Compatibility API.
Definition in file codec_pref.h.
#define IAX2_CODEC_PREF_SIZE 64 |
Definition at line 33 of file codec_pref.h.
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.
Definition at line 420 of file codec_pref.c.
References ast_format_compatibility_format2bitfield(), and iax2_codec_pref_append_bitfield().
Referenced by iax2_parse_allow_disallow().
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.
bitfield | The bitfield for the media formats |
prefs | Format preference order to use as a guide. (May be NULL) |
cap | Capabilities structure to place formats into |
0 | on success. |
-1 | on error. |
Definition at line 112 of file codec_pref.c.
References ARRAY_LEN, ast_assert, ast_format_cap_append, ast_format_compatibility_bitfield2format(), iax2_codec_pref::framing, iax2_codec_pref_order_value_to_format_bitfield(), iax2_format_compatibility_best(), NULL, and iax2_codec_pref::order.
Referenced by ast_iax2_new(), and socket_process_helper().
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.
pref | A codec preference list structure |
buf | A string denoting codec preference, appropriate for use in line transmission |
size | Size of buf |
right | Boolean: if 0, convert from buf to pref; if 1, convert from pref to buf. |
Definition at line 44 of file codec_pref.c.
References ARRAY_LEN, buf, iax2_codec_pref::framing, and iax2_codec_pref::order.
Referenced by check_access(), dump_prefs(), iax2_call(), and socket_process_helper().
int iax2_codec_pref_format_bitfield_to_order_value | ( | uint64_t | bitfield | ) |
Convert a format bitfield into an iax2_codec_pref order value.
bitfield | value being converted |
Definition at line 376 of file codec_pref.c.
References ARRAY_LEN, and iax2_supported_formats.
Referenced by iax2_codec_pref_append_bitfield(), and iax2_codec_pref_prepend().
uint64_t iax2_codec_pref_from_bitfield | ( | struct iax2_codec_pref * | pref, |
uint64_t | bitfield | ||
) |
Create codec preference list from the given bitfield formats.
pref | Codec preference list to setup from the given bitfield. |
bitfield | Format bitfield to guide preference list creation. |
Definition at line 481 of file codec_pref.c.
References ast_assert, ast_format_compatibility_bitfield2format(), iax2_codec_pref_append_bitfield(), iax2_format_compatibility_best(), and NULL.
Referenced by set_config().
struct ast_format * iax2_codec_pref_index | ( | struct iax2_codec_pref * | pref, |
int | index, | ||
struct ast_format ** | result | ||
) |
Codec located at a particular place in the preference index.
pref | preference structure to get the codec out of |
index | to retrieve from |
result | ast_format structure to store the index value in |
Definition at line 77 of file codec_pref.c.
References ARRAY_LEN, ast_format_compatibility_bitfield2format(), iax2_codec_pref_order_value_to_format_bitfield(), NULL, iax2_codec_pref::order, and result.
Referenced by function_iaxpeer(), and socket_process_helper().
uint64_t iax2_codec_pref_order_value_to_format_bitfield | ( | int | order_value | ) |
Convert an iax2_codec_pref order value into a format bitfield.
order_value | value being converted |
Definition at line 367 of file codec_pref.c.
References ARRAY_LEN, and iax2_supported_formats.
Referenced by codec_choose_from_prefs(), iax2_codec_pref_best_bitfield2cap(), iax2_codec_pref_index(), iax2_codec_pref_remove_missing(), and iax2_codec_pref_to_cap().
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.
Definition at line 432 of file codec_pref.c.
References ARRAY_LEN, ast_assert, ast_format_compatibility_format2bitfield(), iax2_codec_pref::framing, iax2_codec_pref_format_bitfield_to_order_value(), and iax2_codec_pref::order.
Referenced by create_addr().
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.
Definition at line 288 of file codec_pref.c.
References ARRAY_LEN, codec_pref_remove_index(), iax2_codec_pref_order_value_to_format_bitfield(), and iax2_codec_pref::order.
Referenced by iax2_parse_allow_disallow().
int iax2_codec_pref_string | ( | struct iax2_codec_pref * | pref, |
char * | buf, | ||
size_t | size | ||
) |
Dump audio codec preference list into a string.
pref | preference structure to dump string representation of order for |
buf | character buffer to put string into |
size | size of the character buffer |
Definition at line 178 of file codec_pref.c.
References ao2_cleanup, ao2_ref, ast_format_cap_alloc, ast_format_cap_count(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_format(), ast_format_get_name(), buf, iax2_codec_pref_to_cap(), and name.
Referenced by dump_prefs(), handle_cli_iax2_show_peer(), and socket_process_helper().
int iax2_codec_pref_to_cap | ( | struct iax2_codec_pref * | pref, |
struct ast_format_cap * | cap | ||
) |
Convert a preference structure to a capabilities structure.
pref | Formats in preference order to build the capabilities. |
cap | Capabilities structure to place formats into |
0 | on success. |
-1 | on error. |
Definition at line 91 of file codec_pref.c.
References ARRAY_LEN, ast_format_cap_append, ast_format_compatibility_bitfield2format(), iax2_codec_pref::framing, iax2_codec_pref_order_value_to_format_bitfield(), and iax2_codec_pref::order.
Referenced by iax2_codec_pref_string(), and iax2_parse_allow_disallow().