#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/format.h"

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_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 |
Definition in file res_format_attr_silk.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 219 of file res_format_attr_silk.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 219 of file res_format_attr_silk.c.
| static int load_module | ( | void | ) | [static] |
Definition at line 200 of file res_format_attr_silk.c.
References ast_format_attr_reg_interface(), AST_MODULE_LOAD_DECLINE, and AST_MODULE_LOAD_SUCCESS.
00201 { 00202 if (ast_format_attr_reg_interface(&silk_interface)) { 00203 return AST_MODULE_LOAD_DECLINE; 00204 } 00205 00206 return AST_MODULE_LOAD_SUCCESS; 00207 }
| static enum ast_format_cmp_res silk_cmp | ( | const struct ast_format_attr * | fattr1, | |
| const struct ast_format_attr * | fattr2 | |||
| ) | [static] |
Definition at line 50 of file res_format_attr_silk.c.
References AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, and silk_attr::samplerate.
00051 { 00052 struct silk_attr *attr1 = (struct silk_attr *) fattr1; 00053 struct silk_attr *attr2 = (struct silk_attr *) fattr2; 00054 00055 if (attr1->samplerate == attr2->samplerate) { 00056 return AST_FORMAT_CMP_EQUAL; 00057 } 00058 return AST_FORMAT_CMP_NOT_EQUAL; 00059 }
| static int silk_get_val | ( | const struct ast_format_attr * | fattr, | |
| int | key, | |||
| void * | result | |||
| ) | [static] |
Definition at line 61 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.
00062 { 00063 const struct silk_attr *attr = (struct silk_attr *) fattr; 00064 int *val = result; 00065 00066 switch (key) { 00067 case SILK_ATTR_KEY_SAMP_RATE: 00068 *val = attr->samplerate; 00069 break; 00070 case SILK_ATTR_KEY_MAX_BITRATE: 00071 *val = attr->maxbitrate; 00072 break; 00073 case SILK_ATTR_KEY_DTX: 00074 *val = attr->dtx; 00075 break; 00076 case SILK_ATTR_KEY_FEC: 00077 *val = attr->fec; 00078 break; 00079 case SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE: 00080 *val = attr->packetloss_percentage; 00081 break; 00082 default: 00083 ast_log(LOG_WARNING, "unknown attribute type %d\n", key); 00084 return -1; 00085 } 00086 return 0; 00087 }
| 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 131 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.
00132 { 00133 struct silk_attr *attr1 = (struct silk_attr *) fattr1; 00134 struct silk_attr *attr2 = (struct silk_attr *) fattr2; 00135 struct silk_attr *attr_res = (struct silk_attr *) result; 00136 int joint = -1; 00137 00138 attr_res->samplerate = attr1->samplerate & attr2->samplerate; 00139 /* sample rate is the only attribute that has any bearing on if joint capabilities exist or not */ 00140 if (attr_res->samplerate) { 00141 joint = 0; 00142 } 00143 /* Take the lowest max bitrate */ 00144 attr_res->maxbitrate = MIN(attr1->maxbitrate, attr2->maxbitrate); 00145 00146 /* Only do dtx if both sides want it. DTX is a trade off between 00147 * computational complexity and bandwidth. */ 00148 attr_res->dtx = attr1->dtx && attr2->dtx ? 1 : 0; 00149 00150 /* Only do FEC if both sides want it. If a peer specifically requests not 00151 * to receive with FEC, it may be a waste of bandwidth. */ 00152 attr_res->fec = attr1->fec && attr2->fec ? 1 : 0; 00153 00154 /* Use the maximum packetloss percentage between the two attributes. This affects how 00155 * much redundancy is used in the FEC. */ 00156 attr_res->packetloss_percentage = MAX(attr1->packetloss_percentage, attr2->packetloss_percentage); 00157 return joint; 00158 }
| static int silk_isset | ( | const struct ast_format_attr * | fattr, | |
| va_list | ap | |||
| ) | [static] |
Definition at line 89 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.
00090 { 00091 enum silk_attr_keys key; 00092 const struct silk_attr *attr = (struct silk_attr *) fattr; 00093 00094 for (key = va_arg(ap, int); 00095 key != AST_FORMAT_ATTR_END; 00096 key = va_arg(ap, int)) 00097 { 00098 switch (key) { 00099 case SILK_ATTR_KEY_SAMP_RATE: 00100 if (attr->samplerate != (va_arg(ap, int))) { 00101 return -1; 00102 } 00103 break; 00104 case SILK_ATTR_KEY_MAX_BITRATE: 00105 if (attr->maxbitrate != (va_arg(ap, int))) { 00106 return -1; 00107 } 00108 break; 00109 case SILK_ATTR_KEY_DTX: 00110 if (attr->dtx != (va_arg(ap, int))) { 00111 return -1; 00112 } 00113 break; 00114 case SILK_ATTR_KEY_FEC: 00115 if (attr->fec != (va_arg(ap, int))) { 00116 return -1; 00117 } 00118 break; 00119 case SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE: 00120 if (attr->packetloss_percentage != (va_arg(ap, int))) { 00121 return -1; 00122 } 00123 break; 00124 default: 00125 ast_log(LOG_WARNING, "unknown attribute type %d\n", key); 00126 return -1; 00127 } 00128 } 00129 return 0; 00130 }
| static void silk_set | ( | struct ast_format_attr * | fattr, | |
| va_list | ap | |||
| ) | [static] |
Definition at line 160 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.
00161 { 00162 enum silk_attr_keys key; 00163 struct silk_attr *attr = (struct silk_attr *) fattr; 00164 00165 for (key = va_arg(ap, int); 00166 key != AST_FORMAT_ATTR_END; 00167 key = va_arg(ap, int)) 00168 { 00169 switch (key) { 00170 case SILK_ATTR_KEY_SAMP_RATE: 00171 attr->samplerate = (va_arg(ap, int)); 00172 break; 00173 case SILK_ATTR_KEY_MAX_BITRATE: 00174 attr->maxbitrate = (va_arg(ap, int)); 00175 break; 00176 case SILK_ATTR_KEY_DTX: 00177 attr->dtx = (va_arg(ap, int)); 00178 break; 00179 case SILK_ATTR_KEY_FEC: 00180 attr->fec = (va_arg(ap, int)); 00181 break; 00182 case SILK_ATTR_KEY_PACKETLOSS_PERCENTAGE: 00183 attr->packetloss_percentage = (va_arg(ap, int)); 00184 break; 00185 default: 00186 ast_log(LOG_WARNING, "unknown attribute type %d\n", key); 00187 } 00188 } 00189 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 209 of file res_format_attr_silk.c.
References ast_format_attr_unreg_interface().
00210 { 00211 ast_format_attr_unreg_interface(&silk_interface); 00212 return 0; 00213 }
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 219 of file res_format_attr_silk.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 219 of file res_format_attr_silk.c.
struct ast_format_attr_interface silk_interface [static] |
Definition at line 191 of file res_format_attr_silk.c.
1.5.6