118 const char *tag,
const char *file,
int line,
const char *func)
123 tag, file, line, func);
146 ao2_cleanup(framed->
format);
195 int __ast_format_cap_append(
struct ast_format_cap *cap,
struct ast_format *format,
unsigned int framing,
const char *tag,
const char *file,
int line,
const char *func)
199 ast_assert(format != NULL);
201 if (format_in_format_cap(cap, format)) {
210 __ao2_ref(format, +1, tag, file, line, func);
213 return format_cap_framed_init(framed, cap, format, framing);
230 if ((type != AST_MEDIA_TYPE_UNKNOWN) && codec->
type != type) {
246 if (codec != codec2) {
291 ast_assert(format != NULL);
297 ao2_t_replace(framed->
format, format,
"replacing with new format");
322 int res = 0, all = 0, iter_allowing;
323 char *parse = NULL, *
this = NULL, *psize = NULL;
325 if (!allowing && ast_strlen_zero(list)) {
335 if (parse[0] ==
'(' && parse[strlen(parse) - 1] ==
')') {
337 parse[strlen(parse) - 1] =
'\0';
347 while ((
this =
ast_strip(strsep(&parse,
",|")))) {
351 iter_allowing = allowing;
354 iter_allowing = !allowing;
356 if ((psize = strrchr(
this,
':'))) {
358 ast_debug(1,
"Packetization for codec: %s is %s\n",
this, psize);
359 if (!sscanf(psize,
"%30d", &framems) || (framems < 0)) {
362 ast_log(LOG_WARNING,
"Bad packetization value for codec %s\n",
this);
366 all = strcasecmp(
this,
"all") ? 0 : 1;
369 ast_log(LOG_WARNING,
"Cannot %s unknown format '%s'\n", iter_allowing ?
"allow" :
"disallow",
this);
421 if (type == AST_MEDIA_TYPE_UNKNOWN) {
470 if (result && result->
framing) {
486 #define FORMAT_CAP_FRAMED_ELEM_CMP(elem, value) ((elem)->format == (value))
493 #define FORMAT_CAP_FRAMED_ELEM_CLEANUP(elem) ao2_cleanup((elem))
500 ast_assert(format != NULL);
532 if ((type != AST_MEDIA_TYPE_UNKNOWN) &&
552 ast_assert(format != NULL);
588 ast_assert(format != NULL);
693 if (!internal_format_cap_identical(cap1, cap2)) {
697 return internal_format_cap_identical(cap2, cap1);
700 static const char *__ast_format_cap_get_names(
const struct ast_format_cap *cap,
struct ast_str **buf,
int append)
736 return __ast_format_cap_get_names(cap, buf, 0);
741 return __ast_format_cap_get_names(cap, buf, 1);
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
Asterisk main include file. File version handling, generic pbx functions.
String manipulation functions.
struct ast_codec * ast_codec_get_by_id(int id)
Retrieve a codec given the unique identifier.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
int ast_codec_get_max(void)
Retrieve the current maximum identifier for codec iteration.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
A set of macros to manage forward-linked lists.
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_VECTOR(name, type)
Define a vector structure.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
Support for dynamic strings.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Support for logging to various files, console and syslog Configuration in file logger.conf.
Vector container support.
#define AST_VECTOR_REMOVE_CMP_ORDERED(vec, value, cmp, cleanup)
Remove an element from a vector that matches the given comparison while maintaining order...
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
#define AST_VECTOR_REPLACE(vec, idx, elem)
Replace an element at a specific position in a vector, growing the vector if needed.
enum ast_media_type type
Type of media this codec contains.
ast_media_type
Types of media.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Represents a media codec within Asterisk.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.