47 unsigned int samplerate;
48 unsigned int maxbitrate;
49 unsigned int framesize;
52 static void celt_destroy(
struct ast_format *format)
77 static struct ast_format *celt_parse_sdp_fmtp(
const struct ast_format *format,
const char *attributes)
91 for (attrib = attribs; *attrib; ++attrib) {
92 *attrib = tolower(*attrib);
95 if (sscanf(attribs,
"framesize=%30u", &val) == 1) {
96 attr->framesize = val;
102 static void celt_generate_sdp_fmtp(
const struct ast_format *format,
unsigned int payload,
struct ast_str **str)
106 if (!attr || !attr->framesize) {
110 ast_str_append(str, 0,
"a=fmtp:%u framesize=%u\r\n", payload, attr->framesize);
118 if (((!attr1 || !attr1->samplerate) && (!attr2 || !attr2->samplerate)) ||
119 (attr1->samplerate == attr2->samplerate)) {
133 if (attr1 && attr2 && (attr1->samplerate != attr2->samplerate)) {
144 jointattr->samplerate = attr1->samplerate;
146 jointattr->maxbitrate = MIN(attr1->maxbitrate, attr2->maxbitrate);
148 jointattr->framesize = attr2->framesize;
165 if (sscanf(value,
"%30u", &val) != 1) {
166 ast_log(LOG_WARNING,
"Unknown value '%s' for attribute type '%s'\n",
172 if (!strcasecmp(name,
"sample_rate")) {
173 attr->samplerate = val;
174 }
else if (!strcasecmp(name,
"max_bitrate")) {
175 attr->maxbitrate = val;
176 }
else if (!strcasecmp(name,
"frame_size")) {
177 attr->framesize = val;
179 ast_log(LOG_WARNING,
"Unknown attribute type '%s'\n", name);
189 .format_clone = celt_clone,
190 .format_cmp = celt_cmp,
191 .format_get_joint = celt_getjoint,
192 .format_attribute_set = celt_set,
193 .format_parse_sdp_fmtp = celt_parse_sdp_fmtp,
194 .format_generate_sdp_fmtp = celt_generate_sdp_fmtp,
197 static int load_module(
void)
206 static int unload_module(
void)
211 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER,
"CELT Format Attribute Module",
212 .support_level = AST_MODULE_SUPPORT_CORE,
214 .unload = unload_module,
Asterisk main include file. File version handling, generic pbx functions.
String manipulation functions.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#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.
Support for dynamic strings.
#define ast_calloc(num, len)
A wrapper for calloc()
Support for logging to various files, console and syslog Configuration in file logger.conf.
Module has failed to load, may be in an inconsistent state.
CELT attribute structure.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.