43 unsigned int maximum_frame_rate;
44 unsigned int maximum_frame_size;
47 static struct vp8_attr default_vp8_attr = {
48 .maximum_frame_rate = UINT_MAX,
49 .maximum_frame_size = UINT_MAX,
52 static void vp8_destroy(
struct ast_format *format)
71 *attr = default_vp8_attr;
79 static struct ast_format *vp8_parse_sdp_fmtp(
const struct ast_format *format,
const char *attributes)
94 for (attrib = attribs; *attrib; ++attrib) {
95 *attrib = tolower(*attrib);
98 if ((kvp = strstr(attribs,
"max-fr")) && sscanf(kvp,
"max-fr=%30u", &val) == 1) {
99 attr->maximum_frame_rate = val;
101 attr->maximum_frame_rate = UINT_MAX;
104 if ((kvp = strstr(attribs,
"max-fs")) && sscanf(kvp,
"max-fs=%30u", &val) == 1) {
105 attr->maximum_frame_size = val;
107 attr->maximum_frame_size = UINT_MAX;
113 static void vp8_generate_sdp_fmtp(
const struct ast_format *format,
unsigned int payload,
struct ast_str **str)
124 attr = &default_vp8_attr;
127 if (UINT_MAX != attr->maximum_frame_rate) {
136 if (UINT_MAX != attr->maximum_frame_size) {
158 attr1 = &default_vp8_attr;
162 attr2 = &default_vp8_attr;
171 attr_res->maximum_frame_rate = MIN(attr1->maximum_frame_rate, attr2->maximum_frame_rate);
172 attr_res->maximum_frame_size = MIN(attr1->maximum_frame_size, attr2->maximum_frame_size);
183 if (sscanf(value,
"%30u", &val) != 1) {
184 ast_log(LOG_WARNING,
"Unknown value '%s' for attribute type '%s'\n",
195 if (!strcasecmp(name,
"maximum_frame_rate")) {
196 attr->maximum_frame_rate = val;
197 }
else if (!strcasecmp(name,
"maximum_frame_size")) {
198 attr->maximum_frame_size = val;
200 ast_log(LOG_WARNING,
"unknown attribute type %s\n", name);
208 .format_clone = vp8_clone,
209 .format_get_joint = vp8_getjoint,
210 .format_attribute_set = vp8_set,
211 .format_parse_sdp_fmtp = vp8_parse_sdp_fmtp,
212 .format_generate_sdp_fmtp = vp8_generate_sdp_fmtp,
215 static int load_module(
void)
224 static int unload_module(
void)
229 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER,
"VP8 Format Attribute Module",
230 .support_level = AST_MODULE_SUPPORT_CORE,
232 .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 ast_malloc(len)
A wrapper for malloc()
Support for dynamic strings.
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.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.