SILK format attribute interface. More...

Go to the source code of this file.
Data Structures | |
| struct | silk_attr |
| SILK attribute structure. More... | |
Functions | |
| static void | __reg_module (void) |
| static void | __unreg_module (void) |
| static int | load_module (void) |
| static enum ast_format_cmp_res | silk_cmp (const struct ast_format_attr *fattr1, const struct ast_format_attr *fattr2) |
| static int | silk_get_val (const struct ast_format_attr *fattr, int key, void *result) |
| static int | silk_getjoint (const struct ast_format_attr *fattr1, const struct ast_format_attr *fattr2, struct ast_format_attr *result) |
| static int | silk_isset (const struct ast_format_attr *fattr, va_list ap) |
| static void | silk_sdp_generate (const struct ast_format_attr *format_attr, unsigned int payload, struct ast_str **str) |
| static int | silk_sdp_parse (struct ast_format_attr *format_attr, const char *attributes) |
| static void | silk_set (struct ast_format_attr *fattr, va_list ap) |
| static int | unload_module (void) |
Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SILK Format Attribute Module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, } |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static struct ast_format_attr_interface | silk_interface |
SILK format attribute interface.
Definition in file res_format_attr_silk.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 251 of file res_format_attr_silk.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 251 of file res_format_attr_silk.c.
| static int load_module | ( | void | ) | [static] |
Definition at line 232 of file res_format_attr_silk.c.
References ast_format_attr_reg_interface(), AST_MODULE_LOAD_DECLINE, and AST_MODULE_LOAD_SUCCESS.
{
if (ast_format_attr_reg_interface(&silk_interface)) {
return AST_MODULE_LOAD_DECLINE;
}
return AST_MODULE_LOAD_SUCCESS;
}
| static enum ast_format_cmp_res silk_cmp | ( | const struct ast_format_attr * | fattr1, |
| const struct ast_format_attr * | fattr2 | ||
| ) | [static] |
Definition at line 80 of file res_format_attr_silk.c.
References AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, and silk_attr::samplerate.
{
struct silk_attr *attr1 = (struct silk_attr *) fattr1;
struct silk_attr *attr2 = (struct silk_attr *) fattr2;
if (attr1->samplerate == attr2->samplerate) {
return AST_FORMAT_CMP_EQUAL;
}
return AST_FORMAT_CMP_NOT_EQUAL;
}
| static int silk_get_val | ( | const struct ast_format_attr * | fattr, |
| int | key, | ||
| void * | result | ||
| ) | [static] |
Definition at line 91 of file res_format_attr_silk.c.
References ast_log(), silk_attr::dtx, silk_attr::fec, LOG_WARNING, silk_attr::maxbitrate, silk_attr::packetloss_percentage, silk_attr::samplerate, SILK_ATTR_KEY_DTX, SILK_ATTR_KEY_FEC, SILK_ATTR_KEY_MAX_BITRATE, SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE, and SILK_ATTR_KEY_SAMP_RATE.
{
const struct silk_attr *attr = (struct silk_attr *) fattr;
int *val = result;
switch (key) {
case SILK_ATTR_KEY_SAMP_RATE:
*val = attr->samplerate;
break;
case SILK_ATTR_KEY_MAX_BITRATE:
*val = attr->maxbitrate;
break;
case SILK_ATTR_KEY_DTX:
*val = attr->dtx;
break;
case SILK_ATTR_KEY_FEC:
*val = attr->fec;
break;
case SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE:
*val = attr->packetloss_percentage;
break;
default:
ast_log(LOG_WARNING, "unknown attribute type %d\n", key);
return -1;
}
return 0;
}
| static int silk_getjoint | ( | const struct ast_format_attr * | fattr1, |
| const struct ast_format_attr * | fattr2, | ||
| struct ast_format_attr * | result | ||
| ) | [static] |
Definition at line 161 of file res_format_attr_silk.c.
References silk_attr::dtx, silk_attr::fec, MAX, silk_attr::maxbitrate, MIN, silk_attr::packetloss_percentage, and silk_attr::samplerate.
{
struct silk_attr *attr1 = (struct silk_attr *) fattr1;
struct silk_attr *attr2 = (struct silk_attr *) fattr2;
struct silk_attr *attr_res = (struct silk_attr *) result;
int joint = -1;
attr_res->samplerate = attr1->samplerate & attr2->samplerate;
/* sample rate is the only attribute that has any bearing on if joint capabilities exist or not */
if (attr_res->samplerate) {
joint = 0;
}
/* Take the lowest max bitrate */
attr_res->maxbitrate = MIN(attr1->maxbitrate, attr2->maxbitrate);
/* Only do dtx if both sides want it. DTX is a trade off between
* computational complexity and bandwidth. */
attr_res->dtx = attr1->dtx && attr2->dtx ? 1 : 0;
/* Only do FEC if both sides want it. If a peer specifically requests not
* to receive with FEC, it may be a waste of bandwidth. */
attr_res->fec = attr1->fec && attr2->fec ? 1 : 0;
/* Use the maximum packetloss percentage between the two attributes. This affects how
* much redundancy is used in the FEC. */
attr_res->packetloss_percentage = MAX(attr1->packetloss_percentage, attr2->packetloss_percentage);
return joint;
}
| static int silk_isset | ( | const struct ast_format_attr * | fattr, |
| va_list | ap | ||
| ) | [static] |
Definition at line 119 of file res_format_attr_silk.c.
References AST_FORMAT_ATTR_END, ast_log(), silk_attr::dtx, silk_attr::fec, LOG_WARNING, silk_attr::maxbitrate, silk_attr::packetloss_percentage, silk_attr::samplerate, SILK_ATTR_KEY_DTX, SILK_ATTR_KEY_FEC, SILK_ATTR_KEY_MAX_BITRATE, SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE, and SILK_ATTR_KEY_SAMP_RATE.
{
enum silk_attr_keys key;
const struct silk_attr *attr = (struct silk_attr *) fattr;
for (key = va_arg(ap, int);
key != AST_FORMAT_ATTR_END;
key = va_arg(ap, int))
{
switch (key) {
case SILK_ATTR_KEY_SAMP_RATE:
if (attr->samplerate != (va_arg(ap, int))) {
return -1;
}
break;
case SILK_ATTR_KEY_MAX_BITRATE:
if (attr->maxbitrate != (va_arg(ap, int))) {
return -1;
}
break;
case SILK_ATTR_KEY_DTX:
if (attr->dtx != (va_arg(ap, int))) {
return -1;
}
break;
case SILK_ATTR_KEY_FEC:
if (attr->fec != (va_arg(ap, int))) {
return -1;
}
break;
case SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE:
if (attr->packetloss_percentage != (va_arg(ap, int))) {
return -1;
}
break;
default:
ast_log(LOG_WARNING, "unknown attribute type %d\n", key);
return -1;
}
}
return 0;
}
| static void silk_sdp_generate | ( | const struct ast_format_attr * | format_attr, |
| unsigned int | payload, | ||
| struct ast_str ** | str | ||
| ) | [static] |
Definition at line 68 of file res_format_attr_silk.c.
References ast_str_append(), silk_attr::dtx, silk_attr::fec, and silk_attr::maxbitrate.
{
struct silk_attr *attr = (struct silk_attr *) format_attr;
if ((attr->maxbitrate > 5000) && (attr->maxbitrate < 40000)) {
ast_str_append(str, 0, "a=fmtp:%d maxaveragebitrate=%d\r\n", payload, attr->maxbitrate);
}
ast_str_append(str, 0, "a=fmtp:%d usedtx=%d\r\n", payload, attr->dtx);
ast_str_append(str, 0, "a=fmtp:%d useinbandfec=%d\r\n", payload, attr->fec);
}
| static int silk_sdp_parse | ( | struct ast_format_attr * | format_attr, |
| const char * | attributes | ||
| ) | [static] |
Definition at line 50 of file res_format_attr_silk.c.
References silk_attr::dtx, silk_attr::fec, and silk_attr::maxbitrate.
{
struct silk_attr *attr = (struct silk_attr *) format_attr;
unsigned int val;
if (sscanf(attributes, "maxaveragebitrate=%30u", &val) == 1) {
attr->maxbitrate = val;
}
if (sscanf(attributes, "usedtx=%30u", &val) == 1) {
attr->dtx = val;
}
if (sscanf(attributes, "useinbandfec=%30u", &val) == 1) {
attr->fec = val;
}
return 0;
}
| static void silk_set | ( | struct ast_format_attr * | fattr, |
| va_list | ap | ||
| ) | [static] |
Definition at line 190 of file res_format_attr_silk.c.
References AST_FORMAT_ATTR_END, ast_log(), silk_attr::dtx, silk_attr::fec, LOG_WARNING, silk_attr::maxbitrate, silk_attr::packetloss_percentage, silk_attr::samplerate, SILK_ATTR_KEY_DTX, SILK_ATTR_KEY_FEC, SILK_ATTR_KEY_MAX_BITRATE, SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE, and SILK_ATTR_KEY_SAMP_RATE.
{
enum silk_attr_keys key;
struct silk_attr *attr = (struct silk_attr *) fattr;
for (key = va_arg(ap, int);
key != AST_FORMAT_ATTR_END;
key = va_arg(ap, int))
{
switch (key) {
case SILK_ATTR_KEY_SAMP_RATE:
attr->samplerate = (va_arg(ap, int));
break;
case SILK_ATTR_KEY_MAX_BITRATE:
attr->maxbitrate = (va_arg(ap, int));
break;
case SILK_ATTR_KEY_DTX:
attr->dtx = (va_arg(ap, int));
break;
case SILK_ATTR_KEY_FEC:
attr->fec = (va_arg(ap, int));
break;
case SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE:
attr->packetloss_percentage = (va_arg(ap, int));
break;
default:
ast_log(LOG_WARNING, "unknown attribute type %d\n", key);
}
}
}
| static int unload_module | ( | void | ) | [static] |
Definition at line 241 of file res_format_attr_silk.c.
References ast_format_attr_unreg_interface().
{
ast_format_attr_unreg_interface(&silk_interface);
return 0;
}
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SILK Format Attribute Module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, } [static] |
Definition at line 251 of file res_format_attr_silk.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 251 of file res_format_attr_silk.c.
struct ast_format_attr_interface silk_interface [static] |
Definition at line 221 of file res_format_attr_silk.c.